# Learna — Master Syllabus

**Owner:** Oluwaferanmi Adeniji
**Created:** 2026-09-21
**What this is:** A single hostable app with multiple standalone deep-dive modules. Each module teaches one subject from zero to "I can talk about this for 12 hours and build a toy version of it." Not markdown notes — animated HTML that decompiles how the thing actually works.

**Format decision (locked):** One app, shared design system, one folder per module. Tailwind for speed + custom CSS for the animation layer. Vanilla JS for the animation engine. Every module is independently hostable and independently readable.

**Delivery order (locked):**
1. `syllabus.md` (this file)
2. `index.html` — app shell / entrypoint / module map
3. **MySQL module** (full, 13 parts, 121 chapters)
4. **SQL language module** (full, 11 parts, 84 chapters)
5. Everything else, in the order agreed later

---

## The modules

| # | Module | Slug | Scope | Est. depth |
|---|---|---|---|---|
| 01 | MySQL Internals | `mysql` | The storage engine, byte level, build-your-own | 13 parts / 121 ch |
| 02 | SQL, The Language | `sql` | The language itself, deep, execution-aware | 11 parts / 84 ch |
| 03 | PostgreSQL Internals | `postgres` | Standalone, same depth as MySQL | 13 parts / 86 ch |
| 04 | Formal Database Theory | `theory` | The maths under all of it | 8 parts / 60 ch |
| 05 | Cassandra & MongoDB | `nosql` | LSM + document, distributed by default | 10 parts / 70 ch |
| 06 | ORM Internals | `orm` | Prisma, Drizzle, TypeORM, Sequelize, ActiveRecord, Hibernate | 9 parts / 60 ch |
| 07 | Scaling Databases | `scaling` | Cross-cutting, applies to all of 01–06 | 10 parts / 61 ch |
| 08 | Node.js Internals | `node` | Runtime, not language. To Staff level. | 14 parts / 120 ch |

**Total: 662 chapters across 8 modules.** This is a multi-year artifact, not a weekend.

---

## Cross-module principles

Rules that hold for every module, so the app feels like one thing.

1. **Animation earns its place.** A diagram animates only when the *motion is the explanation* — a page split, an LRU shuffle, a replication stream, an event loop phase. Decoration gets cut.
2. **Every claim is verifiable.** Each chapter ends with a runnable block: SQL you paste into a real server, a script you run, a flag you toggle. You never take my word for it.
3. **Byte level where it matters.** Page layouts, row formats, wire protocols shown as actual bytes, not boxes with labels.
4. **History explains weirdness.** Every module opens with why the thing is shaped the way it is. Most "gotchas" are fossils.
5. **Build a toy version.** Every module has a capstone where you implement the core mechanism yourself. Knowing and having-built are different competencies.
6. **Contrast, don't isolate.** MySQL chapters reference the Postgres chapter that differs. The NoSQL module references B+trees from MySQL. Cross-links everywhere.
7. **Staff framing.** Each part states what a Staff engineer is expected to say about it under pressure, and what a Senior typically gets wrong.

---

# Module 01 — MySQL Internals

**Slug:** `mysql`
**Target version:** MySQL 8.4 LTS, InnoDB. 8.0.x deltas noted where prod differs. Percona/MariaDB divergence noted inline, not taught as a parallel track.
**Capstone:** Build a storage engine.

### Part 0 — History & Why MySQL Is Shaped This Way
1. 1994 Monty, ISAM, the "fast and good enough" thesis
2. MyISAM's reign and why table locks were acceptable in 2001
3. Innobase Oy, Heikki Tuuri, Oracle buying InnoDB (2005) before MySQL (2010)
4. The Sun interregnum, the MariaDB fork, Percona's role
5. 5.5 → 5.6 → 5.7 → 8.0 → 8.4 LTS → 9.x: what changed and why
6. The pluggable storage engine API — the decision that defines everything
7. MySQL vs Postgres as architectural philosophies (clustered-first vs heap-first)

### Part 1 — The Anatomy of a Query
8. Connection: TCP/unix socket, handshake, auth plugins, `caching_sha2_password`
9. Thread-per-connection, thread cache, vs Postgres process-per-connection
10. The parser: lexer → parse tree; the query cache's ghost
11. Resolver/preparer: name resolution, privilege checks
12. The optimizer: logical transforms, cost model, plan generation
13. The executor: iterator model, 8.0's volcano refactor
14. The handler API — server layer ↔ storage engine boundary
15. Result packets on the wire, protocol 41, binary protocol for prepared statements

### Part 2 — On-Disk Anatomy
16. Files: `.ibd`, `ibdata1`, redo logs, undo, binlog, `.frm`'s death, the 8.0 data dictionary
17. Tablespaces: system, file-per-table, general, temporary, undo
18. The 16KB page, full byte layout: FIL header, page header, infimum/supremum, records, page directory, trailer
19. Extents (1MB), segments, space allocation
20. Row formats: REDUNDANT, COMPACT, DYNAMIC, COMPRESSED — byte-level diff
21. Off-page storage: BLOB/TEXT overflow, the 20-byte pointer, the 767-byte ghost
22. `innodb_page_size` 4K/8K/32K/64K and when it matters
23. Reading real pages: `innodb_ruby`, hexdump of an `.ibd`, `page_type_dump`

### Part 3 — B+Trees for Real
24. Why B+tree, not B-tree, not LSM, not hash — the disk math
25. Clustered index: the table *is* the PK B+tree
26. Secondary indexes hold PK values, not pointers — the double lookup
27. Insert: page fill, page directory, record linking
28. **Page splits** — 50/50, the right-hand insert optimization (animated)
29. Page merges, `MERGE_THRESHOLD`, why deletes don't return disk
30. Fragmentation, fill factor, the "rebuild your table" ritual
31. AUTO_INCREMENT vs UUID PKs, and how UUIDv7 / `UUID_TO_BIN(x,1)` fixes it (animated side by side)
32. Change buffer: deferred secondary index maintenance, its 8.0 fate
33. Adaptive Hash Index: what it is, when it's a contention nightmare
34. Index dives, cardinality estimation, persistent stats
35. Covering indexes, index condition pushdown, MRR, loose/tight index scan
36. Prefix indexes, functional indexes, multi-valued indexes for JSON
37. Descending indexes, and why 5.7's "descending" was a lie
38. Invisible indexes as a production safety tool
39. InnoDB full-text internals — aux tables, `FTS_DOC_ID`
40. Spatial / R-tree indexes

### Part 4 — MVCC, Transactions, Isolation
41. ACID, honestly — what MySQL actually guarantees
42. Read view: `trx_id`, `m_ids`, `up_limit_id`, `low_limit_id` — visibility algorithm animated
43. Hidden columns: `DB_TRX_ID`, `DB_ROLL_PTR`, `DB_ROW_ID`
44. Undo logs and the version chain — walking it visually
45. Purge threads, history list length, how a long transaction wrecks your disk
46. Isolation levels, each with a reproducible two-terminal demo
47. **REPEATABLE READ in MySQL specifically** — snapshot timing, the current-read exception
48. Phantom reads, write skew, lost updates — which levels stop which
49. Consistent read vs locking read (`FOR UPDATE`, `FOR SHARE`, `NOWAIT`, `SKIP LOCKED`)
50. `SKIP LOCKED` as a job-queue primitive

### Part 5 — Locking
51. Lock hierarchy: global, metadata (MDL), table, row
52. MDL — the invisible killer behind "my ALTER hung the app"
53. Intention locks (IS/IX) and the compatibility matrix
54. Record locks, **gap locks**, next-key locks — animated on a number line
55. Insert intention locks and concurrent-insert deadlocks
56. AUTO-INC lock modes 0/1/2 and binlog format interaction
57. Deadlock detection: wait-for graph, victim selection, `innodb_deadlock_detect=OFF`
58. Reading `SHOW ENGINE INNODB STATUS` deadlock sections line by line
59. `performance_schema.data_locks` / `data_lock_waits`
60. Real deadlock patterns and how to design them away

### Part 6 — Durability: Redo, Undo, Doublewrite, Recovery
61. WAL principle, LSN as the universal clock
62. Redo log: circular files, mini-transactions, log buffer, 8.0.30 dynamic resizing
63. `innodb_flush_log_at_trx_commit` 0/1/2 — the durability dial, with numbers
64. Group commit and the binlog three-phase pipeline
65. Doublewrite buffer — torn pages, 4K-sector disks
66. fsync, OS page cache, `O_DIRECT`, and disks that lie
67. Crash recovery: redo apply → undo rollback (animated timeline)
68. `innodb_force_recovery` levels 1–6, what each disables

### Part 7 — Buffer Pool & Memory
69. Buffer pool structure: pages, instances, chunks
70. **Midpoint LRU** — young/old sublists, `innodb_old_blocks_time`, animated against a full scan
71. Flush list, free list, page cleaners, adaptive flushing
72. Read-ahead: linear vs random
73. Dirty page ratio, checkpoint age, checkpoint stalls
74. Buffer pool dump/load on restart
75. Per-connection memory: sort/join/read buffers, and the OOM math people get wrong
76. Temp tables: internal, on-disk, TempTable vs MEMORY, the 8.0 change

### Part 8 — The Optimizer
77. Cost model constants, `mysql.server_cost` / `engine_cost`
78. Statistics: cardinality sampling, sample pages, histograms
79. Join algorithms: nested loop, block nested loop, **hash join (8.0.18+)**, why no merge join
80. Join order search, `optimizer_search_depth`, greedy vs exhaustive
81. Semijoin strategies: DuplicateWeedout, FirstMatch, LooseScan, MaterializeLookup
82. Derived table merging vs materialization
83. Condition pushdown, index merge (union/intersection/sort-union) and its traps
84. ORDER BY / GROUP BY: filesort algorithms, priority queue for LIMIT
85. `EXPLAIN` properly, `EXPLAIN ANALYZE`, `FORMAT=JSON` cost numbers
86. Optimizer trace — read end to end on a real slow query
87. Hints: `/*+ ... */` vs `FORCE INDEX`, `optimizer_switch`
88. CTEs and window functions: execution, and the CTE materialization trap

### Part 9 — Replication & HA
89. Binlog formats: STATEMENT, ROW, MIXED; event stream decoded with `mysqlbinlog`
90. Binlog vs redo — two logs, and the XA two-phase commit between them
91. Async replication: dump thread → IO thread → relay log → SQL thread (animated)
92. GTIDs: format, auto-positioning, `gtid_executed`, errant transactions
93. Semi-sync: AFTER_SYNC vs AFTER_COMMIT, lossless
94. Multi-threaded appliers: `LOGICAL_CLOCK`, `WRITESET`
95. Replication lag: causes, measuring truthfully (`pt-heartbeat`, not `Seconds_Behind_Master`)
96. Group Replication / InnoDB Cluster: certification, flow control
97. MySQL Router, ProxySQL, Vitess — the layer above
98. Failover semantics, Orchestrator, split brain
99. Read-your-writes on replicas and how apps get it wrong

### Part 10 — Operating MySQL in Production
100. Schema changes: in-place vs copy vs INSTANT DDL, the algorithm/lock matrix
101. `pt-online-schema-change` and `gh-ost` internals
102. Connection pooling, `max_connections`, thread pool plugin
103. Backups: mysqldump / mysqlpump / XtraBackup / snapshots; PITR with binlogs
104. Observability: performance_schema architecture, sys schema, slow log, `pt-query-digest`
105. The 15 config knobs that actually matter, with reasoning
106. Character sets and collations: `utf8` the lie, `utf8mb4_0900_ai_ci`, index behavior
107. JSON columns: storage format, generated columns, indexing strategy
108. Partitioning: what it does and doesn't buy you
109. Security surface: privileges, TDE, audit log

### Part 11 — Build Your Own Storage Engine (capstone)
110. Design: single-file engine in TypeScript (Go/Rust variant notes)
111. Pager + 16KB page allocator + free list
112. Record encoding with a varint row format
113. B+tree: search, insert with split, delete with merge
114. WAL with LSNs + crash recovery replay
115. MVCC: trx ids, version chains, read views
116. A tiny SQL subset: parser → plan → iterator executor
117. Torture test: kill -9 mid-write, verify recovery, compare page dumps to InnoDB

### Part 12 — Interview & Expert Mode
118. 60 questions ranked by depth, with model answers
119. Ten war stories with root causes
120. MySQL vs Postgres, defended with mechanism not vibes
121. Where MySQL is going: 8.4 LTS, HeatWave, 9.x cadence

**MySQL exclusions:** MyISAM beyond history · NDB Cluster (one paragraph) · HeatWave/OCI vendor surface · MariaDB as a parallel track · installation/GUI tools · pre-5.7 behavior except where 8.0 changed semantics · Vitess internals in depth (lives in Module 07).

---

# Module 02 — SQL, The Language

**Slug:** `sql`
**Premise:** You write SQL daily. This is not a tutorial. It is the language as a *formal system* — what each clause means semantically, in what order the engine evaluates it, and why your intuition about NULLs is wrong.
**Capstone:** Write a SQL parser + interpreter over an in-memory relation.

### Part 0 — Where SQL Came From
1. Codd's 1970 paper and the relational model's promise
2. SEQUEL at IBM, System R, why the syntax looks like English
3. The standards: SQL-86 → 92 → 99 → 2003 → 2011 → 2016 → 2023
4. Why every vendor's dialect diverges, and the portability tax
5. SQL vs the relational model — where SQL betrays Codd (duplicates, NULLs, order)

### Part 1 — The Semantics Nobody Teaches
6. **Logical order of evaluation**: FROM → WHERE → GROUP BY → HAVING → SELECT → DISTINCT → ORDER BY → LIMIT (animated)
7. Why you can't use a SELECT alias in WHERE but can in ORDER BY
8. Three-valued logic: TRUE/FALSE/UNKNOWN, the full truth tables
9. **NULL semantics** — comparison, arithmetic, aggregation, `IS DISTINCT FROM`
10. NULL in GROUP BY vs NULL in an index vs NULL in a UNIQUE constraint
11. Bags vs sets: SQL has duplicates, relational algebra doesn't
12. Row value expressions and `(a,b) > (c,d)` for keyset pagination

### Part 2 — Joins, Properly
13. Cross join as the foundation; every join is a filtered cross join
14. INNER / LEFT / RIGHT / FULL — with animated set visuals and row multiplication
15. Join fan-out: the silent row multiplier that breaks your aggregates
16. Self joins, and hierarchies without recursion
17. Semi-join and anti-join: `EXISTS`, `IN`, `NOT EXISTS`, `NOT IN`
18. **The `NOT IN` + NULL trap**, demonstrated
19. LATERAL / `CROSS APPLY`: the join that sees the left row
20. Natural join and `USING` — why seniors avoid one of them
21. Non-equi joins: ranges, intervals, temporal overlap

### Part 3 — Aggregation & Grouping
22. Aggregate functions and what they do with NULL
23. GROUP BY semantics, functional dependency, `ONLY_FULL_GROUP_BY`
24. HAVING vs WHERE — the real difference
25. `GROUPING SETS`, `ROLLUP`, `CUBE`, `GROUPING()`
26. `FILTER (WHERE ...)` and its MySQL workaround
27. Conditional aggregation — pivoting without a PIVOT clause
28. `DISTINCT` inside aggregates, and `COUNT(*)` vs `COUNT(col)` vs `COUNT(DISTINCT col)`
29. Ordered-set aggregates and percentiles

### Part 4 — Window Functions
30. The mental model: a window is a view *per row*, not a group
31. `OVER (PARTITION BY ... ORDER BY ...)` decomposed (animated)
32. Frames: ROWS vs RANGE vs GROUPS, and the default frame trap
33. Ranking: `ROW_NUMBER`, `RANK`, `DENSE_RANK`, `NTILE`
34. Offset: `LAG`, `LEAD`, `FIRST_VALUE`, `LAST_VALUE`, `NTH_VALUE`
35. Running totals, moving averages, cumulative distributions
36. Gaps and islands — the canonical hard problem, solved three ways
37. Deduplication with `ROW_NUMBER` vs `DISTINCT ON` (Postgres) vs GROUP BY
38. Window function execution cost, and when they beat self-joins
39. `WINDOW` clause reuse, and named windows

### Part 5 — CTEs, Recursion, Subqueries
40. Subquery types: scalar, row, table, correlated
41. Correlated subquery execution and the N+1 inside SQL
42. CTEs as naming vs CTEs as optimization fences (vendor differences)
43. **Recursive CTEs**: anchor + recursive term, animated iteration by iteration
44. Graph traversal, transitive closure, cycle detection with recursive CTEs
45. Generating series, calendars and gap-filling with recursion
46. Hierarchies: adjacency list, path enumeration, nested sets, closure tables
47. Recursion limits and runaway query protection

### Part 6 — DDL, Constraints, the Schema as a Contract
48. Types: numeric precision, exact vs approximate, the `DECIMAL` money rule
49. Dates, times, time zones, intervals — and the storage truth per engine
50. Strings, collations, comparison and sort behavior
51. Constraints: PK, UK, FK, CHECK, NOT NULL — and their enforcement cost
52. Foreign key actions: CASCADE, SET NULL, RESTRICT, and the lock they take
53. Deferrable constraints, and what MySQL doesn't have
54. Generated/computed columns, stored vs virtual
55. Domains, enums, and modelling with types
56. Schema migration as a language problem (expand/contract)

### Part 7 — DML, Transactions, Concurrency in SQL Terms
57. INSERT variants: multi-row, `INSERT ... SELECT`, `ON DUPLICATE KEY`, `ON CONFLICT`
58. **UPSERT** across dialects and its concurrency hazards
59. UPDATE with join, UPDATE from SELECT, per-dialect syntax
60. DELETE vs TRUNCATE vs DROP, and what each does to the log
61. `RETURNING` and why it matters for round trips
62. `MERGE` (SQL:2003) and the race conditions people miss
63. Transaction control in SQL: savepoints, rollback to savepoint
64. Writing concurrency-safe SQL: the idempotent write patterns

### Part 8 — Advanced & Vendor Frontiers
65. JSON in SQL: path expressions, `JSON_TABLE`, indexing strategies
66. Arrays and composite types (Postgres) vs the MySQL way
67. Full-text search in SQL, ranking, and its limits
68. Temporal/bitemporal tables, system versioning
69. `TABLESAMPLE` and statistical querying
70. Set operations: UNION vs UNION ALL vs INTERSECT vs EXCEPT, and their cost
71. Views, materialized views, and updatable view rules
72. Stored procedures, functions, triggers — and the Staff argument about when to use them

### Part 9 — Writing SQL That the Engine Likes
73. Sargability — what kills an index, with animated before/after
74. Implicit conversions and the silent full scan
75. Pagination: OFFSET's O(n) problem and keyset pagination done right
76. Anti-patterns catalogue: `SELECT *`, functions on columns, OR chains, leading wildcards
77. Reading your own plan without leaving SQL
78. Rewriting a query five ways and measuring each

### Part 10 — Build a SQL Engine (capstone)
79. Tokenizer and grammar for a SQL subset
80. AST → logical plan → physical plan
81. Volcano iterators: scan, filter, project, join, aggregate, sort
82. Implementing window functions over a sorted stream
83. Recursive CTE execution as a fixpoint loop
84. Feeding it into the Module 01 storage engine

**SQL exclusions:** vendor GUI query builders · ORM query DSLs (Module 06) · BI/analytics tools · PL/SQL or T-SQL as full programming languages (procedures covered conceptually, not as a language course) · SQL injection beyond a pointer to Module 07/security.

---

# Module 03 — PostgreSQL Internals

**Slug:** `postgres`
**Premise:** Standalone, same depth as MySQL, deliberately structured in parallel so you can diff the two architectures chapter by chapter.
**Capstone:** Write a Postgres extension + an FDW.

### Part 0 — History & Philosophy
1. Ingres → Postgres (Stonebraker, Berkeley, 1986) → PostgreSQL 1996
2. The extensibility thesis: types, operators, index AMs as first-class
3. Release cadence, the -hackers culture, why there's no company
4. Postgres vs MySQL: heap + separate index vs clustered index
5. Forks and derivatives: Citus, Timescale, Neon, Aurora, CockroachDB's lineage

### Part 1 — Process Architecture
6. Postmaster, backend-per-connection, and why connection count hurts
7. Background workers: checkpointer, bgwriter, WAL writer, autovacuum launcher
8. Shared memory, `shared_buffers`, and the double-buffering debate
9. The startup sequence and crash restart
10. Connection pooling as a *requirement*: PgBouncer modes explained

### Part 2 — Storage Layout
11. The cluster on disk: `base/`, OIDs, relfilenodes, tablespaces
12. The 8KB page: page header, line pointers, tuples, special space (byte level)
13. Heap tuples: `HeapTupleHeader`, `xmin`, `xmax`, `ctid`, infomask bits
14. TOAST: compression, out-of-line storage, the 2KB threshold, TOAST tables
15. Free Space Map and Visibility Map
16. Fillfactor and **HOT updates** — animated
17. `pageinspect`, `pg_filedump` — reading real pages

### Part 3 — MVCC, Vacuum, and the Postgres Bargain
18. MVCC via tuple versions in the heap — the core design difference from InnoDB
19. Snapshots: `xmin`, `xmax`, the in-progress array, visibility rules animated
20. Why UPDATE is a delete+insert, and what that costs
21. **Bloat**: how it happens, how to see it, how to fix it
22. VACUUM: what it does, lazy vs full, the freeze map
23. Autovacuum tuning — the single most common production failure
24. **Transaction ID wraparound** and the shutdown that ends careers
25. `pg_stat_activity`, long transactions, and replication slots blocking vacuum

### Part 4 — Indexes
26. The index AM interface — why Postgres has so many index types
27. B-tree: layout, deduplication (13+), bottom-up deletion (14+)
28. Index-only scans and the visibility map's role
29. **Hash** indexes (and when they became crash-safe)
30. **GIN**: inverted index, posting lists, fastupdate, for JSONB/arrays/FTS
31. **GiST**: the generalized search tree, for geometry, ranges, KNN
32. **SP-GiST**: space-partitioned trees
33. **BRIN**: block range indexes, when they're magic and when useless
34. Bloom indexes
35. Partial indexes, expression indexes, covering (`INCLUDE`) indexes
36. Multi-column index ordering and the correlation statistic
37. Index bloat, REINDEX CONCURRENTLY

### Part 5 — WAL, Checkpoints, Recovery
38. WAL records, LSNs, `pg_wal` layout
39. Full page writes and why they exist (contrast: doublewrite)
40. Checkpoints: timed vs requested, spread checkpoints, the IO storm
41. `synchronous_commit` levels — the full menu, not just on/off
42. Crash recovery and `pg_control`
43. PITR: base backup + WAL archive, `recovery_target_*`
44. `pg_rewind`, timelines, and the fork after failover

### Part 6 — The Planner
45. Genetic query optimizer vs exhaustive search, `geqo_threshold`
46. Statistics: `pg_statistic`, MCVs, histograms, n-distinct, extended statistics
47. Cost parameters: `random_page_cost` and the SSD adjustment everyone forgets
48. Scan nodes: seq, index, index-only, bitmap heap/index
49. Join nodes: nested loop, hash join, **merge join** (which MySQL lacks)
50. Aggregation: hash agg, group agg, and the 13+ hashagg spill
51. Parallel query: workers, gather, gather merge, what can't parallelize
52. JIT compilation (LLVM), when it helps and when it hurts
53. `EXPLAIN (ANALYZE, BUFFERS)` read properly
54. Plan instability, `pg_hint_plan`, and why Postgres resists hints philosophically

### Part 7 — Types, Extensions, Extensibility
55. The type system: base types, domains, composites, ranges, arrays
56. JSON vs JSONB: storage, operators, indexing, when each wins
57. Writing an extension in C: the SQL + control + shared library triad
58. Foreign Data Wrappers — Postgres as a federation engine
59. Logical decoding plugins
60. `pg_stat_statements`, `auto_explain`, and the extension ecosystem worth knowing
61. PostGIS as the case study in extensibility done right

### Part 8 — Replication
62. Physical (streaming) replication: WAL sender/receiver, hot standby
63. Replication slots, and the disk they'll fill
64. Synchronous replication and quorum commit
65. Hot standby conflicts, `max_standby_streaming_delay`, `hot_standby_feedback`
66. **Logical replication**: publications, subscriptions, the protocol
67. Logical vs physical: the decision matrix
68. CDC with Debezium / `wal2json` — Postgres as an event source
69. Failover: Patroni, repmgr, and consensus-backed HA

### Part 9 — Partitioning & Large Data
70. Declarative partitioning: range, list, hash
71. Partition pruning (plan time vs execution time), partition-wise joins
72. Attaching/detaching partitions without downtime
73. Inheritance-based partitioning and its legacy
74. Timescale's hypertables as an extension case study

### Part 10 — Operating Postgres
75. The configuration knobs that matter, with reasoning
76. `pg_stat_*` views: what each tells you
77. Locks: lock modes, `pg_locks`, lock queues, and the ACCESS EXCLUSIVE trap
78. Safe schema migrations: the operations that take which lock
79. Backups: `pg_dump` vs `pg_basebackup` vs pgBackRest vs WAL-G
80. Upgrades: `pg_upgrade` vs logical replication cutover

### Part 11 — Build (capstone)
81. A working extension: custom type + operator + index support
82. An FDW over a CSV or an HTTP API
83. A logical decoding output plugin

### Part 12 — Expert Mode
84. Postgres vs MySQL defended both directions with mechanism
85. War stories: wraparound, bloat, the autovacuum that never ran, the slot that filled the disk
86. Where Postgres is going: 18/19, async IO, direct IO, pluggable table AMs

**Postgres exclusions:** Aurora/Neon/Cloud vendor internals beyond an architecture note · PL/pgSQL as a full programming course · PostGIS spatial theory in depth · the C codebase tour beyond what the capstone needs.

---

# Module 04 — Formal Database Theory

**Slug:** `theory`
**Premise:** You asked for it explicitly. This is the maths that makes the other modules non-arbitrary. Taught with animation, not proofs-for-proofs'-sake — but the proofs are there where they change how you design.
**Capstone:** Implement a relational algebra engine + a normalization analyzer.

### Part 1 — The Relational Model
1. Codd's 12 rules (there are 13) and which real systems violate which
2. Relations, tuples, attributes, domains — the precise definitions
3. Keys: superkey, candidate, primary, foreign, surrogate vs natural
4. The closed-world assumption and why NULL breaks it
5. Relational model vs SQL: the formal gap

### Part 2 — Relational Algebra & Calculus
6. Selection, projection, rename — the unary operators
7. Union, difference, Cartesian product — the set operators
8. Joins derived: theta, equi, natural, semi, anti, division
9. Algebraic equivalences — the rewrite rules your optimizer uses (animated)
10. Tuple relational calculus and domain relational calculus
11. Codd's theorem: algebra ≡ calculus, and what it means for SQL's expressiveness
12. What SQL *cannot* express, and why recursion was added

### Part 3 — Functional Dependencies & Normalization
13. Functional dependencies, notation, and reading them from a domain
14. Armstrong's axioms: reflexivity, augmentation, transitivity (+ derived rules)
15. Attribute closure and computing candidate keys mechanically
16. Minimal/canonical cover
17. 1NF, 2NF, 3NF, BCNF — each with the anomaly it removes (animated)
18. Lossless-join and dependency-preserving decomposition
19. Multivalued dependencies and 4NF
20. Join dependencies and 5NF
21. Domain-key normal form, and why 6NF matters for temporal data
22. **When to denormalize** — the Staff-level judgment call, with cost model

### Part 4 — Query Processing Theory
23. Query equivalence and containment
24. Conjunctive queries and the homomorphism theorem
25. Join ordering as an NP-hard problem, and the heuristics that survive
26. Cardinality estimation theory and why every optimizer is eventually wrong
27. Worst-case optimal joins and the AGM bound
28. Cost models: IO-centric vs CPU-centric

### Part 5 — Concurrency Theory
29. Schedules, serial vs serializable
30. Conflict serializability and the precedence graph (animated cycle detection)
31. View serializability and why nobody implements it
32. Two-phase locking, strict 2PL, rigorous 2PL
33. Deadlock: prevention (wait-die, wound-wait) vs detection
34. Timestamp ordering, Thomas's write rule
35. Optimistic concurrency control and validation
36. **Snapshot isolation formally** — and why it isn't serializable
37. Write skew, and Serializable Snapshot Isolation (SSI)
38. Recoverable, cascadeless, strict schedules

### Part 6 — Distributed Theory
39. CAP formally stated (and the cartoon version debunked)
40. PACELC
41. Consistency models as a hierarchy: linearizable → sequential → causal → eventual
42. FLP impossibility
43. Consensus: Paxos, Raft, and what they actually solve
44. Quorum maths: R + W > N, sloppy quorums, hinted handoff
45. Vector clocks, Lamport clocks, hybrid logical clocks
46. CRDTs: state-based vs op-based, and the lattice requirement
47. Two-phase commit, three-phase commit, and why 2PC blocks

### Part 7 — Data Structures Behind Storage
48. B-tree family formally: B, B+, B*, and the height/fanout maths
49. LSM trees: amplification theory (read/write/space), the RUM conjecture
50. Hash indexes, extendible hashing, linear hashing
51. Skip lists and probabilistic balance
52. Bloom filters, counting Bloom, cuckoo filters — false positive maths
53. HyperLogLog and sketch-based cardinality
54. Tries, radix trees, ART (adaptive radix tree)
55. Fractal trees and Bε-trees

### Part 8 — Theory You'll Actually Cite
56. The transaction models: flat, nested, sagas — formally
57. Isolation levels as anomaly-prevention definitions (ANSI vs Adya)
58. Why "REPEATABLE READ" means different things per vendor, formally
59. Jepsen's methodology and reading a Jepsen report
60. Capstone: build a relational algebra interpreter + an FD/normalization analyzer

**Theory exclusions:** full proof derivations for every theorem (stated + intuition + the ones that change design decisions get proved) · datalog beyond a section · description logics · formal verification of databases · academic-only models with no implementation.

---

# Module 05 — Cassandra & MongoDB

**Slug:** `nosql`
**Premise:** Two different bets against the relational model. Taught together so the contrast is the lesson: wide-column + LSM + AP, vs document + B-tree + tunable.
**Capstone:** Build an LSM storage engine, and a document store with secondary indexes.

### Part 1 — Why NoSQL Happened
1. The 2000s scale wall and what actually broke
2. Dynamo (2007) and BigTable (2006) — the two ancestor papers
3. The NoSQL taxonomy: key-value, wide-column, document, graph
4. What was oversold, what was real, and the NewSQL correction
5. Choosing: the honest decision matrix

### Part 2 — LSM Trees (the shared foundation)
6. Why LSM: write amplification vs B-trees, the sequential-IO thesis
7. Memtable, immutable memtable, flush (animated)
8. SSTables: format, index blocks, data blocks
9. **Compaction strategies**: size-tiered, leveled, time-window, incremental (each animated)
10. Read path: memtable → bloom → partition index → SSTable
11. Bloom filters in the read path, and false-positive tuning
12. Tombstones, grave­yards, and the deleted-data problem
13. Write/read/space amplification, the RUM conjecture in practice
14. Row cache, key cache, chunk cache
15. RocksDB as the reference implementation

### Part 3 — Cassandra Architecture
16. Ring topology, tokens, virtual nodes
17. Consistent hashing and the partitioner
18. Gossip protocol, failure detection (phi accrual), animated
19. Snitches, racks, datacenters, replication strategy
20. Coordinator node, request routing
21. **Tunable consistency**: ONE / QUORUM / LOCAL_QUORUM / ALL, and R+W>N animated
22. Hinted handoff, read repair, anti-entropy repair (Merkle trees)
23. Lightweight transactions and Paxos in Cassandra
24. The commit log and durability

### Part 4 — Cassandra Data Modelling
25. **Query-first modelling** — the inversion from relational
26. Partition key vs clustering key, and the physical layout it produces
27. Wide partitions: the limit, the symptoms, the fix
28. Denormalization as the default, and managing the write fan-out
29. Materialized views and why they're marked experimental
30. Secondary indexes, SASI, and why you usually shouldn't
31. Collections, UDTs, counters, and their hidden costs
32. Time series modelling — Cassandra's best use case
33. Anti-patterns: queues, deletes-heavy workloads, unbounded partitions
34. CQL: what looks like SQL but isn't

### Part 5 — MongoDB Architecture
35. Document model, BSON format byte level
36. WiredTiger: B-tree + LSM options, the storage engine layer
37. WiredTiger cache, eviction, checkpoints
38. The journal and durability (`w`, `j`, `wtimeout`)
39. Storage: collections, `_id`, document growth and move
40. MVCC in WiredTiger, snapshots, and the 4.0 transaction addition

### Part 6 — MongoDB Querying & Indexing
41. The query planner, plan cache, and `explain()`
42. Index types: single, compound, multikey, text, geospatial, hashed, wildcard
43. **The ESR rule** for compound indexes
44. Covered queries and projection
45. Aggregation pipeline: stages, execution, `$lookup`'s real cost
46. Index intersection vs compound
47. Partial and TTL indexes
48. Schema design: embed vs reference, the 16MB limit, the bucket pattern
49. The schema-design pattern catalogue (attribute, subset, computed, outlier)

### Part 7 — MongoDB Distribution
50. Replica sets: primary election (Raft-like), oplog, rollback
51. Read preference and read concern — the full matrix
52. Write concern and the durability dial
53. Causal consistency and sessions
54. **Sharding**: shard key choice, chunks, balancer, jumbo chunks
55. Hashed vs ranged shard keys, and resharding (5.0+)
56. `mongos`, config servers, targeted vs scatter-gather queries
57. Change streams as a CDC primitive
58. Transactions across shards, and their cost

### Part 8 — Operating Both
59. Cassandra ops: nodetool, repair scheduling, adding/removing nodes, the bootstrap
60. Cassandra monitoring: what metrics mean an incident
61. MongoDB ops: rolling upgrades, index builds, `currentOp`, profiler
62. Backups for each, and PITR options
63. Cost and capacity modelling for both

### Part 9 — Honest Comparison
64. Cassandra vs MongoDB vs Postgres vs MySQL — the decision framework
65. Jepsen findings for both, read critically
66. When a document DB is actually a relational DB with worse constraints
67. Polyglot persistence and the consistency tax across stores

### Part 10 — Build (capstone)
68. An LSM engine: memtable, SSTable writer, bloom, leveled compaction
69. A document store: BSON-ish encoding, a B-tree, a secondary index
70. A consistent-hashing ring with tunable-consistency reads/writes

**NoSQL exclusions:** DynamoDB/Cosmos vendor specifics beyond architecture comparison · graph databases (Neo4j) — noted as a gap, could be a future module · Redis (belongs in a caching module) · Elasticsearch (search module) · HBase/Accumulo beyond BigTable lineage · Couchbase/RethinkDB.

---

# Module 06 — ORM Internals

**Slug:** `orm`
**Premise:** You use these daily and they are a black box that generates your SQL. Opening them is how you stop being surprised in production.
**Capstone:** Build an ORM — schema definition, query builder, unit of work, migrations, type inference.

### Part 1 — The Impedance Mismatch
1. Objects vs relations: the formal mismatch (identity, inheritance, associations, granularity)
2. The history: TopLink, Hibernate, ActiveRecord, and the Rails effect
3. Patterns of Enterprise Application Architecture — the vocabulary
4. **Data Mapper vs Active Record** as architectures
5. The ORM debate, argued properly both ways

### Part 2 — The Core Machinery
6. Metadata/schema mapping: decorators, schema files, introspection
7. **Identity map** — one object per row per session
8. **Unit of Work** — change tracking and ordered flush
9. Dirty checking: snapshot vs proxy vs explicit
10. **Lazy loading** and proxy objects — how they're implemented
11. **The N+1 problem** — animated, and every solution (eager load, join, batch, dataloader)
12. Eager loading strategies: join vs subquery vs separate query, with the row-explosion tradeoff
13. Cascades and persistence-by-reachability
14. First-level vs second-level cache

### Part 3 — Query Building
15. From fluent API to AST to SQL — the pipeline
16. Parameter binding and how ORMs prevent injection (and how they fail to)
17. Dialect abstraction and the leaky parts
18. Relation loading and result-set hydration (the expensive part nobody profiles)
19. Type mapping: dates, decimals, JSON, enums, arrays
20. Raw escape hatches and when to take them

### Part 4 — Prisma
21. Architecture: schema → generated client → query engine (Rust) → DB
22. The query engine binary, and what changed when they removed it
23. How Prisma generates types, and the inference limits
24. Prisma's relation queries and the join-vs-multiple-query decision (`relationJoins`)
25. Migrations: `migrate dev` / `deploy`, the shadow DB, drift detection
26. Connection pooling, Accelerate, and the serverless problem
27. Reading the generated SQL, and Prisma's known pathologies

### Part 5 — Drizzle
28. The "SQL-first" thesis and how it differs architecturally
29. Type inference from schema without codegen
30. The query builder's compile-time SQL construction
31. `db.query` relational API vs core builder — what SQL each emits
32. drizzle-kit migrations and the introspection path
33. Prepared statements and edge/serverless fit
34. Where Drizzle's types break down

### Part 6 — TypeORM, Sequelize, Kysely, MikroORM
35. TypeORM: Data Mapper + Active Record in one, the EntityManager, its metadata storage
36. TypeORM migrations, and the synchronize footgun
37. Sequelize: the older model, hooks, and its query generation
38. Kysely: a type-safe query builder that isn't an ORM — the distinction
39. MikroORM: identity map + unit of work done properly in TS
40. Choosing between them with evidence

### Part 7 — The Reference Implementations
41. **Hibernate/JPA**: session, persistence context, flush modes, the dirty-checking algorithm
42. Hibernate's HQL/Criteria → SQL, and the famous N+1 / MultipleBagFetch problems
43. **ActiveRecord (Rails)**: the convention engine, relation lazy chain, `includes` vs `preload` vs `eager_load`
44. **SQLAlchemy**: Core vs ORM, the unit of work, the most respected design in the space
45. Django ORM: querysets, lazy evaluation, `select_related` vs `prefetch_related`
46. What each got right that the JS ecosystem hasn't rebuilt yet

### Part 8 — ORMs at Staff Level
47. Profiling ORM output: query logs, `pg_stat_statements`, slow log correlation
48. The migration-safety problem: ORMs generate unsafe DDL
49. Transactions through an ORM: propagation, nesting, savepoints
50. Connection pooling interaction (pool per instance × instances = DB max_connections)
51. Multi-tenancy patterns through an ORM
52. When to drop to SQL, and how to structure a codebase that does both
53. Testing strategies: real DB vs transactional rollback vs in-memory
54. The Staff position on ORMs, defensible in an RFC

### Part 9 — Build Your Own ORM (capstone)
55. Schema definition with type inference
56. A query builder producing parameterized SQL
57. Identity map + unit of work + dirty tracking
58. Relation loading with batch resolution (killing N+1 by design)
59. A migration engine with diffing
60. Transaction management and connection pooling

**ORM exclusions:** every ORM in existence (six covered deeply, others by pattern) · GraphQL layers (adjacent, not ORM) · query builders in non-covered languages · ODM specifics beyond Mongoose basics in Module 05.

---

# Module 07 — Scaling Databases

**Slug:** `scaling`
**Premise:** You asked for scaling "as another module for them all." This is the cross-cutting one — it references MySQL, Postgres, Cassandra, and Mongo chapters rather than repeating them, and teaches the scaling *decisions* as a discipline.
**Capstone:** Take a single-node schema to a sharded, cached, replicated architecture with a migration plan.

### Part 1 — Know Your Limits First
1. Measuring before scaling: the four golden signals for a database
2. Capacity modelling: QPS, working set, IOPS, connection maths
3. Where single-node actually ends (the numbers, per engine)
4. **Scaling up before out** — the underrated first move, with real hardware numbers
5. The cost model: $/QPS across managed and self-hosted

### Part 2 — Query & Schema Scaling
6. The slow-query pipeline: capture → digest → rank → fix → verify
7. Index strategy at scale, and the write cost of every index
8. Schema design for scale: denormalization, summary tables, counter tables
9. Archival and data lifecycle: hot/warm/cold tiers
10. Big deletes without killing prod (chunking, partition drops)
11. Online schema change at scale, revisited across engines

### Part 3 — Connection & Concurrency Scaling
12. The connection problem, formally (memory × connections)
13. Pooling architectures: in-app, sidecar, proxy (PgBouncer, ProxySQL, RDS Proxy)
14. Transaction vs session vs statement pooling — what breaks in each
15. Serverless and the connection storm
16. Admission control, queueing, and shedding load at the DB edge

### Part 4 — Caching
17. Cache topology: client → CDN → app → distributed cache → DB
18. Patterns: cache-aside, read-through, write-through, write-behind, refresh-ahead
19. **Invalidation** strategies, and why this is the hard problem
20. Stampede/thundering herd: locking, probabilistic early expiry, request coalescing
21. Negative caching and the cache-penetration attack
22. Redis as the workhorse: data structures, persistence, eviction policies, cluster mode
23. Consistency between cache and DB — the dual-write problem
24. Materialized views and precomputation as caching

### Part 5 — Read Scaling
25. Read replicas: topology, lag, and the routing layer
26. Replica lag-aware routing and read-your-writes guarantees
27. Geographic replicas and the latency map
28. Read amplification and fan-out control
29. CQRS: separating the read model, with the sync mechanism

### Part 6 — Write Scaling & Sharding
30. Vertical partitioning / functional decomposition (split services before you shard)
31. **Sharding strategies**: hash, range, directory, geo — each animated with rebalancing
32. Choosing a shard key — the decision that you cannot undo cheaply
33. Resharding live: dual writes, backfill, cutover, verification
34. Cross-shard queries, scatter-gather, and the fan-out tax
35. Cross-shard transactions: 2PC, sagas, or avoidance
36. **Vitess** internals: vtgate, vttablet, keyspaces, vindexes, reshard workflow
37. Citus internals: distributed tables, reference tables, the coordinator
38. Sharding at the app layer vs the proxy layer vs the DB layer
39. Global secondary indexes across shards

### Part 7 — Multi-Region & Global
40. Multi-region topologies: active-passive, active-active, regional sharding
41. Conflict resolution: LWW, CRDTs, application-level merge
42. Spanner and TrueTime — what a synchronized clock buys you
43. CockroachDB / YugabyteDB architecture, and the Postgres-compatibility bet
44. AWS Aurora architecture: the log-is-the-database design
45. PlanetScale / Neon: separation of storage and compute
46. Data residency and compliance-driven placement

### Part 8 — Event-Driven & Streaming Data
47. CDC properly: log-based vs query-based vs trigger-based
48. Debezium architecture and the schema-evolution problem
49. **The outbox pattern** and transactional messaging
50. Kafka as a database log: retention, compaction, exactly-once semantics
51. Stream processing basics: windowing, state stores, Flink/Kafka Streams
52. Lambda vs Kappa architecture
53. The analytics split: OLTP → OLAP, and the ETL/ELT boundary
54. Columnar stores (ClickHouse, DuckDB) — when to add one

### Part 9 — Reliability at Scale
55. HA topologies and failover automation per engine
56. Backup strategy at TB scale, and restore-time as the real metric
57. DR: RPO/RTO, and testing the restore (the untested backup doesn't exist)
58. Chaos testing a database tier
59. Runbooks and the incidents that actually happen

### Part 10 — The Scaling Decision Framework (capstone)
60. A written decision tree: symptom → diagnosis → intervention → cost → risk
61. Capstone: full scaling plan for a realistic system, RFC-form, defensible

**Scaling exclusions:** re-teaching engine internals (links to Modules 01/03/05) · Kafka internals in full depth (a future module) · data engineering / warehouse modelling (Kimball/Inmon) · ML feature stores · Spark.

---

# Module 08 — Node.js Internals

**Slug:** `node`
**Premise:** Not JavaScript. You know JS. This is the *runtime* — how it's built, how it runs, how it breaks, how it scales, and everything around operating it at Staff level.
**Capstone:** Build a Node-like runtime shell + a native addon + a production-grade service with full observability.

### Part 1 — What Node Actually Is
1. The 2009 origin: Ryn Dahl, the C10K problem, why the answer was an event loop
2. The architecture diagram: JS → Node bindings → V8 + libuv + OpenSSL + zlib + c-ares + llhttp
3. The io.js fork, the foundation, and the governance that produced today's release cadence
4. Release lines: Current / Active LTS / Maintenance — and how to pick for prod
5. Node vs Deno vs Bun — architectural differences, not benchmarks
6. How Node is built: the `configure` + GYP/GN pipeline, what a build produces

### Part 2 — V8, In Depth
7. V8 architecture: Ignition (bytecode), Sparkplug (baseline), Maglev, TurboFan
8. The compilation pipeline, animated: source → AST → bytecode → optimized code
9. **Hidden classes / shapes** and inline caches — animated object transitions
10. Monomorphic → polymorphic → megamorphic, and the code that causes each
11. Deoptimization: the triggers, and reading `--trace-deopt`
12. **Garbage collection**: generational, scavenger, mark-compact, concurrent/incremental marking
13. Orinoco, Oilpan, and what "concurrent GC" really costs
14. Heap layout: new space, old space, large object space, code space
15. Reading `--trace-gc`, heap snapshots, and the three-snapshot leak technique
16. V8 flags worth knowing: `--max-old-space-size`, `--jitless`, `--no-opt`, and the rest
17. Snapshots and code cache — how Node starts fast
18. Pointer compression, and the memory implications

### Part 3 — libuv & The Event Loop, For Real
19. libuv architecture: the loop, handles, requests
20. **The seven phases**: timers, pending callbacks, idle/prepare, poll, check, close (animated, step-through)
21. The poll phase's blocking calculation — the part everyone gets wrong
22. `process.nextTick` queue vs microtask queue vs phase queues — exact ordering, animated
23. Platform IO: epoll (Linux), kqueue (BSD/macOS), IOCP (Windows), io_uring's status
24. **The threadpool**: what actually uses it (fs, dns, crypto, zlib), `UV_THREADPOOL_SIZE`
25. Why DNS is a threadpool surprise, and `dns.resolve` vs `dns.lookup`
26. Blocking the loop: detection, measurement (`perf_hooks` ELU), and the fixes
27. Event loop utilization as a production metric
28. Timers: the timer list implementation, drift, and why `setTimeout(0)` isn't 0

### Part 4 — Streams, Buffers, and Backpressure
29. Buffer internals: `ArrayBuffer`, pooling, `Buffer.allocUnsafe` and when it's dangerous
30. Typed arrays, `SharedArrayBuffer`, and zero-copy patterns
31. Stream types and the internal state machines
32. **Backpressure** — the highWaterMark mechanism, animated
33. `pipeline` vs `pipe` and error propagation
34. Web Streams vs Node Streams, and the interop layer
35. Async iterators over streams
36. Building a custom Duplex/Transform correctly
37. Stream performance: chunk sizes, object mode cost

### Part 5 — Modules, Loading, and Bootstrap
38. Node's bootstrap sequence, from `main()` to your first line
39. CommonJS: the module wrapper, resolution algorithm, cache, circular deps
40. **ESM**: resolution, the phases (link/instantiate/evaluate), TLA
41. The dual-package hazard and `exports`/`imports` maps
42. Loaders and `module.register` — customizing resolution
43. Startup performance: the require waterfall, snapshots, `--cpu-prof` on boot
44. Bundling for the server: when it helps, SEA (single executable apps)

### Part 6 — Native Layer & Extending Node
45. The binding layer: how a JS call reaches C++
46. N-API / node-addon-api — the ABI stability contract
47. Writing a native addon end to end
48. `node-gyp`, prebuilds, and the install-time pain
49. **WASM in Node**: when it beats a native addon
50. FFI options and their tradeoffs
51. Embedding Node in another application

### Part 7 — Concurrency & Multi-Core
52. The single-thread myth, precisely corrected
53. **Worker threads**: the model, message passing, structured clone cost
54. `SharedArrayBuffer` + `Atomics` for real shared state
55. `cluster` and the SO_REUSEPORT question
56. Child processes: spawn/exec/fork, stdio, and the zombie problem
57. Choosing: cluster vs workers vs processes vs containers (decision matrix)
58. Thread-safe native addons

### Part 8 — Networking & API Design in Node
59. The net/http stack: llhttp, the parser, keep-alive, the Agent
60. **HTTP/1.1 vs HTTP/2 vs HTTP/3** in Node, and what each gives you
61. Undici: architecture, connection pooling, why it replaced the old client
62. TLS in Node: handshake cost, session resumption, ALPN, cert handling
63. WebSockets in Node: `ws` internals, permessage-deflate, scaling them
64. SSE, long-polling, and choosing a transport
65. **API design at Staff level**: resource modelling, versioning, pagination, idempotency, errors
66. Framework internals compared: Express, Fastify, Hono, Nest — the router and the middleware cost
67. Routing algorithms: linear vs radix tree, and why Fastify is faster
68. Validation and serialization cost (and why Fastify's schema serializer wins)
69. Rate limiting, timeouts, retries, circuit breakers — the client-side resilience set
70. Graceful shutdown done correctly (the part most services get wrong)

### Part 9 — Databases From Node
71. Driver internals: how `pg` and `mysql2` speak the wire protocol
72. **Connection pooling from Node**: sizing maths, pool-per-process, and the total-connections trap
73. Prepared statements through a pool, and where they break
74. Query pipelining and batching
75. Handling failover in a driver, and the retry-safety question
76. Transactions across async boundaries, and `AsyncLocalStorage` for context
77. Query optimization from the app side (links to Modules 01–03)
78. Caching layers in Node: in-process LRU vs Redis, and the invalidation

### Part 10 — Performance Engineering
79. Benchmarking honestly: `autocannon`, `mitata`, statistical significance
80. **CPU profiling**: `--cpu-prof`, `--prof` + tick processor, Chrome DevTools, flamegraphs
81. `perf` + Linux flamegraphs including the JIT frames
82. Memory profiling: heap snapshots, allocation timelines, retainer paths
83. Finding leaks: the common five causes with reproductions
84. `--inspect` and production-safe debugging
85. Diagnostic reports, `diagnostics_channel`, trace events
86. Optimization techniques: object shape stability, avoiding megamorphism, string handling, JSON cost
87. When to reach for a native addon or WASM — with the measurement that justifies it

### Part 11 — Running Node in Production
88. The container story: base images, distroless, signals, PID 1, `--init`
89. Memory limits: container limits vs `--max-old-space-size` (the OOMKill everyone hits)
90. Process managers: PM2 vs systemd vs the orchestrator
91. Deployment topologies: VM, container, serverless, edge — what breaks in each
92. Serverless Node: cold starts, frozen event loop, connection reuse
93. Edge runtimes and the API subset problem
94. Health checks, readiness vs liveness, and shedding load
95. Zero-downtime deploys and in-flight request draining

### Part 12 — Observability
96. Logging: structured, levels, sampling, and the cost of `console.log`
97. **OpenTelemetry in Node**: auto-instrumentation internals, context propagation, how it hooks modules
98. Metrics: RED/USE, custom metrics, the event loop metrics that matter
99. Distributed tracing across async boundaries
100. Error tracking, source maps, and unhandled rejection policy
101. Profiling in production continuously

### Part 13 — Code Quality, Tooling, Testing
102. The toolchain landscape: tsc, esbuild, swc, Rolldown, Rspack — what each actually does
103. TypeScript in Node: `tsc` vs transpile-only, type stripping (Node 22+), and the runtime cost
104. Linting/formatting: ESLint flat config, Biome, oxlint — and enforcing them in CI
105. **`node:test`** internals, vs Vitest vs Jest — the isolation and speed tradeoffs
106. Test strategy: unit / integration / contract / e2e, and what to run where
107. Testcontainers and testing against real databases
108. Mocking at module level and why it's fragile
109. Coverage: c8/V8 coverage internals, and what coverage doesn't tell you
110. Property-based testing and fuzzing a Node service
111. Load testing: methodology, not just tooling
112. Monorepo tooling: workspaces, Turborepo/Nx caching internals
113. Dependency health: lockfiles, provenance, `npm audit`'s limits, supply-chain defense
114. **Node security**: the permission model, `--frozen-intrinsics`, prototype pollution, deserialization, SSRF, the Node-specific OWASP set

### Part 14 — Build & Expert Mode (capstone)
115. Build a mini runtime: an event loop over epoll/kqueue + a JS engine binding
116. Build a production service with every lesson applied, load-tested and profiled
117. Reading the Node source: where to start, the directory map, following a call from JS to C++
118. Contributing to Node, and reading a TSC decision
119. 60 Staff-level Node interview questions with model answers
120. War stories: the OOMKill, the blocked loop, the pool exhaustion, the memory leak, the cold-start bill

**Node exclusions:** JavaScript the language (assumed) · frontend/React (covered in your main curriculum) · Deno/Bun internals in depth (comparison only) · npm package authoring/publishing mechanics · specific cloud vendor SDK tutorials · TypeScript the type system as a course.

---

## Build order & state

| Order | Module | Status |
|---|---|---|
| — | `syllabus.md` | ✅ done |
| — | `index.html` shell | ✅ done (+ per-module landing pages) |
| 1 | `mysql` | ✅ **done** — 13 parts, 121 ch, 21 animated diagrams |
| 2 | `sql` | ✅ **done** — 11 parts, 84 ch, 7 animated diagrams |
| 3 | `node` | ⬜ (candidate — highest daily leverage) |
| 4 | `postgres` | ⬜ |
| 5 | `scaling` | ⬜ |
| 6 | `orm` | ⬜ |
| 7 | `theory` | ⬜ |
| 8 | `nosql` | ⬜ |

Order after `sql` is not locked. Pick by what work demands.

---

## Open questions

1. **Capstone language** — defaulted to TypeScript for every build-your-own. Go or Rust would teach more about memory but cost more time. Decide per module.
2. **Verification environments** — each module assumes a local server (mysqld 8.4, postgres 17, cassandra 5, mongo 8, node 24 LTS). A Docker compose per module is worth generating.
3. **Graph databases and Redis** are currently unassigned. Redis fits Module 07 partly; a dedicated caching/Redis module and a graph module are the obvious future additions.
4. **Kafka** is referenced in Module 07 but deserves its own module eventually.
