Skip to content

niraj-khatiwada/ultimate-nestjs-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ultimate Nest.js Boilerplate ⚡

Advanced Nest.js boilerplate for scalable startups.

Features📦

  • 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

1. Automatic API generation on the Frontend 🚀

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

2. Dependency Graph 📈

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

3. Database Entity Relationship Diagram🛢️

Visualize your database entities and their relationships.

pnpm erd:generate

4. Server & Database Monitoring 📊

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.

Server Monitoring Dashboard: alt text

Database Monitoring Dashboard: alt text

5. Docker 🐬

For local development:
  • Start container:
pnpm docker:dev:up
  • Stop container:
pnpm docker:dev:down
For prod build:
  • Start container:
pnpm docker:prod:up
  • Stop container:
pnpm docker:prod:down
Deployment:
sh ./bin/deploy.sh

or run workflow .github/workflows/main.yml via GitHub Actions.

This boilerplate is extended from nestjs-boilerplate