Enterprise-grade NestJS starter kit with battle-tested architecture and security-first design. Built for teams who need a robust foundation for scalable Node.js applications with:
- π± NestJS β Latest version with TypeScript support
- π Security
- JWT Authentication with RSA256
- Role-Based Access Control (RBAC)
- Claims-Based Access Control (CBAC)
- Helmet for secure HTTP headers
- πͺ Database
- PostgreSQL with TypeORM
- Migration support
- Database schema synchronization
- π Development Tools
- Docker Compose setup
- Environment configuration with Dotenv
- Swagger API documentation
- ESLint & Prettier configuration
- Conventional commit linting
- CodeQL security scanning
- Jest testing framework
- π Documentation
- Swagger UI
- Insomnia API collection
src/
βββ auth/ # Authentication & authorization
βββ config/ # Configuration modules
βββ logger/ # Custom logging functionality
βββ tasks/ # Task management module
βββ users/ # User management module
βββ app.module.ts # Main application module
βββ main.ts # Application entry point
- Node.js >= 20.0.0
- npm >= 10.0.0
- PostgreSQL
- Docker (optional)
bash ./setup.sh
- Install dependencies:
npm install
- Copy environment file:
cp .env.example .env
- Configure your environment variables in
.env
# Development mode
npm run start
# Watch mode with hot-reload
npm run start:dev
# Production mode
npm run start:prod
# Sync database schema
npm run schema:sync
# Generate migration
npm run add:migration [MigrationName]
# Apply migrations
npm run apply:migration
# Revert last migration
npm run revert:migration
# Build containers
npm run docker:build
# Start services
npm run docker:up
# Stop services
npm run docker:down
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:cov
openssl genrsa -out private_key.pem 2048
# Format key for environment variable
awk 'NF {sub(/\r/, ""); printf"%s\\n",$0;}' private_key.pem
openssl rsa -in private_key.pem -outform PEM -pubout -out public_key.pem
# Format key for environment variable
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' public_key.pem
Access the Swagger documentation at /api
when running the application.
- Install Insomnia
- Import the
endpoints.json
file - Start exploring the APIs
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'feat: add 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.md file for details.
Joseph Goksu π |