Raw Mode · Capstone

Build a high-performance Node.js backend framework

Construct a complete web framework from node:net up, use no node:http anywhere, and tune every measurable cost out of the hot path.

Most Node.js frameworks begin above the connection engine and HTTP parser. This capstone removes that box. You build the layer beneath the framework - a byte-level HTTP/1.1 parser, a radix-tree router, a middleware pipeline, the full application surface, production hardening, and a hot path tuned through measurement until it becomes super blazingly fast. You build it on your own machine, one lesson at a time, and every claim is something you can reproduce.

Start building10 of 23 chapters live · 50 lessons
  1. 01A - It speaks HTTPFreeBytes on the Wire

    The layer that every framework hides from you - raw TCP, and the exact bytes of one HTTP response.

    4 lessons
  2. 02A - It speaks HTTPFreeA Parser That Never Allocates

    Turn a socket's raw bytes into a request object by walking them one at a time. No toString, no split, and no request smuggling.

    6 lessons
  3. 03A - It speaks HTTPLockedTCP Is a Byte Stream

    Every toy server assumes one read is one request. TCP promises nothing of the sort. You remove that assumption, then read a body without ever swallowing the next request.

    5 lessons
  4. 04A - It speaks HTTPLockedAnswering Back

    So far the handler answers by hand-writing socket bytes. This chapter gives it a Response object that frames every answer correctly, exactly once, and a connection that stays open for the next request in line.

    5 lessons
  5. 05B - From server to frameworkLockedThe Radix Tree

    The if-ladder pays for every route it did not match; replace it with a prefix-compressed tree that finds a handler in time proportional to the path, not the route count.

    5 lessons
  6. 06B - From server to frameworkLockedParams, Wildcards, and Method Semantics

    The colon marker matches one segment and hands it back, the star takes the rest, and a method miss is not a path miss.

    5 lessons
  7. 07B - From server to frameworkLockedThe Middleware Onion

    Run ordered application, router, and route middleware before and after a handler, with explicit short-circuiting.

    5 lessons
  8. 08B - From server to frameworkLockedErrors That Don't Crash the Server

    One handler failure may end one response or connection. It must not terminate the Node process.

    5 lessons
  9. 09C - A framework apps can useLockedCookies, Redirects, and Content Negotiation

    Cookies, redirects, and a response that can label its own bytes - the application surface every web app touches.

    5 lessons
  10. 10C - A framework apps can useLockedStreaming Bodies and Backpressure

    Hand the handler the request before the body arrives, decode chunked framing byte by byte, and pause socket reads when a consumer falls behind.

    5 lessons
  11. 11C - A framework apps can useUpcomingBody Parsers and Multipart

    Turn raw body bytes into structured data - JSON, forms, query strings, and multipart uploads that stream to disk.

    In production, unlocks for everyone at once
  12. 12C - A framework apps can useUpcomingStreaming Responses

    Chunked encoding, honest backpressure, and the one streaming spine every later feature reuses.

    In production, unlocks for everyone at once
  13. 13C - A framework apps can useUpcomingStatic Files, Ranges, and Conditional Requests

    Serve files without serving your filesystem - traversal defense, range requests, ETags, and the 304 flow.

    In production, unlocks for everyone at once
  14. 14C - A framework apps can useUpcomingCORS and Compression

    Preflights answered at the middleware layer, origins reflected with Vary discipline, and compression that pays for itself.

    In production, unlocks for everyone at once
  15. 15C - A framework apps can useUpcomingServer-Sent Events, Hooks, and Validation

    Live event streams over plain HTTP, lifecycle hooks with deterministic order, and validators compiled once per route.

    In production, unlocks for everyone at once
  16. 16D - Hardened for productionUpcomingHardening - Limits, Slowloris, and Graceful Shutdown

    Caps on everything, per-phase timeouts that starve slowloris, and a shutdown that drains instead of drops.

    In production, unlocks for everyone at once
  17. 17E - Make it fastUpcomingMeasure First - Benchmarking Discipline and Lazy Headers

    The measurement protocol every number rides on, then the first hot-path win - headers that never become strings.

    In production, unlocks for everyone at once
  18. 18E - Make it fastUpcomingThe Write Path - Cached Date, Precomputed Buffers, One Syscall

    Make the response head nearly free - a per-second date cache, prebuilt status lines, and one syscall per response.

    In production, unlocks for everyone at once
  19. 19E - Make it fastUpcomingCompiling JSON

    A schema-compiled serializer that builds the exact string a route already knows the shape of.

    In production, unlocks for everyone at once
  20. 20E - Make it fastUpcomingHidden Classes and the Monomorphic Pipeline

    Fixed object shapes, monomorphic call sites, and a middleware chain compiled once per route instead of per request.

    In production, unlocks for everyone at once
  21. 21E - Make it fastUpcomingFeeding the GC Nothing

    Pooled request contexts with full-field reset - the hot path stops allocating and the collector goes quiet.

    In production, unlocks for everyone at once
  22. 22F - Prove and scaleUpcomingThe Performance Gauntlet

    Four workloads, a disciplined harness, a correctness gate, and a reproducible performance report.

    In production, unlocks for everyone at once
  23. 23F - Prove and scaleUpcomingEvery Core - SO_REUSEPORT and the Cluster Fallback

    The same hot path on every core - kernel socket sharding where the platform has it, cluster round-robin where it does not.

    In production, unlocks for everyone at once