URL shortener
TemplatesArchitecture
The classic system-design exercise: a load balancer, separate write and redirect paths, an ID generator, a cache in front of a key-value store, and click analytics off the hot path.
What is inside
- Read path vs write path
- Cache-aside on redirects
- Async click analytics
Use this template
Opens in the playground, no account needed. Sign up to save it.
Show the Inkline text
diagram architecture "URL shortener"
direction right
theme light
client browser "Browser / app"
zone region "Region (multi-AZ)" {
service lb "Load balancer"
group app "App tier" {
service shorten "Shorten API"
service redirect "Redirect API"
}
service idgen "ID generator"
cache hot "Redis cache"
store kv "KV store (code → URL)"
queue clicks "Click events"
fn stats "Analytics worker"
store olap "Analytics DB"
}
browser -> lb : HTTPS
lb -> shorten : POST /shorten
lb -> redirect : GET /{code}
shorten -> idgen : next ID
shorten -> kv : put
redirect -> hot : get
redirect -> kv : on miss
redirect ~> clicks : click
clicks ~> stats : consume
stats -> olap : aggregate