A feature-rich and production-ready NestJS starter with built-in enterprise-grade architecture and popular libraries. Supports TypeScript, PostgreSQL/MySQL, TypeORM, JWT Authentication, Docker, and other essential features.
- π Built with NestJS 10.x & Node.js 18+
- π TypeScript for type safety and better development experience
- ποΈ Clean Architecture and Domain-Driven Design principles
- π JWT Authentication & Role-based Authorization
- π Sign in and sign up via email.
- π Social sign in (Apple, Facebook, Google, Twitter).
- π RBAC with custom Roles and Permissions
- ποΈ TypeORM with PostgreSQL integration
- π Swagger API documentation
- π Request validation using class-validator
- π― Unit & Integration testing setup with Jest
- π E2E testing with Supertest
- π CI/CD pipeline with GitHub Actions
- π³ Docker & Docker Compose configuration
- π Winston Logger integration
- π Error handling & logging middleware
- π§ Mailer service integration
- π Database migrations and seeders
- π ESLint & Prettier configuration
- πΎ Redis for caching
- π Bull for queue management
- π Health checks endpoints
- Node.js 18+
- PostgreSQL
- Redis
- Docker (optional)
# Clone the repository
git clone https://github.com/yourusername/nestjs-boilerplate.git
# Install dependencies
npm install
- Copy
.env.example
to.env
cp .env.example .env
- Update environment variables in
.env
file
# Development
npm run start:dev
# Production mode
npm run start:prod
# Using Docker
docker-compose up
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:cov
src/
βββ config/ # Configuration files
βββ core/ # Core modules, guards, decorators
βββ modules/ # Feature modules
β βββ auth/
β βββ users/
β βββ ...
βββ shared/ # Shared resources
βββ main.ts # Application entry point
src/
βββ modules/
βββ auth/
βββ domain/ # Domain layer
β βββ entities/ # Domain entities
β βββ value-objects/ # Value objects
β βββ repositories/ # Repository interfaces
β βββ services/ # Domain services
β
βββ infrastructure/ # Infrastructure layer
β βββ persistence/ # Database related
β β βββ entities/ # TypeORM entities
β β βββ repositories/ # TypeORM repositories
β β βββ migrations/ # Database migrations
β βββ services/ # External services implementation
β βββ security/ # Security related implementations
β
βββ interfaces/ # Interface layer
β βββ http/ # HTTP controllers
β β βββ controllers/
β β βββ middlewares/
β β βββ guards/
β β βββ dtos/
β βββ graphql/ # GraphQL resolvers (if needed)
β
βββ services/ # Application Services
β βββ auth.service.ts
β βββ social-auth.service.ts
β
βββ auth.module.ts # Module definition
Once the application is running, you can access the Swagger documentation at:
http://localhost:3000/api/docs
# Generate migration
npm run migration:generate -- src/modules/auth/infrastructure/persistence/migrations/CreateUsersTable
# Run migrations
npm run migration:run
# Revert migrations
npm run migration:revert
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you find this project useful, please give it a βοΈ on GitHub!
- NETKO Solution
- NestJS Team for the amazing framework
- The open-source community for inspiration and support