NestJS: the Node.js framework inspired by Angular

NestJS 1.0 (May 2017) by Kamil Myśliwiec: TypeScript-first Node.js framework with decorators, DI, modules inspired by Angular and Spring. Based on Express or Fastify. Standard for TypeScript enterprise APIs.

Open SourceWeb NestJSNode.jsTypeScriptKamil MyśliwiecOpen SourceWebBackend

Express not enough for large projects

Express (2010) is minimal; freedom becomes a burden in enterprise TypeScript codebases of tens of thousands of lines. An opinionated structure is needed with:

  • Modules
  • Dependency injection
  • Decorators for routing/middleware
  • Controller/service/repository separation

The pattern is familiar to those coming from Angular (frontend) or Spring Boot (Java).

The release

NestJS was born in February 2017 from Kamil Myśliwiec (Polish developer) as a reaction to the lack of a structured Angular/Spring-style Node framework; the first publicly tagged release is v4.4.0 on 23 November 2017. MIT licence. TypeScript-first, built on Express (default) or Fastify (option). Full-stack with modules for 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);
  }
}

Features

  • Decorator-based@Controller, @Get, @Injectable, @Module, @Param
  • DI container — inversion of control like Angular/Spring
  • Modular — reusable modules with @Module({ imports, providers, controllers })
  • Pipes — input validation and transformation (class-validator)
  • Guards — authorisation (JWT, roles)
  • Interceptors — logging, cache, response mapping
  • Exception filters — centralised error handling
  • Middleware — Express-compatible
  • CLI nest generate module users — scaffolding

Integrated modules

  • @nestjs/typeorm / @nestjs/sequelize / @nestjs/mongoose / @nestjs/prisma — ORMs
  • @nestjs/graphql — code-first GraphQL
  • @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

Use cases

  • Enterprise REST/GraphQL APIs
  • Microservices with message broker
  • BFF (Backend for Frontend)
  • Real-time servers with WebSocket
  • GraphQL gateways

In the Italian context

NestJS is entering Italian TypeScript-first teams: fintech startups, enterprise agencies migrating from Java/PHP to Node TS, B2B SaaS and first digital-PA projects.


References: NestJS (started February 2017, first tagged release v4.4.0 on 23 November 2017). Kamil Myśliwiec. MIT licence. Inspired by Angular and Spring. Based on Express or Fastify. @nestjs/ ecosystem for GraphQL, Microservices, WebSocket, Swagger.*

Need support? Under attack? Service Status
Need support? Under attack? Service Status