What NestJS is
NestJS is a framework for server applications on Node.js and TypeScript. It gives the project a strict structure: code is split into modules, controllers and services, and the framework wires them together. This course is written for NestJS 11.
NestJS and Express
Express is a small library: it accepts HTTP requests and calls your functions, but it does not tell you how to lay out code in files. In a large project every team invents its own structure.
NestJS runs on top of Express (in version 11, on top of Express 5). Express still accepts the requests, while NestJS adds rules for organizing code and ready-made solutions for common tasks.
| Express | NestJS | |
|---|---|---|
| Language | JavaScript or TypeScript | TypeScript |
| Project structure | Anything | Modules, controllers, services |
| Routes | app.get('/posts', ...) | Class methods with the @Get() decorator |
| Data validation | Separate libraries | Built-in pipes |
| Connecting parts | Manual import and passing objects | Dependency injection |
You can plug in Fastify instead of Express, but this course uses Express — it is the default.
What the code looks like
A request handler in NestJS is a class method:
// src/posts/posts.controller.ts
import { Controller, Get } from '@nestjs/common';
@Controller('posts')
export class PostsController {
@Get()
findAll() {
return [{ id: 1, title: 'First post' }];
}
}A GET /posts request calls findAll(), and NestJS turns the returned array into JSON. The lines starting with @ are decorators; they are explained in the lesson about creating a project.
What you need
- Node.js 20 or newer (22 is better) and npm.
- JavaScript knowledge: classes, modules,
async/await. - TypeScript basics: types of parameters and properties. The course code uses no complex types.
Check the versions in the terminal:
node -v
npm -vWhat we will build
One example runs through the whole course — a blog API. It is a server without HTML pages: it receives and returns JSON. It will have posts, comments and users, token login, roles, image uploads, documentation and tests.
Common mistake
NestJS does not replace knowing Node.js and Express. When something goes wrong, plain Express request and response objects are working under the decorators. If you do not know what middleware or a 404 status code is, go through the Node.js and Express basics first — then NestJS errors will make sense.