NestJS Tutorial
A complete NestJS path from beginner to pro - modules, DI, REST APIs, auth, databases, testing, and real backend projects. TypeScript included as you need it.
Curriculum
Work through each section in order. Every lesson ends with practice and key points so the idea sticks.
Getting Started
- 1What is NestJS?
Learn what NestJS is, what problems it solves, and how it helps you build organized Node.js backends.
10 min - 2NestJS vs Express (When to Choose)
Compare NestJS and Express so you can choose the right tool for small scripts, APIs, teams, and long-term apps.
10 min - 3Learn NestJS Without a Separate TypeScript Course
See how this tutorial teaches TypeScript exactly when NestJS needs it, using realistic backend examples.
11 min - 4Install Nest CLI & Create a Project
Install the Nest CLI, create your first project, run it locally, and understand the starter commands.
12 min - 5Project Structure Explained
Understand the important files and folders in a new NestJS project before you start editing.
11 min
Foundations
- 6TypeScript Basics Inside Nest (types, classes, decorators preview)
Learn the TypeScript essentials you will use constantly in NestJS: types, arrays, classes, constructors, and decorators.
15 min - 7Modules
Learn how NestJS modules organize controllers, providers, imports, and exports.
12 min - 8Controllers
Learn how controllers define HTTP routes and call services to produce responses.
12 min - 9Providers & Services
Understand providers, services, @Injectable, and where application logic belongs.
12 min - 10Dependency Injection
Learn how NestJS gives classes the dependencies they need and why that makes code easier to test and maintain.
13 min
Building APIs
- 11Routing & HTTP Methods
Build routes with @Get, @Post, @Patch, @Delete, path prefixes, and REST-style naming.
12 min - 12Params, Query & Headers
Read route parameters, query strings, and request headers in NestJS controllers.
12 min - 13Request Body & DTOs
Use @Body and DTO classes to describe request data for create and update routes.
13 min - 14Validation with class-validator
Validate DTOs with class-validator decorators and NestJS ValidationPipe.
15 min - 15Pipes
Learn how pipes transform and validate incoming request values in NestJS.
12 min - 16Status Codes & Responses
Return useful HTTP status codes, response bodies, and headers in beginner-friendly NestJS controllers.
12 min - 17Exception Filters Basics
Use built-in HTTP exceptions and understand how exception filters shape error responses.
13 min
App Basics
- 18Config & Environment Variables
Load environment variables with @nestjs/config and use ConfigService safely in your app.
14 min - 19Global Modules & Shared Modules
Understand shared modules, global modules, exports, and when to make utilities available across a NestJS app.
12 min - 20Lifecycle Events
Learn the basic NestJS lifecycle hooks used during startup, shutdown, and module initialization.
12 min - 21Debugging & Nest Dev Workflow
Use watch mode, logs, curl, debugger habits, and common troubleshooting steps while building NestJS apps.
13 min
Practice
- 22CRUD REST Pattern
Learn the common create, read, update, delete pattern used by many NestJS REST APIs.
15 min - 23Feature Modules in Practice
Organize a real feature folder with module, controller, service, DTOs, and clean imports.
13 min - 24Practical Error Patterns
Handle common beginner API error cases with clear exceptions, validation, and consistent service logic.
13 min
Putting It Together
Request Pipeline
- 26Guards
Use NestJS guards to decide whether a request can reach a route handler, with authentication and authorization examples.
12 min - 27Interceptors
Wrap request handling with interceptors for response mapping, timing, caching hooks, and cross-cutting behavior.
12 min - 28Middleware in Nest
Use Nest middleware for request preprocessing, request IDs, raw logging, and compatibility with Express-style middleware.
10 min - 29Custom Decorators
Create custom parameter and metadata decorators to make controllers expressive without hiding business logic.
11 min
Auth
- 30Auth Strategies Overview
Understand authentication and authorization choices in NestJS before implementing JWT, sessions, Passport, and role checks.
11 min - 31JWT Authentication
Implement environment-configured JWT authentication in NestJS with login, token signing, and a route guard.
15 min - 32Passport Integration
Integrate Passport strategies with NestJS for reusable local, JWT, and OAuth authentication flows.
13 min - 33Roles & Permissions
Build role and permission authorization in NestJS with metadata decorators, Reflector, and guards.
13 min
Data
- 34TypeORM with Nest
Connect NestJS to relational databases with TypeORM entities, repositories, configuration, and service patterns.
15 min - 35Prisma with Nest
Use Prisma as a type-safe database client in NestJS with a PrismaService, schema models, and clean service methods.
15 min - 36MongoDB / Mongoose with Nest
Connect NestJS to MongoDB with Mongoose schemas, models, DTOs, and service methods.
13 min - 37Migrations Mindset
Treat database schema changes as versioned, reviewed, reversible operations instead of one-off edits.
10 min - 38Relations & Nested Resources
Model relational data and nested API routes in NestJS without mixing routing concerns into persistence code.
12 min
App Features
- 39File Uploads
Handle file uploads in NestJS with Multer interceptors, validation, storage decisions, and safe response design.
12 min - 40Caching Module
Use caching in NestJS to reduce repeated work while keeping correctness, invalidation, and TTLs in mind.
11 min - 41Queues (Bull) Intro
Move slow or retryable work out of request handlers with Bull queues, processors, and background jobs.
13 min - 42Task Scheduling
Run recurring or delayed application tasks with Nest schedule decorators and safe operational patterns.
10 min
Quality
- 43Unit Testing
Test Nest services, guards, and controllers in isolation with TestingModule, mocks, and focused assertions.
14 min - 44E2E Testing
Test complete Nest HTTP flows with a real application instance, Supertest, validation, guards, and database setup.
15 min - 45OpenAPI / Swagger Docs
Generate useful OpenAPI documentation for NestJS APIs with SwaggerModule, DTO decorators, tags, and auth metadata.
13 min - 46Logging
Add useful NestJS logs with Logger, request context, error details, and production-friendly practices.
10 min
Delivery
Pro Architecture
- 49Structuring Larger Nest Apps
Learn how to organize a NestJS codebase so features, modules, providers, and shared utilities stay understandable as the app grows.
18 min - 50Clean Architecture Patterns in Nest
Apply clean architecture ideas in NestJS with use cases, ports, adapters, and dependency injection tokens.
19 min - 51CQRS Intro
Understand commands, queries, handlers, events, and when the NestJS CQRS module is worth using.
16 min - 52Event-driven Patterns
Use events inside NestJS apps and understand the difference between local events, domain events, integration events, and reliable delivery.
18 min
Distributed Nest
- 53Microservices Intro
Learn the NestJS microservices model, transports, message patterns, clients, contracts, and deployment tradeoffs.
19 min - 54Hybrid HTTP + Microservice Apps
Run HTTP routes and microservice listeners in one NestJS process while keeping lifecycle, health, and boundaries clear.
16 min - 55WebSockets / Gateways
Build realtime features with NestJS gateways, Socket.IO events, rooms, authentication, and scaling considerations.
18 min - 56GraphQL with Nest (Intro)
Learn the NestJS GraphQL basics: code-first schemas, resolvers, object types, inputs, auth, and avoiding N+1 queries.
17 min
Production
- 57Performance & Scalability Mindset
Build a practical performance mindset for NestJS apps: measure first, optimize bottlenecks, and scale safely.
17 min - 58Nest Security Essentials
Harden a NestJS app with validation, authentication, authorization, secure headers, rate limits, password handling, and secret management.
18 min - 59Dockerizing NestJS
Package a NestJS application for production with a multi-stage Dockerfile, .dockerignore, environment variables, and Docker Compose.
16 min - 60Health Checks, Metrics & Tracing Mindset
Understand production observability for NestJS: health checks, structured logs, metrics, traces, dashboards, and alerts.
18 min
Capstone Projects
- 61Mini Project: Production-style REST API
Build a small but production-minded Tasks REST API with modules, DTOs, validation, service boundaries, and a clear folder structure.
20 min - 62Mini Project: Auth Module (JWT + roles)
Build a focused NestJS auth module with password hashing, JWT login, current user decorators, and role-based guards.
20 min - 63Mini Project: Realtime Notifications Shell
Build a realtime notifications foundation with an HTTP endpoint, a service, a WebSocket gateway, rooms, and a simple browser client.
20 min
Polish & Next Steps
- 64Common NestJS Mistakes (and Fixes)
Review common mistakes in advanced NestJS applications and learn practical fixes that improve maintainability and production safety.
15 min - 65Ecosystem & What to Learn After NestJS
Plan your next learning path after advanced NestJS: databases, testing, queues, GraphQL, DevOps, observability, and system design.
14 min