Skip to content

NestJS template using MSSQL, Docker, Pino.js, Renovate, CommitLint, etc

License

Notifications You must be signed in to change notification settings

UK-Export-Finance/nestjs-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

NestJS framework TypeScript starter repository.

Features

  • MSSQL TypeORM setup
  • Dockerised application using NodeJS v19
  • Conventional commits using Husky
  • Code formatting (using Prettier)
  • Code linting (using ESLint and Lint-staged)
  • Code spell checking (using cspell)
  • Renovate (update NPM packages automatically)
  • Standardized Editor config
  • Swagger based documentation
  • Config based on ENV variables
  • Automated API versioning (/v1)
  • Configuration for Jest tests
  • Automated releases based on conventional commits
  • Automated version bumps based on commit messages
  • Add logging using Pino.js
  • Alias paths
  • CodeCov to analyse the test coverage
  • Add rate-limiting
  • Add Auth guards
  • Configure Compodoc
  • Add health checks
  • Add hot reloading for local Docker development
  • Add security headers
  • Deployment pipelines

Installation

npm install

Running the service (dev)

# start the local SQL database
$ docker compose -f docker-compose.db.yml up --build
# using docker-compose
$ docker compose up --build
# without docker-compose
$ npm run start:dev

Test

# unit tests
$ npm run test

# api tests
$ npm run api-test

Generating new resources

To simplify the generation of new resources, you can use the boilerplate CRUD

nest g resource users

Writing logs using PinoJS

# error
this.logger.error({ id: 'your message here' }, 'context-name');

# log
this.logger.log({ id: 'your message here' }, 'context-name');

Writing Conventional Commits

The most important prefixes you should have in mind are:

  1. fix: which represents bug fixes, and correlates to a SemVer patch.
  2. feat: which represents a new feature, and correlates to a SemVer minor.
  3. feat!:, fix!: or refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.

About

NestJS template using MSSQL, Docker, Pino.js, Renovate, CommitLint, etc

Resources

License

Stars

Watchers

Forks