Part 0 · 1 chapters · ~8 min
The Method, and the Repos
How every module is built: the real system's contract, its core mechanism, the smallest correct version, edge-case tests, real tools as clients, and the list of what was left out; with the ten repos, their sizes, tests and the edges each gets right.
1
How this course works
ten systems, one method
- The contract the real system promises.
- The core mechanism that delivers it.
- The smallest correct version: narrow, and right.
- Edge-case tests, because that is where the bugs live.
- Real tools as clients: redis-cli, curl, nc, a browser.
- What was left out, which becomes the exercises.
| part | system | repo | lines | tests | the edge it gets right |
|---|---|---|---|---|---|
| M1 | Redis | repos/redis | ~400 | 4 | a command split across TCP reads; TTLs that survive an AOF replay |
| M2 | Kafka | repos/kafka | ~350 | 4 | a torn segment tail on recovery; the HW over the ISR only |
| M3 | compiler | repos/compiler | ~550 | 6 | left associativity; short-circuit codegen; positioned type errors |
| M4 | transpiler | repos/transpiler | ~350 | 7 | lexical this in arrows; nested templates; VLQ maps |
| M5 | JS framework | repos/jsframework | ~300 | 5 | conditional dependencies; keyed rows keeping their input state |
| M6 | UI framework | repos/uiframework | ~350 | 5 | batched updates; moves instead of re-creates; effect cleanup order |
| M7 | bundler | repos/bundler | ~300 | 2 | imports inside strings; shared modules staying in the main chunk |
| M8 | kernel slice | repos/kernel | ~250 | 4 | priority preemption in MLFQ; swap-in as blocking I/O |
| M9 | storage engine | repos/storage | ~450 | 5 | CRC-detected torn WAL tail; newest-wins merge with tombstones |
| M10 | HTTP server | repos/http | ~300 | 6 | pipelined responses in order; traversal refused; 431 limits |
code
# every repo: Node 23.6+ runs the .ts files directly (type stripping), no install step cd modules/byo/repos/redis npm test # node --test test/*.test.ts npm start # where a repo has a server or a demo # all ten at once cd modules/byo/repos && for d in */; do (cd "$d" && npm test --silent); done
how to read a repo
Read the README table first, then the test file, which is the specification in executable form, then the source in the order the README lists it. Break something on purpose (remove the CRC check, make the parser assume whole commands, drop the MLFQ preemption) and watch which test fails. That is the fastest way to understand why each line is there.
THE METHOD: SMALLEST CORRECT VERSION
how every module in this course is built, from the real system's contract to a tested core and a list of what was left out
swipe the figure sideways, or tap expand for full screen
1/6
contract
The contract: what the real system promises its users. Redis: a RESP protocol and single-threaded atomic commands. Kafka: ordered, durable, replayable partitions. A bundler: the same program behaviour in fewer, smaller files. Start from the promise, not the features list.