07/04/2026
2 min
Nest (NestJS) is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with and fully supports TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
1@Controller('users')
2export class UsersController {
3 @Get()
4 findAll() {
5 return [{ id: 1, name: 'John' }];
6 }
7}Providers are a core concept in Nest. Many of the basic Nest classes, such as services, repositories, factories, and helpers, can be treated as providers. The key idea behind a provider is that it can be injected as a dependency, allowing objects to form various relationships with each other. The responsibility of "wiring up" these objects is largely handled by the Nest runtime system.
1import { Injectable } from '@nestjs/common';
2import { Cat } from './interfaces/cat.interface';
3
4@Injectable()
5export class CatsService {
6 private readonly cats: Cat[] = [];
7
8 create(cat: Cat) {
9 this.cats.push(cat);
10 }
11
12 findAll(): Cat[] {
13 return this.cats;
14 }
15}Every Nest application has at least one module, the root module, which serves as the starting point for Nest to build the application graph. This graph is an internal structure that Nest uses to resolve relationships and dependencies between modules and providers. Modules are highly recommended as an effective way to organize your components.
1import { Module } from '@nestjs/common';
2import { CatsController } from './cats.controller';
3import { CatsService } from './cats.service';
4
5@Module({
6 controllers: [CatsController],
7 providers: [CatsService],
8})
9export class CatsModule {}