Skip to content

js-developer-codebase/Nanopay-Backend

Repository files navigation

MicroPayroll SaaS Backend

A production-ready REST API for automating payroll operations for micro-businesses in India. Built with security, scalability, and developer experience in mind.

🚀 Quick Start

1. Prerequisites

2. Installation

# Clone the repository
git clone <your-repo-url>
cd PayRoll/Backend

# Install dependencies
npm install

# Setup environment variables
cp .env.example .env

Note: Ensure you fill in the keys in the .env file.

3. Start Dependencies

Run Redis using the provided Docker Compose configuration:

docker compose up -d

4. Run the Server

# Development mode (with nodemon)
npm run dev

# Production mode
npm start

🛠️ Tech Stack

  • 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

📁 Key Features

  • 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.

📚 API Documentation

Once the server is running, visit: http://localhost:3000/api/docs

🏗️ Project Structure

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

🧪 Testing

npm test

📜 License

ISC

Releases

No releases published

Packages

 
 
 

Contributors