What is NestJS?
NestJS is a TypeScript-first Node.js framework for building structured, scalable server-side applications.
@Controller('path') / @Get()NestJS (or just Nest) is a framework for building efficient, scalable server-side applications with Node.js. It is written in TypeScript and embraces it fully, while still supporting plain JavaScript.
What problem does it solve?
Bare Node.js frameworks like Express are minimal: they hand you routing and little else. As an app grows, teams reinvent their own folder structure, dependency wiring, and conventions. Nest provides a ready-made architecture so every project looks familiar.
- Out-of-the-box structure with modules, controllers, and providers.
- Built-in dependency injection, inspired by Angular.
- First-class TypeScript, decorators, and testing support.
Under the hood Nest uses a robust HTTP platform (Express by default, or Fastify) but hides its details behind a consistent API.
Example
import { Controller, Get } from '@nestjs/common';
@Controller('hello')
export class HelloController {
@Get()
greet(): string {
return 'Hello from NestJS!';
}
}When to use it
- A startup builds its REST API with NestJS so every engineer follows the same module/controller/service pattern from day one.
- An enterprise team migrates from raw Express to NestJS to get built-in dependency injection and reduce boilerplate across 50+ routes.
- A developer uses NestJS to create a GraphQL gateway that aggregates several microservices under one typed schema.
More examples
Install NestJS globally
Installs the Nest CLI globally so you can scaffold new projects anywhere on your machine.
npm install -g @nestjs/cli
nest --versionCreate and run a new app
Scaffolds a full NestJS project and starts it in watch mode on port 3000.
nest new my-api
cd my-api
npm run start:devMinimal Nest application
Shows the three-line bootstrap that wires the root module into an HTTP server — the entry point of every NestJS app.
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
}
bootstrap();
Discussion