Server Development / NestJS
Fundamentals
What NestJS is, and how modules, controllers, and providers fit together.
What is NestJS
NestJS is a TypeScript framework that gives a Node.js server a fixed architecture: modules, controllers, and providers, wired together by dependency injection. This overview shows what it adds on top of Express or Fastify, how a project starts, and when the structure is worth it.
Modules in NestJS
A NestJS module is the unit that decides which classes exist, which ones other parts of the app may use, and what it depends on. This chapter covers the root and feature modules, exports and imports, shared and re-exported modules, and the narrow case for global modules.
Controllers in NestJS
Controllers map HTTP routes to methods and turn their return values into responses. This chapter covers route decorators, reading parameters, query strings and bodies into DTOs, status codes and headers, and the escape hatch to the underlying Express response.
Providers and dependency injection in NestJS
Providers hold the work of a Nest application, and the injector decides when to create them and who receives them. This chapter shows how the injector resolves a dependency by token, the four kinds of custom provider, injection scopes, and how to break a circular dependency.