Skip to main content
Web Development

Node.js Tutorial with Examples.

Node.js backend tutorial: the http module, npm and node --watch, Express and Fastify APIs, Zod validation, Pino logging, JWT auth and graceful shutdown.

Beginner

Start here — no prior experience needed

6 lessons

Intermediate

For developers with core concepts down

10 lessons
nodejs intermediate
5 min read

Replace console.log with Pino, attach a request id to every log line through pino-http's child logger, and read the one-line JSON it prints per request.

nodejs intermediate
5 min read

Watch an Express 4 async handler crash the whole process on an unhandled rejection, then see Express 5 forward the same throw to the error handler with no wrapper.

nodejs intermediate
5 min read

Test a real running Express server with Node's built-in test runner and fetch, no supertest dependency, including what a real assertion failure prints.

nodejs intermediate
5 min read

Rebuild the users API in Fastify with JSON Schema route validation, a hook, and automatic response serialization that strips fields the schema doesn't list.

nodejs intermediate
5 min read

Issue a signed JWT on login, verify it in Express middleware, and see the exact errors for a missing token, a malformed one, and a genuinely expired one.

nodejs intermediate
5 min read

Watch Docker SIGKILL a server mid-request with no handler, then add one that fails readiness, drains the same slow request, and exits cleanly instead.

nodejs intermediate
5 min read

An unhandled MulterError crashes into a 500; catch its codes for 413 and 400, see busboy strip a traversal filename, and fool a fileFilter with a lie.

nodejs intermediate
5 min read

Attach ws to a node:http server, broadcast to every client, reject a bad upgrade token with a 401, and terminate an unresponsive client with ping/pong.

nodejs intermediate
5 min read

Generate OpenAPI docs from Fastify route schemas with @fastify/swagger, see a schema-less route's empty entry, and watch a response schema strip a field.

nodejs intermediate
5 min read

Run PostgreSQL in Docker, connect with pg's Pool, use parameterised queries, commit or roll back a transaction, and exhaust the pool with a leaked client.

Advanced

Production-grade patterns for experienced engineers

4 lessons

Also part of Node.js

Taught in other topics. Each link opens the lesson in its home topic.

10 lessons
javascript intermediate
5 min read

Learn Node.js CLI args, env vars, fs/promises, readline, and streams, including backpressure and error propagation through stream/promises pipeline.

javascript intermediate
5 min read

Understand how JavaScript's single-threaded event loop works, why microtasks run before macrotasks, and how to reason about async execution order.

javascript intermediate
5 min read

Understand ES modules and CommonJS, their syntax differences, dynamic imports for code splitting, and how bundlers like Vite and webpack fit in.

docker beginner
5 min read

Run your first Docker containers and see what they are: ordinary Linux processes sharing the host kernel, started from an image in well under a second.

docker beginner
5 min read

Run, inspect, stop and remove containers: the lifecycle, port publishing, exec, logs, docker stop versus SIGKILL, memory limits and docker cp.

docker advanced
5 min read

Use multi-stage Dockerfiles to produce small, secure production images by separating build and runtime environments.

docker intermediate
5 min read

Define and run multi-container applications with Docker Compose. Services, networks, volumes, and environment configuration.

typescript intermediate
5 min read

Build a typed Express 5 API: tsconfig for Node, validated env config, typed routes and middleware, async errors and Zod validation, with real curl output.

web-security intermediate
5 min read

A Flask avatar upload writes outside its folder and accepts any file. Fix it with secure_filename, an extension allowlist and MAX_CONTENT_LENGTH.

typescript advanced
5 min read

Standard TC39 decorators for methods, classes, accessors and fields, then legacy experimentalDecorators with metadata-driven DI — all with real output.