NestJS is a structured, TypeScript-first Node.js framework created by Kamil Myśliwiec and maintained by an active open-source community. It's the #19 most-used web framework, reported in roughly 6.7% of developer surveys. Its architecture is heavily inspired by Angular — built-in dependency injection, decorators, and a module system — sitting on top of Express or Fastify under the hood, which makes it a popular choice for teams building large, maintainable backend codebases that need more structure than a minimal framework provides.
A NestJS controller class uses decorators like `@Controller` and `@Get` to declare routes, and constructor-based dependency injection to receive services.
// cats.controller.ts
import { Controller, Get, Param, Post, Body } from '@nestjs/common';
import { CatsService } from './cats.service';
@Controller('cats')
export class CatsController {
constructor(private readonly catsService: CatsService) {}
@Get(':id')
findOne(@Param('id') id: string) {
return this.catsService.findOne(+id);
}
@Post()
create(@Body() dto: { name: string }) {
return this.catsService.create(dto);
}
}
Scaffold a new project with the official Nest CLI, which sets up the module/controller/service boilerplate for you.
# install the CLI and create a new project
npm i -g @nestjs/cli
nest new my-app
cd my-app
npm run start:dev