Learn Node.js the way you actually get good at it: by building. 20 hands-on, test-driven blocks in strict TypeScript, tested with Node's built-in
node:testrunner β no test framework to install.
A complete, free course for JavaScript/TypeScript developers learning the Node.js
runtime β modules, the filesystem, streams, events, HTTP servers, CLIs, and more. You
don't read about APIs; you implement functions, make failing tests pass, and keep the
compiler happy under strict.
π§© Pairs with the sibling course TypeScript in a Month β learn the type system there, learn the runtime here.
- π§ͺ Test-driven β every block ships failing
node:testtests; you make them green. - π’ Zero test deps β uses Node's built-in test runner and
assert, so you learn the platform, not a framework. - π Strict TypeScript β
strict,noUncheckedIndexedAccess, and friends, run viatsx(no build step). - β
Verified solutions β every reference answer is itself tested
(
npm run test:solutions). - π οΈ Real-world arc β fundamentals β fs/streams/events β an HTTP API β a CLI capstone.
This is a GitHub template repository β click Use this template to get your own copy to commit solutions to.
# 1. Create your copy (Use this template) or clone
git clone https://github.com/Rossoline/node-learn.git
cd node-learn
# 2. Install dev dependencies (Node 22+ required)
npm install
# 3. Run all tests β most fail until you solve the exercises
npm test
# 4. Type-check the whole project
npm run typecheck- Read the block's
README.md. - Run its
src/examples.tsto see the ideas in action:npm run play blocks/01-getting-started/src/examples.ts
- Implement each
// TODOinsrc/exercises.ts. - Run that block's tests until green:
node --import tsx --test "blocks/01-getting-started/tests/*.test.ts" - Type-check, then compare with
solutions/.
blocks/NN-topic/
βββ README.md # the topic explained, with examples and the exercise list
βββ src/examples.ts # runnable, worked examples
βββ src/exercises.ts # practice tasks with // TODO stubs β your job
βββ tests/ # node:test tests β make them pass
βββ solutions/ # reference solutions (try the exercises first!)
The full day-by-day plan is in PLAN.md. Twenty blocks across four weeks:
| Week | Theme | Blocks |
|---|---|---|
| 1 | Node Foundations | 01 Getting Started Β· 02 Modules & npm Β· 03 Paths & Locations Β· 04 Async in Node Β· 05 Errors & the Process |
| 2 | System I/O | 06 Reading Files Β· 07 Writing Files Β· 08 Streams Β· 09 Events Β· 10 Buffers & Encoding |
| 3 | HTTP Service | 11 HTTP Server Basics Β· 12 Requests & JSON APIs Β· 13 Router & Middleware Β· 14 Config & Environment Β· 15 File-Backed Store |
| 4 | Practical Node | 16 Child Processes Β· 17 CLI Tools Β· 18 Testing in Depth Β· 19 Packaging & Scripts Β· 20 Capstone Project |
| Command | What it does |
|---|---|
npm test |
Run every block's tests (your progress). |
npm run typecheck |
Type-check the whole project (tsc --noEmit). |
npm run test:solutions |
Verify the reference solutions all pass. |
npm run play <file> |
Run any .ts file with tsx. |
Each exercise file exports functions; the matching test imports them and asserts behavior
with node:test + node:assert/strict. Implement a // TODO correctly and its test goes
green β under strict, with the compiler on your side.
If this helped you learn Node, please β the repo. Happy building! π οΈ