A production-ready REST API for automating payroll operations for micro-businesses in India. Built with security, scalability, and developer experience in mind.
- Node.js (v18+)
- Docker Desktop (for Redis)
- MongoDB (Local or Atlas)
# Clone the repository
git clone <your-repo-url>
cd PayRoll/Backend
# Install dependencies
npm install
# Setup environment variables
cp .env.example .envNote: Ensure you fill in the keys in the .env file.
Run Redis using the provided Docker Compose configuration:
docker compose up -d# Development mode (with nodemon)
npm run dev
# Production mode
npm start- Core: Node.js & Express
- Database: MongoDB & Mongoose
- Background Tasks: BullMQ & Redis
- Security: RS256 JWT, Helmet, Express Rate Limit
- Validation: Zod
- Documentation: Swagger/OpenAPI
- Logging: Pino
- Tenant Isolation: Middleware for scoped database queries per business.
- Automated Payroll Engine: Calculation of basic, HRA, allowances, and statutory deductions.
- Background Processing: PDF generation and WhatsApp delivery via queues.
- OTP Management: Secure verification using Redis-backed temporary storage.
- S3 Storage: Document management with local mocking for development.
Once the server is running, visit: http://localhost:3000/api/docs
src/
├── config/ # Configurations (DB, Redis, Env)
├── controllers/ # API Controllers
├── jobs/ # BullMQ Workers (Payroll, PDF, WA)
├── middlewares/ # Express middlewares (Auth, Tenant, Validation)
├── models/ # Mongoose Schemas
├── routes/ # API Routes
├── services/ # Business logic (OTP, Storage, WA)
└── utils/ # Helper functions
npm testISC