NestJS Playbook

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

An Introduction to NestJS

Workspace

monorepo mode

Prerequisites

Install Global Packages

yarn global remove @nestjs/cli
yarn global 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
yarn workspace @yeti/api add @nestjs/{common,core,microservices,swagger,websockets,typeorm,passport,elasticsearch}

# fastify-* are optional. use only if you want to replace express with fastify
yarn workspace @yeti/api add fastify fastify-formbody fastify-swagger

yarn workspace @yeti/api add -D @nestjs/testing
yarn workspace @yeti/api add -D @nestjs/schematics

check versions

Dependencies

adding 3rd party modules/libs

Plugins

Generate Artifacts

Ref

Last updated

Was this helpful?