A NestJS API boilerplate using DDD + CQRS + Docker.
Name | Description |
---|---|
NestJS | A progressive Node.js framework for building efficient, reliable and scalable server-side applications. |
Docker | A platform designed to help developers build, share, and run modern applications. |
Husky | Git hooks made easy dog woof! |
Biome | Format, lint, and more in a fraction of a second. code. |
Prettier | An opinionated code formatter. |
Lint Staged | Run linters on git staged files. |
- Volta* - a node/npm version manager
- Docker** - An one-click-install application that enables you to build and share containerized applications and microservices.
- Docker Compose - Plugin for running multi-container Docker applications
** "Alternative" to Docker: orbstack
Create a copy of .env.example
with the name .env
and placed it at the root of the project
cp .env.example .env
Replace its values with your own credentials.
Run the following commands to install all dependencies:
volta install node
volta install npm@bundled
npm i
Run npm run start:dev
to start a development server that watch for changes. For a debug server use: npm run start:debug
Run npm run build
to compile for production. Then run npm run start:prod
to start a production server.
Check out the deployment documentation for more information.
Run make dev
to build and start development docker containers from docker-compose-dev.yml
, or run make deploy
to build and start production docker containers from docker-compose.yml
.
.
└── nestjs-cqrs-boilerplate # Project root
├── .husky/ # Git hooks
├── .vscode/ # VSCode settings & recommended extensions
├── dist/ # API compilation
├── node_modules/ # NPM Packages
├── src/ # Source: DDD + Clean Arch + CQRS
│ ├── application/ # Application Layer: Commands, Queries & Events
│ ├── domain/ # Domain Layer: Services, Entities, etc
│ ├── infraestructure/ # Infraestructure Layer: Server Config, Envs, Adapters, etc
│ └── interface/ # Interface Layer: Interfaces, Controllers, Dtos, etc
└── test/ # Test files
Script | Description |
---|---|
npm run start |
Start server (without watch) |
npm run start:dev |
Start development server |
npm run start:debug |
Start debug development server |
npm run start:prod |
Start production server |
Script | Description |
---|---|
npm run build |
Build project |
Script | Description |
---|---|
npm run format |
Format files with Prettier |
npm run check |
Lint, format and apply fixes with Biome |
npm run lint |
Lint files with Biome |
npm run lint:fix |
Lint & fix files with Biome |
npm run lint:ts |
Check typescript files |
Script | Description |
---|---|
npm run prepare |
Install Husky git hooks |
make dev |
Build & start development server with docker |
make deploy |
Build & start production server with docker |
Check out a few resources that may come in handy when working with NestJS:
- Visit the NestJS Documentation to learn more about the framework.
- Deploy your application to AWS with the help of NestJS Mau in just a few clicks.
- Visualize your application graph and interact with the NestJS application in real-time using NestJS Devtools.