Sikau

NestJS · Day 14 · about 20 min

The Nest toolbox

Middleware, interceptors, Swagger, the CLI and beyond.

What else is in the box

You've used the core: modules, controllers, providers, pipes, guards and exceptions. Here's the rest of the toolbox professional Nest teams reach for, so you recognise it in real codebases.

The request lifecycle and friends

  • Middleware (Express-style) → logging, cookies, raw request tweaks.
  • Guards → may this request proceed?
  • Interceptors (before) → timing, caching, transforming the request.
  • Pipes → validate and transform parameters.
  • Handler → your controller method.
  • Interceptors (after) → wrap or reshape the response (e.g. { data: … }).
  • Exception filters → turn errors into responses.
  • CLI: nest g resource orders scaffolds a module, controller, service, DTOs and tests.
  • @nestjs/swagger: decorate DTOs and get interactive API docs at /api.
  • @nestjs/config, @nestjs/jwt + passport, @nestjs/throttler (rate limiting), @nestjs/schedule (cron jobs).
  • Microservices and WebSockets gateways use the same modules and DI.
  • CQRS and event-driven patterns for very large domains.

The rest of this lesson

  • Growing a Nest codebaseexplain
  • Interceptors in practiceexplain
  • Choosing the right hookexplain
  • Where does it belong?predict
  • The request lifecycleorder
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 15 lessons of NestJS