NestJS API Boilerplate
A production-ready NestJS API boilerplate with TypeORM, Redis, PostgreSQL, and Docker support. Based on nestjs-starter-rest-api by Monstar Lab.
- 🚀 NestJS Framework
- 🔐 JWT Authentication
- 🎯 TypeORM with PostgreSQL
- 📝 Swagger API Documentation
- 🐳 Docker & Docker Compose
- 🔄 Redis as a message queue
- 🔍 E2E Testing Setup
- 🛡️ Role-Based Access Control (RBAC)
- 🔄 Database Migrations & Seeding
- 🌐 NGINX Reverse Proxy
- Docker & Docker Compose
- Node.js 16+
- Yarn package manager
- Clone the repository
- Create environment variables file:
cp .env.example .env
- Configure Redis (required for queue system):
./queue/prod-conf/init-redis.sh
- Start the development environment:
make up
# Start services
make up
# View logs
make logs
# Stop services
make down
# Rebuild services
make build
# Run migrations
make dc exec app yarn migration:run
# Seed database with initial data
make dc exec app yarn migration:seed
# Generate new migration
make dc exec app yarn migration:generate --name=MigrationName
# Generate new NestJS module
make api-gen
.
├── apps/api/ # NestJS application
│ ├── src/ # Source code
│ ├── test/ # E2E tests
│ └── migrations/ # Database migrations
├── proxy/ # NGINX configuration
├── queue/ # Redis configuration
└── docker-compose.yml
- API: NestJS application (default: port 5969)
- PostgreSQL: Database server
- Redis: Caching and queue management
- NGINX: Reverse proxy
API documentation is available at /docs
endpoint when the server is running.
Detailed documentation is available in the docs/
directory:
-
Architecture Guide: Comprehensive overview of the module structure, including:
- Module components and layers
- Security features
- Best practices
- Common design patterns
-
Makefile Guide: Documentation for all available make commands and environment configurations:
- Available commands and their usage
- Environment configuration options
- Customization guidelines
- Docker Compose service management
For architecture details, see docs/architecture.md For build and deployment commands, see docs/makefile.md
# Run e2e tests
make dc exec app yarn test:e2e
For more commands, run:
make help