Node.js Tutorial
Learn to build servers, APIs, and command-line tools with JavaScript — 54 lessons from Beginner to Advanced.
Learn Node.js from scratch — modules, the event loop, fs, streams, HTTP, Express, REST APIs, databases and testing — free interactive backend lessons.
Part of the free Node.js course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
👋 Know a little JavaScript? You're ready for Node.js.
Start with Lesson 1 and build real backend skills step by step — at your own pace.
Lessons in this course
- Introduction to Node.js — What Node.js is, why it exists, and run your first JavaScript outside the browser
- Running Scripts & the REPL — Run .js files with node and experiment interactively in the REPL
- Modules (CommonJS & ESM) — Split code across files with require/module.exports and import/export
- npm & package.json — Manage dependencies and scripts with npm and a package.json file
- The Event Loop — Understand how Node runs non-blocking, asynchronous code on one thread
- Core Globals (process, __dirname) — Use process, __dirname, __filename, and other Node globals
- The fs Module — Read, write, and manage files with the built-in fs module
- Paths & OS — Build cross-platform paths with path and inspect the system with os
- Events & EventEmitter — Emit and listen for custom events with the EventEmitter class
- Streams & Buffers — Process large data efficiently with readable and writable streams
- The http Module — Make requests and understand the building blocks of HTTP in Node
- Building a Server — Create your own HTTP server with createServer and handle requests
- Routing by Hand — Send different responses based on the URL and HTTP method
- Async Patterns — Move from callbacks to promises to async/await for clean async code
- Error Handling — Handle errors in sync, callback, and async code without crashing
- Express Intro & Routing — Build web apps faster with the most popular Node framework
- Middleware — Run logic on every request with Express middleware functions
- REST APIs with Express — Design RESTful endpoints with proper verbs, status codes, and JSON
- Connecting a Database — Persist data by connecting your API to a real database
- Environment & Config — Manage secrets and settings with environment variables and .env files
- Testing (node:test) — Write automated tests with the built-in node:test runner
- CommonJS vs ES Modules — require/module.exports vs import/export, .cjs/.mjs, and interop pitfalls
- Buffers & Binary Data — Work with raw bytes using Buffer — from, alloc, encodings, and concat
- The process Object — Read argv, env, cwd, platform, and control the process lifecycle
- Timers & the Event Loop Phases — setTimeout, setImmediate, and process.nextTick ordering explained
- Child Processes (exec & spawn) — Run external programs with exec, execFile, spawn, and fork
- Worker Threads & Cluster — Run CPU-bound work off the main thread and scale across cores
- The crypto Module — Hash, HMAC, random bytes/UUIDs, and password KDFs with node:crypto
- Promises & async/await Deep Dive — all/allSettled/race/any, sequential vs parallel, and error handling
- Checkpoint: Node Core — Combine process, crypto and promises in a CLI build — then a quiz
- Advanced Streams: pipe & pipeline — pipe, stream.pipeline, backpressure, and custom Transform streams
- Express Routers & Route Organization — Structure routes with express.Router, params, and mounted sub-apps
- Request Validation (Zod & express-validator) — Validate and sanitize request input and return clean 400 errors
- JWT Authentication in Express — Issue and verify JWTs, protect routes, and hash passwords
- File Uploads with Multer — Handle multipart/form-data with disk and memory storage and limits
- Logging with morgan & pino — Add HTTP request logging and structured JSON logs with levels
- MongoDB with Mongoose — Define schemas and models and run CRUD queries with population
- Deploying Node (PM2 & Docker) — Production config, PM2, a Dockerfile, health checks, and graceful shutdown
- Checkpoint: Build a REST API — Combine validation, JWT auth and logging into a JSON API — then a quiz
- Scaling with the cluster Module — Use every CPU core by forking worker processes that share a port
- WebSockets (ws & Socket.IO) — Push real-time updates with persistent two-way connections
- GraphQL APIs — Query exactly what you need with schemas, resolvers, and Apollo
- SQL Databases with Sequelize — Model and query relational data with the Sequelize ORM
- Caching with Redis (ioredis) — Speed up apps with the cache-aside pattern and TTLs
- Security Best Practices — Harden Express with Helmet, CORS, rate limiting, and validation
- Building CLI Tools (commander) — Parse commands, options, and flags to ship a real CLI
- Publishing npm Packages — Configure package.json, semver, and publish to the npm registry
- Debugging & Profiling Node — Use the inspector, timers, and heap snapshots to find bugs and leaks
- Checkpoint: Production Backend — Combine caching, rate limiting and scaling in a build — then a quiz
- Capstone: A REST API — Tie everything together by building a complete REST API from scratch
- Message Queues with RabbitMQ — Decouple services with AMQP — channels, work queues, exchanges, and acks
- gRPC Services — Define services with Protocol Buffers and build fast unary and streaming RPCs
- Distributed Tracing — Trace requests across services with OpenTelemetry spans and context propagation
- Database Transactions & ACID — Keep data consistent with BEGIN/COMMIT/ROLLBACK, isolation levels, and deadlock handling