nestjs

SKILL.md

NestJS

NestJS is a structured, opinionated framework for Node.js, heavily inspired by Angular. NestJS 10 (2025) focuses on performance with SWC integration and refined standalone modules.

When to Use

  • Enterprise Monorepos: Strict architecture (Controllers, Services, Modules) scales well.
  • TypeScript First: Best-in-class TS support and decorators.
  • Microservices: Built-in support for gRPC, MQTT, Redis transport layers.

Quick Start

// cats.controller.ts
@Controller("cats")
export class CatsController {
  constructor(private catsService: CatsService) {}

  @Get()
  async findAll(): Promise<Cat[]> {
    return this.catsService.findAll();
  }
}

Core Concepts

Modules

Logic is organized into Modules (UserModule, AuthModule). Dependency Injection wires them together.

Decorators

@Controller, @Get, @Injectable. Declarative metadata programming.

Guards & Interceptors

A refined pipeline for Authentication (@UseGuards) and Response transformation (@UseInterceptors).

Best Practices (2025)

Do:

  • Use SWC: Speed up builds significantly by using the SWC compiler.
  • Use Fastify adapter: Switch from Express to Fastify for 2x performance gains if compatibility allows.
  • Use zod or class-validator: Validate all inputs using DTOs.

Don't:

  • Don't allow circular dependencies: They are a pain in NestJS. Design your modules as acyclic graphs.

References

Weekly Installs
2
GitHub Stars
7
First Seen
Feb 10, 2026
Installed on
trae2
gemini-cli2
antigravity2
claude-code2
github-copilot2
codex2