Advanced Nest.js boilerplate for scalable startups.
- NestJS with Fastify
- Postgres
- TypeORM
- Offset and Cursor based Pagination
- REST & GraphQL API
- Swagger Documentation and API versioning for REST API
- Automatic API generation on the frontend using OpenAPI Codegen Learn More
- Websockets
- BullMQ for Queues. Bull board UI to inspect your jobs.
- Worker server for processing background tasks like queues.
- Caching using Redis
- Pino for Logging
- Rate Limiter using Redis
- Graceful Shutdown
- Server & Database monitoring with Prometheus & Grafana Learn More
- File Uploads using AWS S3
- Sentry
- Testing with Jest
- Internationalization using i18n
- pnpm
- Docker: Dev & Prod ready from single script. Learn More
- Github Actions
- Commitlint & Husky
- SWC instead of Webpack
- Dependency Graph Visualizer Learn More
- Database Entity Relationship Diagram Generator Learn More
You can automatically generate and use all of your backend API in frontend in just one command, thanks to Swagger and OpenAPI spec. Running pnpm codegen
on the frontend (example repo) will automatically generate all API's bootstrapped with Tanstack Query ready to be used with just one import. See complete example here
Visualize all of your project modules and their dependencies. Also, detect circular dependencies.
NOTE: Make sure Graphviz is installed first.
- All dependencies:
pnpm graph:app
- Only circular dependencies:
pnpm graph:circular
Visualize your database entities and their relationships.
pnpm erd:generate
Prometheus & Grafana are available with Docker setup only. You might only need to monitor your server or database when the user base grows or when you want to debug some specific issues. That's why this step is completely optional. If you want to monitor your server or database, just enable monitoring
profile in your .env
i.e. COMPOSE_PROFILES=monitoring
.
Database Monitoring Dashboard:
- Start container:
pnpm docker:dev:up
- Stop container:
pnpm docker:dev:down
- Start container:
pnpm docker:prod:up
- Stop container:
pnpm docker:prod:down
sh ./bin/deploy.sh
or run workflow .github/workflows/main.yml
via GitHub Actions.
This boilerplate is extended from nestjs-boilerplate