### Install TypeScript Starter Project with Git Source: https://docs.nestjs.com/recipes/recipes/async-local-storage Clone the TypeScript starter project repository, navigate into the directory, install dependencies, and start the application. This provides an alternative to the CLI for project setup. ```bash $ git clone https://github.com/nestjs/typescript-starter.git project $ cd project $ npm install $ npm run start ``` -------------------------------- ### Install JavaScript Starter Project via Git Source: https://docs.nestjs.com/recipes/guards Clone the official JavaScript starter project, navigate into the directory, install dependencies, and start the application. ```bash $ git clone https://github.com/nestjs/javascript-starter.git project $ cd project $ npm install $ npm run start ``` -------------------------------- ### Install ioredis for Redis microservices Source: https://docs.nestjs.com/microservices/redis Install the required ioredis package to start building Redis-based microservices. ```bash $ npm i --save ioredis ``` -------------------------------- ### Install NestJS JavaScript Starter Project via Git Source: https://docs.nestjs.com/ Clone the JavaScript starter project from GitHub, install dependencies, and start the application. This is an alternative for JavaScript-only projects. ```bash $ git clone https://github.com/nestjs/javascript-starter.git project $ cd project $ npm install $ npm run start ``` -------------------------------- ### Clone and Run NestJS TypeScript Starter Project Source: https://docs.nestjs.com/cli/cli/monorepo Clone the official TypeScript starter project, navigate into its directory, install dependencies, and start the application. ```bash $ git clone https://github.com/nestjs/typescript-starter.git project $ cd project $ npm install $ npm run start ``` -------------------------------- ### Install Fastify compression package Source: https://docs.nestjs.com/techniques/compression Install the `@fastify/compress` package for use with the Fastify adapter. ```bash $ npm i --save @fastify/compress ``` -------------------------------- ### Install graphql-query-complexity Source: https://docs.nestjs.com/graphql/complexity Installs the `graphql-query-complexity` library, which provides cost analysis for GraphQL queries. ```bash $ npm install --save graphql-query-complexity ``` -------------------------------- ### Install MQTT package Source: https://docs.nestjs.com/microservices/mqtt Install the mqtt package required for MQTT-based microservices. ```bash $ npm i --save mqtt ``` -------------------------------- ### Example GET Request for Array Query Parameters Source: https://docs.nestjs.com/techniques/validation An example HTTP GET request demonstrating how to pass an array of IDs as a comma-separated string in query parameters. ```http GET /?ids=1,2,3 ``` -------------------------------- ### Run NestJS Start Command via npm Script Source: https://docs.nestjs.com/cli/scripts Executes the `nest start` command using the locally installed Nest CLI binary, ensuring consistent versions across development environments. ```bash $ npm run start ``` -------------------------------- ### Install Sequelize and dependencies Source: https://docs.nestjs.com/recipes/sql-sequelize Install the core Sequelize package, the TypeScript wrapper, and the MySQL driver. ```bash $ npm install --save sequelize sequelize-typescript mysql2 $ npm install --save-dev @types/sequelize ``` -------------------------------- ### Sample GET Request with Query Parameters Source: https://docs.nestjs.com/controllers An example HTTP GET request URL demonstrating how query parameters are structured and passed to a NestJS endpoint. ```HTTP GET /cats?age=2&breed=Persian ``` -------------------------------- ### Starting NestJS Applications in a Monorepo Source: https://docs.nestjs.com/cli/monorepo These commands demonstrate how to start applications within a NestJS monorepo using the 'nest start' command, either for the default project or a specifically named application. ```bash $ nest start ``` ```bash $ nest start my-app ``` -------------------------------- ### Install Prisma Client Source: https://docs.nestjs.com/recipes/prisma Installs the Prisma Client package, which is a type-safe database client generated from the Prisma schema. ```bash $ npm install @prisma/client ``` -------------------------------- ### Install Ws Platform Adapter Source: https://docs.nestjs.com/websockets/adapter Install the `@nestjs/platform-ws` package to use the `ws` library as a WebSocket adapter. ```bash $ npm i --save @nestjs/platform-ws ``` -------------------------------- ### Install RabbitMQ Packages Source: https://docs.nestjs.com/microservices/rabbitmq Install the required `amqplib` and `amqp-connection-manager` packages to enable RabbitMQ-based microservices in NestJS. ```bash $ npm i --save amqplib amqp-connection-manager ``` -------------------------------- ### Install PostgreSQL Prisma Driver Adapter Source: https://docs.nestjs.com/recipes/prisma Installs the Prisma driver adapter for PostgreSQL databases. ```bash npm install @prisma/adapter-pg ``` -------------------------------- ### Install gRPC Packages Source: https://docs.nestjs.com/microservices/grpc Installs the necessary `@grpc/grpc-js` and `@grpc/proto-loader` packages for building gRPC-based microservices in NestJS. ```bash $ npm i --save @grpc/grpc-js @grpc/proto-loader ``` -------------------------------- ### Install Fastify Helmet Source: https://docs.nestjs.com/security/helmet Installs the `@fastify/helmet` package, required when using the `FastifyAdapter` with NestJS. ```bash $ npm i --save @fastify/helmet ``` -------------------------------- ### Install Jest and SWC for Development Source: https://docs.nestjs.com/recipes/swc Install `jest`, `@swc/core`, and `@swc/jest` as development dependencies to enable Jest testing with SWC. ```bash $ npm i --save-dev jest @swc/core @swc/jest ``` -------------------------------- ### Install Redis and Socket.IO Adapter Source: https://docs.nestjs.com/websockets/adapter Install the necessary packages for integrating Redis with Socket.IO to enable broadcasting across multiple instances. ```bash $ npm i --save redis socket.io @socket.io/redis-adapter ``` -------------------------------- ### Install gRPC Reflection Library Source: https://docs.nestjs.com/microservices/grpc Command to install the `@grpc/reflection` package, enabling gRPC server reflection capabilities for API introspection. ```bash $ npm i --save @grpc/reflection ``` -------------------------------- ### Install Necord and Discord.js Source: https://docs.nestjs.com/recipes/necord Installs the Necord module and its Discord.js dependency using npm. ```bash $ npm install necord discord.js ``` -------------------------------- ### Install Apollo Gateway Dependency Source: https://docs.nestjs.com/graphql/federation Install the necessary npm package for setting up an Apollo Gateway. ```bash $ npm install --save @apollo/gateway ``` -------------------------------- ### Install Prisma CLI as a development dependency (npm) Source: https://docs.nestjs.com/recipes/prisma Navigate into the project directory and install the Prisma CLI package using npm. ```bash $ cd hello-prisma $ npm install prisma --save-dev ``` -------------------------------- ### Start NestJS with SWC Builder Source: https://docs.nestjs.com/recipes/swc Run your NestJS application using the SWC builder via the Nest CLI `start` command. ```bash $ nest start -b swc # OR nest start --builder swc ``` -------------------------------- ### Install ServeStaticModule Package Source: https://docs.nestjs.com/recipes/serve-static Install the @nestjs/serve-static package required for serving static content in NestJS applications. ```bash $ npm install --save @nestjs/serve-static ``` -------------------------------- ### Install KafkaJS package Source: https://docs.nestjs.com/microservices/kafka Install the `kafkajs` npm package to enable Kafka-based microservices in NestJS. ```bash $ npm i --save kafkajs ``` -------------------------------- ### Install bcrypt and its TypeScript types Source: https://docs.nestjs.com/security/encryption-and-hashing Install the `bcrypt` package for hashing and its corresponding `@types/bcrypt` for TypeScript development. ```bash $ npm i bcrypt $ npm i -D @types/bcrypt ``` -------------------------------- ### Install TypeORM and MySQL dependencies Source: https://docs.nestjs.com/recipes/sql-typeorm Install the core TypeORM package and the MySQL driver required for database connectivity. ```bash $ npm install --save typeorm mysql2 ``` -------------------------------- ### Install SWC CLI and Core Packages Source: https://docs.nestjs.com/recipes/swc Install the necessary development dependencies for SWC to enable its use with Nest CLI. ```bash $ npm i --save-dev @swc/cli @swc/core ``` -------------------------------- ### Install Fastify Platform Package Source: https://docs.nestjs.com/techniques/performance Installs the necessary `@nestjs/platform-fastify` package, which provides the Fastify adapter for NestJS applications. ```bash $ npm i --save @nestjs/platform-fastify ``` -------------------------------- ### Install compression package for Express Source: https://docs.nestjs.com/techniques/compression Install the `compression` middleware and its TypeScript types for use with the Express adapter. ```bash $ npm i --save compression $ npm i --save-dev @types/compression ``` -------------------------------- ### Install Keyv Redis Package Source: https://docs.nestjs.com/techniques/caching Installs the @keyv/redis package, required for using Redis as a cache store with NestJS CacheModule. ```bash $ npm install @keyv/redis ``` -------------------------------- ### Install Joi Package Source: https://docs.nestjs.com/techniques/configuration Install the Joi package to enable schema validation for environment variables in NestJS applications. ```bash $ npm install --save joi ``` -------------------------------- ### Install Vitest and SWC dependencies Source: https://docs.nestjs.com/recipes/swc Install the necessary development dependencies for integrating Vitest with SWC in a NestJS project. ```bash $ npm i --save-dev vitest unplugin-swc @swc/core @vitest/coverage-v8 ``` -------------------------------- ### Install Prisma CLI as a development dependency (Yarn) Source: https://docs.nestjs.com/recipes/prisma Install the Prisma CLI package using Yarn for projects that use Yarn. ```bash $ yarn add prisma --dev ``` -------------------------------- ### Initialize Prisma setup Source: https://docs.nestjs.com/recipes/prisma Run the Prisma init command to create the initial Prisma directory and configuration files. ```bash $ npx prisma init ``` -------------------------------- ### GET / (Admin Subdomain) Source: https://docs.nestjs.com/controllers This endpoint handles GET requests to the root path of the 'admin.example.com' subdomain, returning a simple string. ```APIDOC ## GET / ### Description This endpoint handles GET requests to the root path of the `admin.example.com` subdomain. ### Method GET ### Endpoint admin.example.com/ ### Response #### Success Response (200) - **body** (string) - Returns "Admin page". #### Response Example "Admin page" ``` -------------------------------- ### Install swc-loader for Monorepos Source: https://docs.nestjs.com/recipes/swc Install `swc-loader` as a development dependency when configuring Webpack for SWC in a monorepo setup. ```bash $ npm i --save-dev swc-loader ``` -------------------------------- ### Example .env File Content Source: https://docs.nestjs.com/techniques/configuration A sample .env file demonstrating key-value pairs for environment variables, such as database credentials. ```ini DATABASE_USER=test DATABASE_PASSWORD=test ``` -------------------------------- ### Example YAML configuration file Source: https://docs.nestjs.com/techniques/configuration An example of a YAML file structure for application configuration, demonstrating nested properties for different services like HTTP and database. ```yaml http: host: 'localhost' port: 8080 db: postgres: url: 'localhost' port: 5432 database: 'yaml-db' sqlite: database: 'sqlite.db' ``` -------------------------------- ### Create and Run a New Nest Project Source: https://docs.nestjs.com/cli/overview Initializes a new Nest project, navigates into its directory, and starts the application in development mode. ```bash $ nest new my-nest-project $ cd my-nest-project $ npm run start:dev ``` -------------------------------- ### Install Nest CLI and Create New Project Source: https://docs.nestjs.com/cli/cli/monorepo Use these commands to globally install the Nest CLI and then scaffold a new NestJS project with a conventional base structure. ```bash $ npm i -g @nestjs/cli $ nest new project-name ``` -------------------------------- ### Install webpack and HMR dependencies with npm Source: https://docs.nestjs.com/recipes/hot-reload Required packages for webpack HMR setup with Nest CLI. Use webpack-pnp-externals instead if using Yarn Berry. ```bash $ npm i --save-dev webpack-node-externals run-script-webpack-plugin webpack ``` -------------------------------- ### Lazily Load Cache Module in NestJS Source: https://docs.nestjs.com/faq/serverless Use this snippet to conditionally load a CacheModule and its CacheService only when a GET request is made, reducing cold start times for other invocations. ```typescript if (request.method === RequestMethod[RequestMethod.GET]) { const { CacheModule } = await import('./cache.module'); const moduleRef = await this.lazyModuleLoader.load(() => CacheModule); const { CacheService } = await import('./cache.service'); const cacheService = moduleRef.get(CacheService); return cacheService.get(ENDPOINT_KEY); } ``` -------------------------------- ### Install webpack dependencies for manual setup Source: https://docs.nestjs.com/recipes/hot-reload Required packages for webpack HMR configuration without Nest CLI. Use webpack-pnp-externals instead if using Yarn Berry. ```bash $ npm i --save-dev webpack webpack-cli webpack-node-externals ts-loader run-script-webpack-plugin ``` -------------------------------- ### NestJS Authors Module Configuration Source: https://docs.nestjs.com/graphql/resolvers This example demonstrates how to define an `AuthorsModule` in NestJS, importing `PostsModule` and providing `AuthorsService` and `AuthorsResolver`. This setup allows the `GraphQLModule` to discover and use the resolvers. ```TypeScript @Module({ imports: [PostsModule], providers: [AuthorsService, AuthorsResolver], }) export class AuthorsModule {} ``` -------------------------------- ### Generate TypeScript Enum from GraphQL Schema Source: https://docs.nestjs.com/graphql/unions-and-enums Generate a corresponding TypeScript enum definition from your GraphQL schema using the typings generation feature, as shown in the quick start guide. ```typescript export enum AllowedColor { RED GREEN BLUE } ``` -------------------------------- ### Define HelloService with Protocol Buffers Source: https://docs.nestjs.com/microservices/grpc This `.proto` file defines the `HelloService` with two streaming methods: `BidiHello` for bidirectional streaming and `LotsOfGreetings` for client-side streaming, along with their request and response message types. ```protobuf // hello/hello.proto syntax = "proto3"; package hello; service HelloService { rpc BidiHello(stream HelloRequest) returns (stream HelloResponse); rpc LotsOfGreetings(stream HelloRequest) returns (HelloResponse); } message HelloRequest { string greeting = 1; } message HelloResponse { string reply = 1; } ``` -------------------------------- ### Enabling Type Checking for SWC Builder (Bash) Source: https://docs.nestjs.com/graphql/cli-plugin This command demonstrates how to enable type checking when using the SWC builder with nest start for standard setups, which is required for CLI plugins. ```Bash nest start -b swc --type-check ``` -------------------------------- ### E2E Test Setup with Supertest and Express Source: https://docs.nestjs.com/fundamentals/testing Complete e2e test example using Supertest to simulate HTTP requests against a NestJS application. Mocks the CatsService and tests the /GET cats endpoint with expected status and response validation. ```TypeScript import * as request from 'supertest'; import { Test } from '@nestjs/testing'; import { CatsModule } from '../../src/cats/cats.module'; import { CatsService } from '../../src/cats/cats.service'; import { INestApplication } from '@nestjs/common'; describe('Cats', () => { let app: INestApplication; let catsService = { findAll: () => ['test'] }; beforeAll(async () => { const moduleRef = await Test.createTestingModule({ imports: [CatsModule], }) .overrideProvider(CatsService) .useValue(catsService) .compile(); app = moduleRef.createNestApplication(); await app.init(); }); it(`/GET cats`, () => { return request(app.getHttpServer()) .get('/cats') .expect(200) .expect({ data: catsService.findAll(), }); }); afterAll(async () => { await app.close(); }); }); ``` -------------------------------- ### Set Single Property Example in NestJS Swagger Source: https://docs.nestjs.com/openapi/types-and-parameters Use the example key in @ApiProperty to document a single example value for a property. ```TypeScript @ApiProperty({ example: 'persian', }) breed: string; ``` -------------------------------- ### Set Multiple Property Examples in NestJS Swagger Source: https://docs.nestjs.com/openapi/types-and-parameters Use the examples key in @ApiProperty to provide multiple named example values for a property. ```TypeScript @ApiProperty({ examples: { Persian: { value: 'persian' }, Tabby: { value: 'tabby' }, Siamese: { value: 'siamese' }, 'Scottish Fold': { value: 'scottish_fold' }, }, }) breed: string; ``` -------------------------------- ### Inject HttpService and Perform GET Request Source: https://docs.nestjs.com/techniques/http-module Inject `HttpService` into a service and use its `get` method to make an HTTP GET request, returning an `Observable`. ```typescript @Injectable() export class CatsService { constructor(private readonly httpService: HttpService) {} findAll(): Observable> { return this.httpService.get('http://localhost:3000/cats'); } } ``` ```javascript @Injectable() @Dependencies(HttpService) export class CatsService { constructor(httpService) { this.httpService = httpService; } findAll() { return this.httpService.get('http://localhost:3000/cats'); } } ``` -------------------------------- ### Install Suites for Sinon Source: https://docs.nestjs.com/recipes/suites Install Suites core, the NestJS dependency injection adapter, and the Sinon doubles adapter for type-safe test doubles. ```bash $ npm install --save-dev @suites/unit @suites/di.nestjs @suites/doubles.sinon ``` -------------------------------- ### Configure gqlSchemaFactory.create() with Resolvers, Scalars, and Options Source: https://docs.nestjs.com/graphql/generating-sdl These examples illustrate various ways to configure the `gqlSchemaFactory.create()` method by passing different combinations of resolver classes, scalar classes, and an options object. ```typescript const schema = await gqlSchemaFactory.create([ RecipesResolver, AuthorsResolver, PostsResolver, ]); ``` ```typescript const schema = await gqlSchemaFactory.create( [RecipesResolver, AuthorsResolver, PostsResolver], [DurationScalar, DateScalar], ); ``` ```typescript const schema = await gqlSchemaFactory.create([RecipesResolver], { skipCheck: true, orphanedTypes: [], }); ``` -------------------------------- ### MQTT Microservice Setup Source: https://docs.nestjs.com/microservices/mqtt Initialize an MQTT-based microservice in NestJS using the createMicroservice() method. This establishes the connection to an MQTT broker and configures the transport layer for message-driven communication. ```APIDOC ## MQTT Microservice Initialization ### Description Creates an MQTT microservice instance that connects to an MQTT broker for publish/subscribe messaging. ### Configuration #### Transport - **transport** (enum) - Required - Set to `Transport.MQTT` #### Options - **url** (string) - Required - MQTT broker URL (e.g., 'mqtt://localhost:1883') - **subscribeOptions** (object) - Optional - Global subscription settings including QoS level ### Setup Example ```typescript const app = await NestFactory.createMicroservice(AppModule, { transport: Transport.MQTT, options: { url: 'mqtt://localhost:1883', }, }); ``` ### Installation Before using MQTT transporter, install the required package: ```bash npm i --save mqtt ``` ### Notes - `Transport` enum is imported from `@nestjs/microservices` package - MQTT is optimized for low-latency, lightweight messaging - Designed for constrained devices and unreliable networks ``` -------------------------------- ### Install Mongoose and NestJS Mongoose Package Source: https://docs.nestjs.com/techniques/mongodb Install the necessary packages for integrating Mongoose with NestJS. ```bash $ npm i @nestjs/mongoose mongoose ``` -------------------------------- ### Sample UserService with Dependencies Source: https://docs.nestjs.com/recipes/suites Illustrates a `UserService` that depends on `UserRepository` and `Logger`, showcasing constructor injection and basic business logic. ```typescript import { Injectable, NotFoundException } from '@nestjs/common'; import { Logger } from '@nestjs/common'; @Injectable() export class UserService { constructor( private repository: UserRepository, private logger: Logger, ) {} async findById(id: string): Promise { const user = await this.repository.findById(id); if (!user) { throw new NotFoundException(`User ${id} not found`); } this.logger.log(`Found user ${id}`); return user; } async create(email: string, name: string): Promise { const user = { id: generateId(), email, name }; await this.repository.save(user); this.logger.log(`Created user ${user.id}`); return user; } } ``` -------------------------------- ### Install Zod Package Source: https://docs.nestjs.com/pipes Installs the Zod library, which is used for defining schema-based validation rules. ```bash $ npm install --save zod ``` -------------------------------- ### Sample Default Text Log Entry Source: https://docs.nestjs.com/techniques/logger An example of the default text-based log output, illustrating how the `context` argument is displayed in square brackets. ```text [Nest] 19096 - 12/08/2019, 7:12:59 AM [NestFactory] Starting Nest application... ``` -------------------------------- ### Install Mercurius Federation Dependencies Source: https://docs.nestjs.com/graphql/federation Install the required npm packages for implementing Mercurius Federation. ```bash $ npm install --save @apollo/subgraph @nestjs/mercurius ``` -------------------------------- ### Initial ConfigService with Hard-coded Options Source: https://docs.nestjs.com/fundamentals/dynamic-modules Illustrates an initial `ConfigService` implementation that reads environment variables, using hard-coded options for demonstration purposes before dynamic injection is set up. ```typescript import { Injectable } from '@nestjs/common'; import * as fs from 'node:fs'; import * as path from 'node:path'; import * as dotenv from 'dotenv'; import { EnvConfig } from './interfaces'; @Injectable() export class ConfigService { private readonly envConfig: EnvConfig; constructor() { const options = { folder: './config' }; const filePath = `${process.env.NODE_ENV || 'development'}.env`; const envFile = path.resolve(__dirname, '../../', options.folder, filePath); this.envConfig = dotenv.parse(fs.readFileSync(envFile)); } get(key: string): string { return this.envConfig[key]; } } ``` -------------------------------- ### Get General Nest CLI Help Source: https://docs.nestjs.com/cli/overview Displays a list of available Nest CLI commands and their basic usage. ```bash $ nest --help ``` -------------------------------- ### Create New NestJS Project using Aliases Source: https://docs.nestjs.com/cli/overview Demonstrates using command and option aliases (`n` for `new`, `-d` for `--dry-run`) for a more concise command. ```shell $ nest n my-nest-project -d ``` -------------------------------- ### Installing CASL Ability Package Source: https://docs.nestjs.com/security/authorization Installs the `@casl/ability` package, which is required for integrating CASL into a NestJS application. ```Shell $ npm i @casl/ability ``` -------------------------------- ### Install NestJS Throttler Package Source: https://docs.nestjs.com/security/rate-limiting Installs the `@nestjs/throttler` package, which provides rate-limiting capabilities for NestJS applications. ```bash $ npm i --save @nestjs/throttler ``` -------------------------------- ### Install @nestjs/schedule package Source: https://docs.nestjs.com/techniques/task-scheduling Use npm to install the necessary dependencies for task scheduling in a NestJS application. ```bash $ npm install --save @nestjs/schedule ``` -------------------------------- ### Register ClientsModule asynchronously with ConfigService Source: https://docs.nestjs.com/microservices/basics Use registerAsync() to provide configuration dynamically or perform asynchronous setup. Requires imports, useFactory, and inject properties to resolve dependencies. ```TypeScript @Module({ imports: [ ClientsModule.registerAsync([ { imports: [ConfigModule], name: 'MATH_SERVICE', useFactory: async (configService: ConfigService) => ({ transport: Transport.TCP, options: { url: configService.get('URL'), }, }), inject: [ConfigService], }, ]), ], }) ``` -------------------------------- ### Install @fastify/cookie for Fastify Source: https://docs.nestjs.com/techniques/cookies Install the `@fastify/cookie` package for use with NestJS applications running on the Fastify platform. ```bash $ npm i @fastify/cookie ``` -------------------------------- ### Install NestJS Runtime Dependencies Source: https://docs.nestjs.com/recipes/suites Install the core NestJS runtime dependencies required for any NestJS project. ```bash $ npm install @nestjs/common @nestjs/core reflect-metadata ``` -------------------------------- ### Install Suites for Vitest Source: https://docs.nestjs.com/recipes/suites Install Suites core, the NestJS dependency injection adapter, and the Vitest doubles adapter for type-safe test doubles. ```bash $ npm install --save-dev @suites/unit @suites/di.nestjs @suites/doubles.vitest ``` -------------------------------- ### Install Fastify and dependencies Source: https://docs.nestjs.com/techniques/mvc NPM command to install Fastify static file serving, view engine support, and Handlebars template engine. ```bash $ npm i --save @fastify/static @fastify/view handlebars ``` -------------------------------- ### Create new NestJS project with nest new command Source: https://docs.nestjs.com/cli/usages Initialize a new standard-mode NestJS project with automatic folder structure, configuration files, and default components. Prompts for package manager selection. ```bash $ nest new [options] $ nest n [options] ``` -------------------------------- ### Install Helmet for Express Source: https://docs.nestjs.com/security/helmet Installs the `helmet` package, which provides security middleware for Express-based NestJS applications. ```bash $ npm i --save helmet ``` -------------------------------- ### Install Nest CLI Globally with npm Source: https://docs.nestjs.com/cli/overview Installs the Nest CLI globally using npm, making the `nest` executable available system-wide. Consider `npx` for managed versions. ```bash $ npm install -g @nestjs/cli ``` -------------------------------- ### Install Apollo Subgraph Dependency Source: https://docs.nestjs.com/graphql/federation Install the necessary `@apollo/subgraph` package for building federated services with Apollo. ```bash $ npm install --save @apollo/subgraph ``` -------------------------------- ### Install SQLite Prisma Driver Adapter Source: https://docs.nestjs.com/recipes/prisma Installs the Prisma driver adapter for SQLite databases, required for connecting Prisma Client to SQLite. ```bash npm install @prisma/adapter-better-sqlite3 ``` -------------------------------- ### Start Nest Application Source: https://docs.nestjs.com/cli/usages Compiles and runs a Nest application or the default project in a workspace. Supports various options for compilation, watching, debugging, and environment configuration. ```bash $ nest start [options] ``` -------------------------------- ### Install MikroORM NestJS Module and Driver Source: https://docs.nestjs.com/recipes/mikroorm Install the core MikroORM packages, the NestJS integration module, and a specific database driver like SQLite for your project. ```bash $ npm i @mikro-orm/core @mikro-orm/nestjs @mikro-orm/sqlite ``` -------------------------------- ### Install @nestjs/config Package Source: https://docs.nestjs.com/techniques/configuration Installs the @nestjs/config package, which provides utilities for managing environment variables in NestJS applications. ```bash $ npm i --save @nestjs/config ``` -------------------------------- ### Add Webpack Start Script to package.json Source: https://docs.nestjs.com/recipes/hot-reload Define a script to execute Webpack with the custom configuration in watch mode. ```json "start:dev": "webpack --config webpack.config.js --watch" ``` -------------------------------- ### Configure Assets with Glob Pattern Source: https://docs.nestjs.com/cli/monorepo Specifies `.graphql` files to be copied to the output directory and enables watching these assets for changes during development. ```json "assets": ["**/*.graphql"], "watchAssets": true, ``` -------------------------------- ### Install Handlebars template engine Source: https://docs.nestjs.com/techniques/mvc Install the hbs (Handlebars) package to enable template rendering in the NestJS application. ```bash $ npm install --save hbs ``` -------------------------------- ### Install class-validator and class-transformer Source: https://docs.nestjs.com/pipes Install the required packages for implementing decorator-based validation with `class-validator` and `class-transformer` in your NestJS project. ```bash $ npm i --save class-validator class-transformer ``` -------------------------------- ### Install grpc-health-check package Source: https://docs.nestjs.com/microservices/grpc Install the necessary package to add gRPC health check support to your NestJS application. ```bash npm i --save grpc-health-check ``` -------------------------------- ### Install @fastify/csrf-protection for Fastify Source: https://docs.nestjs.com/security/csrf Install the `@fastify/csrf-protection` package to enable CSRF protection in NestJS applications using Fastify. ```bash $ npm i --save @fastify/csrf-protection ```