Skip to main content

Labs

12 from-scratch builds

Every lab builds one system from the catalog. Read its bill of materials first, then run the code.

  • Load Balancer From Scratch

    A tiny L7 request router with health checks, round-robin routing, least-connections routing, and forwarded request metadata.

    Real-world system · Build a load balancer

    JavaScript · starter · 3 files

  • Consistent Hashing Ring

    A readable hash ring with virtual nodes and binary-search lookup, the core primitive behind cache and storage routing.

    Real-world system · Build a consistent hash ring

    TypeScript · starter · 3 files

  • Bloom Filter Membership

    A compact membership filter that can reject misses cheaply while accepting a controlled false-positive rate.

    Real-world system · Build a Bloom filter

    TypeScript · starter · 3 files

  • Tiny Search Engine

    A small inverted index with tokenization, posting lists, and a BM25-style ranking pass.

    Real-world system · Build a search index

    TypeScript · intermediate · 5 files

  • Sliding Window Rate Limiter

    An in-memory limiter that stores recent request timestamps per key and computes allow, remaining, and retry-after decisions.

    Real-world system · Build a rate limiter

    TypeScript · starter · 3 files

  • Lease Leader Election

    An in-memory lease sketch with expiry and increasing tokens; its permission precheck does not fence a later storage effect.

    Real-world system · Build lease-based leader election

    JavaScript · starter · 4 files

  • Write-Ahead Log

    A teaching store that writes JSONL log records before updating memory and replays a valid prefix after process interruption.

    Real-world system · Build a write-ahead log

    JavaScript · starter · 4 files

  • Gossip Protocol

    A push-pull gossip simulation where nodes sample peers, exchange versioned records, and converge without broadcasting to everyone.

    Real-world system · Build a gossip protocol

    JavaScript · starter · 4 files

  • TTL Cache Reaper

    An in-memory TTL cache that stores absolute expiry timestamps, enforces lazy expiration on reads, and reclaims memory with active sweeps.

    Real-world system · Build a TTL cache reaper

    JavaScript · starter · 3 files

  • LRU Cache

    A small least-recently-used cache where reads refresh recency and full-capacity writes evict the oldest entry.

    Real-world system · Build an LRU cache

    JavaScript · starter · 3 files

  • Snowflake ID Generator

    A compact Snowflake-style generator that packs timestamp, worker id, and per-millisecond sequence fields into one sortable integer.

    Real-world system · Build a distributed ID generator

    JavaScript · starter · 3 files

  • Keyset Pagination Cursors

    An ordered in-memory dataset showing how cursor predicates resume after the last seen row while offset pagination can drift after inserts.

    Real-world system · Build cursor pagination

    JavaScript · starter · 3 files