Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Practice build · Servers and backend infrastructure

Build your own CDN

A small content delivery network on your laptop: nginx and Lua edge caches in front of an origin, with cache keys, load balancing and metrics.

  • Advanced
  • About 10–20 h
  • 5 checkpoints
  • 1 tutorial · Lua

Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.

Choose a tutorial

Why build it

A CDN is a cache with geography. Building one with containers shows how cache keys, TTLs and the thundering-herd problem drive latency and origin load.

You will be able to

  • Configure edge caching with TTLs and cache keys.
  • Measure hit ratio, latency percentiles and origin load.
  • Protect the origin from a thundering herd with request coalescing.
  • Spread objects across edges with consistent hashing.

Skills it exercises

Recommended on System Design.

Checkpoints

How you know you are there

Work in any language. Each checkpoint ends with something you can run or observe, so you can check it yourself.

  1. Checkpoint 1Self-check

    Origin and edge

    Done when: An edge in front of the origin serves repeat requests from cache, and a response header shows HIT or MISS.

  2. Checkpoint 2Self-check

    Cache control

    Done when: The edge honours the origin's Cache-Control max-age, and normalising the cache key (for example dropping tracking parameters) raises the hit ratio in a test.

  3. Checkpoint 3Self-check

    Metrics

    Done when: A dashboard or log summary shows hit ratio, latency percentiles and origin requests during a load test.

  4. Checkpoint 4Self-check

    Origin protection

    Done when: With request coalescing, 100 simultaneous requests for an expired object cause a single origin request.

  5. Checkpoint 5Self-check

    Several edges

    Done when: Two or more edges sit behind a balancer that uses consistent hashing, so each object is cached on one edge.

Stretch goals

  • Purge by URL or tag.
  • Serve stale content while revalidating.
Follow a tutorial

Step-by-step guides

Pick one in a language you know (tutorial languages: Lua). They open on the author’s site.

Practice builds are self-paced: Tech Atlas does not track them or count them as evidence. To show a skill, take its knowledge check from the skill page.

Tutorials come from codecrafters-io/build-your-own-x (CC0, snapshot of 2026-07-14, commit aa17439; links checked on 2026-10-19). Each tutorial belongs to its author and keeps its own licence; Tech Atlas links to it and does not host it. Briefs, checkpoints and the mapping to skills are Tech Atlas editorial drafts.