SystemKit

URL Shortener

A small system with real decisions: how to generate short codes, which redirect status to return, how to serve heavy reads, and how to stop abuse. A good first full design.

Lessons

  1. 01Define the promise and estimate demandA tiny link hides a read-heavy system with a durable mapping.
  2. 02Design creation and lookup togetherThe creation response must leave a durable mapping for every later redirect.
  3. 03Choose redirect and expiry semanticsHTTP status codes determine who sees future clicks and how failures appear.
  4. 04Generate keys without collisionsThe key-space must fit demand, and concurrent creation must preserve uniqueness.
  5. 05Make the read path cheapMost traffic resolves existing keys, so optimize lookup without making cache the source of truth.
  6. 06Plan for failure and misuseA redirect service must remain trustworthy when dependencies fail or attackers create links.

Practice this chapter

  1. TaskDesign a code-snippet sharing serviceMove from short links to a product where the stored value is large, most of it expires, and some links must stay secret.