NestJS: il framework Node.js ispirato ad Angular

NestJS 1.0 (maggio 2017) di Kamil Myśliwiec: framework Node.js TypeScript-first con decoratori, DI, moduli ispirato ad Angular e Spring. Basato su Express o Fastify. Standard per API enterprise TypeScript.

Open SourceWeb NestJSNode.jsTypeScriptKamil MyśliwiecOpen SourceWebBackend

Express non basta per progetti grandi

Express (2010) è minimale; la libertà diventa peso in codebase TypeScript enterprise di decine di migliaia di righe. Serve una struttura opinata con:

  • Moduli
  • Dependency injection
  • Decoratori per routing/middleware
  • Separazione controller/service/repository

Il pattern è familiare a chi viene da Angular (frontend) o Spring Boot (Java).

Il rilascio

NestJS nasce a febbraio 2017 da Kamil Myśliwiec (sviluppatore polacco) come reazione alla mancanza di un framework Node strutturato stile Angular/Spring; la prima release taggata pubblicamente è la v4.4.0 del 23 novembre 2017. Licenza MIT. TypeScript-first, costruito su Express (default) o Fastify (opzione). Full-stack con moduli per WebSocket, GraphQL, Microservices, Event-driven.

@Controller('users')
export class UsersController {
  constructor(private readonly usersService: UsersService) {}

  @Get(':id')
  async findOne(@Param('id') id: string) {
    return this.usersService.findOne(id);
  }
}

Caratteristiche

  • Decorator-based@Controller, @Get, @Injectable, @Module, @Param
  • DI container — inversion of control come Angular/Spring
  • Modular — moduli riusabili con @Module({ imports, providers, controllers })
  • Pipes — validazione e trasformazione input (class-validator)
  • Guards — autorizzazione (JWT, roles)
  • Interceptors — logging, cache, response mapping
  • Exception filters — error handling centralizzato
  • Middleware — Express-compatible
  • CLI nest generate module users — scaffolding

Moduli integrati

  • @nestjs/typeorm / @nestjs/sequelize / @nestjs/mongoose / @nestjs/prisma — ORM
  • @nestjs/graphql — GraphQL code-first
  • @nestjs/microservices — Redis, NATS, Kafka, gRPC, RabbitMQ
  • @nestjs/websockets — Socket.IO, ws
  • @nestjs/bull — job queues
  • @nestjs/swagger — OpenAPI generation
  • @nestjs/passport — 500+ auth strategies
  • @nestjs/jwt — JSON Web Tokens
  • @nestjs/schedule — cron jobs

Casi d’uso

  • API REST/GraphQL enterprise
  • Micro-servizi con message broker
  • BFF (Backend for Frontend)
  • Real-time server con WebSocket
  • GraphQL gateway

Nel contesto italiano

NestJS sta entrando nei team TypeScript-first italiani: startup fintech, agenzie enterprise che migrano da Java/PHP a Node TS, SaaS B2B, primi progetti di PA digitale.


Riferimenti: NestJS (avvio febbraio 2017, prima release taggata v4.4.0 del 23 novembre 2017). Kamil Myśliwiec. Licenza MIT. Ispirato ad Angular e Spring. Basato su Express o Fastify. Ecosistema @nestjs/ per GraphQL, Microservices, WebSocket, Swagger.*

Vuoi supporto? Sei sotto attacco? Stato dei servizi
Vuoi supporto? Sei sotto attacco? Stato dei servizi