A progressive Node.js framework for building efficient, scalable, and maintainable server-side applications.
This repository provides a production-ready NestJS backend boilerplate intended for real-world, scalable applications.
The architecture emphasizes:
- clear separation of concerns,
- strong configuration management,
- safe database migrations,
- background job processing,
- CLI tooling,
- caching,
- notifications,
- and environment-based execution.
The application supports PostgreSQL and MySQL, with the active database selected at runtime via environment variables.
- JWT Authentication (Passport-JWT)
- Global Exception Handling
- Centralized Logging Layer
- Helper Utilities Module
- API Rate Limiting
- Request Validation (
class-validator) - Encryption and Decryption Utilities
- PostgreSQL & MySQL support (runtime switchable)
- TypeORM with Migration-first workflow
- Roles & Permissions (RBAC)
- Users, Roles, Permissions modules with migrations
- Database Seeder implementation
- CRUD operations on User module
- Redis Cache
- Node Cache
- API Documentation (Swagger)
- Standardized API Response Layer
- Email sending (Handlebars templates)
- Email & Web Push Notifications
- Bull Queue Management
- Background Jobs
- Auto-discovered CLI Commands
- Postman API Collection
Install project dependencies:
npm install
Before running the application, you must create an environment file. Create .env.development
cp .env.example .env.developmentWeb Push Notifications require VAPID public/private keys.
Generate them using:
npx web-push generate-vapid-keysExample output:
Public Key: BExxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Private Key: 6Vxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Add these values to your .env.development file:
VAPID_PUBLIC_KEY=your_public_key_here VAPID_PRIVATE_KEY=your_private_key_here
Development mode
npm run startWatch mode (recommended during development)
npm run start:devProduction mode
npm run start:prodRun Migrations (Required)
This step creates all database tables.
npm run migration:runSeed Initial Data: Seed default data such as roles and permissions:
npm run seedThe project includes a dynamic CLI system. All commands are auto-discovered from the src/cli/commands directory.
List available commands
npm run cli -- --helpList Bull queues
npm run cli list-queuesEmpty a queue
npm run cli empty-queue default allSwagger documentation is available at:
http://localhost:5001/apiAbid Maqbool
- Email - abidmaqbool20@gmail.com
- Website - https://abidmaqbool.com
This project is licensed under the MIT License.