Back to sketch

SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 01

Design a URL shortener

Foundations · 25 min · Caching & read paths

People paste a long link and get back a short one they can put in a message, a slide, or a printed flyer. Most of the work happens later, when strangers click the short link and expect to land on the right page instantly.

Requirements

  • Create a short alias for a valid HTTP or HTTPS URL.
  • Redirect a visitor who opens an existing alias.
  • Return a clear error for an unknown or disabled alias.

Constraints and assumptions

  • 10 million new aliases a month; roughly 100 redirects per alias over its lifetime.
  • Aliases should be at most 8 characters and must never be reused for a different URL.
  • A redirect should feel instant: aim for p99 under 50 ms at the server.
  • Links can be disabled for abuse and must stop working within a minute.

Out of scope for the first sketch

Click analytics · Custom vanity aliases · User accounts and link editing

Draw your design

Rough math and notes

Done on paper? Compare with the worked approaches