A comprehensive water plant management system built with Payload CMS 3.0 and Next.js 15, designed to manage water delivery operations, customer relationships, and business operations.
- Customer Management: Track customer information, delivery schedules, and preferences
- Trip Management: Organize and track water delivery trips
- Invoice Generation: Automated PDF invoice creation and management
- Transaction Tracking: Monitor water bottle transactions and payments
- Employee Management: Manage delivery personnel and staff
- Area & Block Management: Organize delivery zones and territories
- Reporting System: Generate business insights and reports
- WhatsApp Integration: Customer communication via WhatsApp
- Email Automation: Automated email notifications and reports
- PDF Generation: Create professional PDF documents for invoices and trip reports
- Framework: Next.js 15 with React 19
- CMS: Payload CMS 3.0 (built on top of Next.js)
- Database: MongoDB with Mongoose
- File Storage: UploadThing for media management
- PDF Generation: React PDF Renderer
- Email: Nodemailer with cron jobs
- Testing: Playwright (E2E) + Vitest (Unit/Integration)
- Package Manager: pnpm
- TypeScript: Full type safety
- Node.js 18.20.2+ or 20.9.0+
- pnpm 9+ or 10+
- MongoDB instance
- UploadThing account (for file storage)
git clone git@github.com:Furqankhanzada/water-plant.git
cd water-plantpnpm installCreate a .env file in the root directory with the following variables:
# Database
DATABASE_URI=mongodb://localhost:27017/water-plant
# Payload
PAYLOAD_SECRET=your-secret-key-here
# UploadThing (for file storage)
UPLOADTHING_TOKEN=your-uploadthing-token
# Email (optional)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
# WhatsApp (optional)
WHATSAPP_API_KEY=your-whatsapp-api-key
WHATSAPP_PHONE_NUMBER=your-whatsapp-numberpnpm devOpen http://localhost:3000 to access the application.
For a consistent development environment using Docker:
# Start MongoDB and the application
docker-compose up
# Or run in background
docker-compose up -dThe application will be available at http://localhost:3000.
src/
βββ app/ # Next.js app router
β βββ (frontend)/ # Public frontend routes
β βββ (payload)/ # Payload CMS admin routes
β βββ invoices/ # Invoice PDF generation
β βββ trips/ # Trip PDF generation
β βββ whatsapp/ # WhatsApp integration
βββ collections/ # Payload CMS collections
β βββ Customers.ts # Customer management
β βββ Trips.ts # Delivery trip management
β βββ Invoices.ts # Invoice management
β βββ Transactions.ts # Transaction tracking
β βββ Users.ts # User authentication
βββ components/ # React components
βββ hooks/ # Custom React hooks
βββ lib/ # Utility functions
βββ services/ # Business logic services
βββ templates/ # Email and PDF templates
pnpm dev- Start development serverpnpm build- Build for productionpnpm start- Start production serverpnpm test- Run all testspnpm test:e2e- Run end-to-end testspnpm test:int- Run integration testspnpm lint- Run ESLintpnpm generate:types- Generate Payload typespnpm payload- Run Payload CLI commands
The project includes comprehensive testing:
- Unit/Integration Tests: Vitest with React Testing Library
- E2E Tests: Playwright for browser automation
- API Tests: Integration tests for backend endpoints
Run tests with:
pnpm test # All tests
pnpm test:int # Unit/Integration only
pnpm test:e2e # E2E only- Customers: Customer profiles, delivery preferences, contact info
- Trips: Delivery route planning and execution
- Invoices: Billing and payment tracking
- Transactions: Water bottle delivery/pickup records
- Employees: Staff management and roles
- Areas/Blocks: Geographic organization for deliveries
- Users: Authentication and admin access
- Media: File uploads and management
- Reports: Business analytics and insights
- Messages: Communication history
- Requests: Customer service requests
The system uses Payload's built-in authentication with:
- Admin panel access control
- Role-based permissions
- Secure user management
Built-in PDF generation for:
- Invoices: Professional billing documents
- Trip Reports: Delivery completion summaries
- Custom Reports: Business analytics
Automated email system with:
- Cron job scheduling
- Template-based emails
- Transactional notifications
- Report delivery
- GraphQL:
/api/graphql- Full GraphQL API - REST:
/api/[collection]- RESTful endpoints - Admin:
/admin- Payload CMS admin panel
pnpm build
pnpm startEnsure all required environment variables are set in production:
DATABASE_URI- Production MongoDB connectionPAYLOAD_SECRET- Secure secret keyUPLOADTHING_TOKEN- File storage credentials
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For issues and questions:
- Check the Payload CMS documentation
- Review existing issues in the repository
- Create a new issue with detailed information
- v1.1.0 - Current version with full water plant management features
- v1.0.0 - Initial release with core functionality