Skip to content
whiteboard.tools

URL shortener system design diagram

The classic interview question: write path, cached read path and asynchronous analytics.

Use this template
ClientLoad balancerAPI serversID generatorCacheKey-value storecode → long URLClick queueAnalytics workerAnalytics storenew codelookupon misswriteclick event
URL shortener system design diagram. Every shape, label and arrow is editable once it is on your board.

About this template

Designing a URL shortener is a standard system design exercise because it is small enough to finish and still forces the important decisions: how short codes are generated, how a read-heavy workload is served, and how click analytics are collected without slowing redirects.

This template draws one reasonable answer. Redirects read from a cache first and fall back to a key-value store. Creating a link asks an ID generator for a unique code. Click events go onto a queue so the redirect returns immediately.

What is in the diagram

API servers
Stateless. They handle both creating short links and redirecting.
ID generator
Produces unique IDs that are base62-encoded into short codes, avoiding collisions without a lookup.
Cache and key-value store
Redirects far outnumber new links in this workload, so the most requested codes are kept in memory.
Click queue and worker
Analytics are eventually consistent by design; losing a redirect is worse than a late count.

Further reading

More software architecture templates