A starter template for NestJS applications with Monorepos supported
Nest framework TypeScript starter repository.
This template supports Fastify Adaptor by default.
Check out a few resources that may come in handy when working with NestJS:
- Visit the NestJS Documentation to learn more about the framework.
- Visit the NestJS - Workspaces - Monorepo mode to learn more about the supported monorepo mode by NestJS.
- ExceptionsModule: offers global exception handling for HTTP and GraphQL contexts in a NestJS application. It allows for customization to execute additional operations before and after exception transformations. Here’s a quick guide on how to use and tailor the module to your needs.
- GlobalApplication: a utility that simplifies the bootstrapping of a NestJS application. It offers a structured approach to initializing and managing the application’s lifecycle, including handling CORS options and executing pre/post startup hooks. This class ensures the app is bootstrapped only once and provides easy access to the app instance, URL, and directory details throughout its lifecycle.
- BaseNestAppModule: a flexible, modular utility that integrates advanced logging, request tracing, and API response transformations into your NestJS application. It utilizes
nestjs-pinofor powerful logging and includes interceptors and services to improve observability, structured logging, and monitoring.
-
nestjs-form-data: a NestJS middleware for handling
multipart/form-data, which is primarily used for uploading files. -
nestjs-pino: Platform agnostic logger for NestJS based on Pino with REQUEST CONTEXT IN EVERY LOG.
{"req":{"id":"req-1","method":"POST","url":"/users/-/blog/post","query":{},"headers":{"host":"localhost:3000","content-type":"application/json","user-agent":"insomnia/8.4.5","accept":"*/*","content-length":"151"},"remoteAddress":"127.0.0.1","remotePort":61318},"context":"Mercury CMS","data":{"extras":{},"exception":{"_type":"BaseException","data":{"slug":"first-post"},"code":400,"shouldShowSuccessStatusCode":true,"message":"PostSlugExistsException","stackTrace":["Error: PostSlugExistsException","at PostRepositorySql._checkSlugExistsBeforeCreateUpdate (/Users/duysolo/DATA/Works/Repos/Mine/nodejs/estations/dist/apps/cms/main.js:2580:19)","at async PostRepositorySql.create (/Users/duysolo/DATA/Works/Repos/Mine/nodejs/estations/dist/apps/cms/main.js:2458:9)","at async CreatePostHandler.execute (/Users/duysolo/DATA/Works/Repos/Mine/nodejs/estations/dist/apps/cms/main.js:1466:21)"]},"message":"PostSlugExistsException"}}
$ npm install# development
$ npm run start cms
# watch mode
$ npm run start:dev cms
# production mode
$ npm run start:prod cms# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov# Generate new application
$ nest generate app your-app-name
# Generate new library
$ nest generate library your-library-name- Author - Justin Phan
- Facebook - Justin Phan
- Website - https://duypt.dev
Nest Monorepos is MIT licensed.