NestJS Playbook

creating NestJS project and generate nest artifacts with-in monorepo.

An Introduction to NestJS

Workspace

monorepo mode

Prerequisites

Install Global Packages

npm -g remove @nestjs/cli
npm -g add @nestjs/cli

Scaffold Project

adding code dependencies

# generate Yeti API app
# `nest generate app yeti-api`
ng g @nrwl/nest:app yeti-api --frontend-project=yeti-app --linter=eslint --tags="domain:yeti,type:api,platform:node"
# generate `config` lib
ng g @nrwl/nest:lib config  --global=true --directory=nestjs \
--controller=false --service=true --publishable=true \
--target=es2020 --tags="domain:yeti,type:api,platform:node" --dry-run # use prefix @yeti

# Add nestjs
npm i @nestjs/{common,core,microservices,swagger,websockets,typeorm,passport,elasticsearch} --workspace=apps/api

# fastify-* are optional. use only if you want to replace express with fastify
npm i fastify fastify-formbody fastify-swagger --workspace=apps/api

npm i -D @nestjs/testing @nestjs/schematics --workspace=apps/api

check versions

Dependencies

adding 3rd party modules/libs

Plugins

Generate Artifacts

Ref

Last updated

Was this helpful?