| .vscode | ||
| app | ||
| prisma | ||
| public | ||
| scripts | ||
| .dockerignore | ||
| .env.dokploy | ||
| .env.production | ||
| .eslintrc.cjs | ||
| .gitignore | ||
| deploy.sh | ||
| DEPLOYMENT.md | ||
| docker-compose.dokploy.yml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| DOKPLOY-DEPLOYMENT.md | ||
| DOKPLOY-TROUBLESHOOTING.md | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.js | ||
| README.md | ||
| tailwind.config.ts | ||
| tsconfig.json | ||
| vite.config.ts | ||
Phosphat Report v2
A Remix application for managing phosphat operations reports with authentication and dashboard.
Development
Run the dev server:
npm run dev
Deployment
First, build your app for production:
npm run build
Then run the app in production mode:
npm start
Now you'll need to pick a host to deploy it to.
DIY
If you're familiar with deploying Node applications, the built-in Remix app server is production-ready.
Make sure to deploy the output of npm run build
build/serverbuild/client
Styling
This template comes with Tailwind CSS already configured for a simple default starting experience. You can use whatever css framework you prefer. See the Vite docs on css for more information.
Quick Start
- Install dependencies:
npm install
- Set up the database:
npx prisma generate
npx prisma db push
npx prisma db seed
- Start the development server:
npm run dev
- Open your browser to
http://localhost:5173
Default Login
After seeding, you can login with:
- Username: admin
- Password: password123
- Auth Level: 3 (Super Admin - Full access)
Authentication Levels
- Level 1: User access (basic functionality)
- Level 2: Admin access (can view dashboard, reports, equipment, management pages)
- Level 3: Super Admin access (full system access including admin panel)
Features
- ✅ User authentication (sign up/sign in)
- ✅ Role-based access control
- ✅ Dashboard with statistics
- ✅ Responsive design with Tailwind CSS
- ✅ SQLite database with Prisma ORM
- ✅ Session management
- ✅ Password hashing with bcrypt
- ✅ Email functionality with SMTP configuration
- ✅ Mail settings management (Auth Level 3 only)
Database Schema
The application includes models for:
- Employees (users with auth levels)
- Reports (main data entity)
- Areas (Petra, Jarash, Rum)
- DredgerLocations (with classes s, d, sp)
- ReclamationLocations (Eastern/Western Shoreline)
- Foreman
- Equipment
- MailSettings (SMTP configuration)
Email Functionality
The application includes email functionality using Nodemailer:
Mail Settings (Auth Level 3 Required)
- Configure SMTP settings via
/mail-settingsroute - Test email connection
- Secure password storage
Using the Mail Utility
import { sendNotificationEmail, sendReportEmail } from "~/utils/mail.server";
// Send a simple notification
const result = await sendNotificationEmail(
"user@example.com",
"Report Generated",
"Your report has been generated successfully."
);
// Send HTML email
const htmlResult = await sendNotificationEmail(
["user1@example.com", "user2@example.com"],
"Weekly Report",
"<h1>Weekly Report</h1><p>Please find the report attached.</p>",
true // isHtml
);
// Send report with attachments
const reportResult = await sendReportEmail(
"manager@example.com",
"Daily Operations Report",
reportData,
[
{
filename: "report.pdf",
content: pdfBuffer,
contentType: "application/pdf"
}
]
);
Available Mail Functions
sendEmail(options)- Core email sending functionsendNotificationEmail(to, subject, message, isHtml)- Simple notificationssendReportEmail(to, subject, reportData, attachments)- Reports with attachmentstestEmailConnection()- Test SMTP configuration
Development
The app uses:
- Remix - Full-stack web framework
- Prisma - Database ORM
- SQLite - Database
- Tailwind CSS - Styling
- TypeScript - Type safety