A NestJS base project with structured environment configuration.
A boilerplate for NestJS applications with best practices and structured setup.
# Install dependencies
$ npm install
# Start in development mode
$ npm run start:dev
# Start with debugging enabled
$ npm run start:debug
# Run unit tests
$ npm run test
# Run test coverage
$ npm run test:cov
# Check and fix linting issues
$ npm run lint --fix
# Build the project
$ npm run build
# Start in production mode
$ npm run start:prod
The project uses YAML-based configuration to manage different environments and external services.
config/default.yaml
→ Contains default configuration for development.config/custom-environment-variables.yaml
→ Maps environment variables dynamically.config/services/
→ Contains configurations for microservices and third-party services.
# Run ESLint to check code style
$ npm run lint
# Fix linting errors automatically
$ npm run lint --fix
# Run Prettier to format code
$ npm run format
The project uses Jest for testing and mongodb-memory-server for an in-memory database.
nestjs-base/
│── src/
│ ├── modules/ # Feature modules
│ ├── shared/ # Shared utilities/helpers
│ ├── main.ts # Entry point
│── config/
│ ├── services/ # Microservices & third-party service configurations
│ ├── custom-environment-variables.yaml # Env mapping
│ ├── default.yaml # Default environment settings
│── package.json # Project dependencies & scripts
│── README.md # Project documentation
toantv
Contact: tatoanhn02@gmail.com
GitHub: tatoanhn02