Diagramium
🔗 Narrated diagram

How a URL shortener works

The classic system-design interview favorite — clients, API, cache, database and analytics — explained step by step with narration.

8 steps1 min readNarrated with a studio voice
How a URL shortener worksHTTPSPOST /shortenGET /abc123store linklookupon missclick eventbatch loadA browser or desktop client🖥️BrowserSpreads traffic across instances⚖️Load balancerA microservice or backend service⚙️Shorten APIA microservice or backend service⚙️Redirect serviceAn in-memory cache such as RedisRedis cacheA relational or NoSQL databaseLinks databaseA queue or event bus for async messaging📨Click events queueA relational or NoSQL databaseAnalytics warehouse
How a URL shortener works — the complete diagram. Press Present to watch it build itself.
Step 1 of 8

Browser

This is the system behind every short link you have ever clicked. It starts, as always, with the browser.

Step 2 of 8

Load balancer

A load balancer is the front door. It spreads millions of requests across many identical servers so no single machine drowns.

Step 3 of 8

Shorten API

The shorten API takes a long URL and mints a short code — usually six characters of letters and digits, which gives fifty-six billion combinations.

Step 4 of 8

Redirect service

The redirect service does the opposite job: given a short code, find the long URL and answer with a redirect — in under ten milliseconds.

Step 5 of 8

Redis cache

Redis keeps the most popular links in memory. Ninety percent of clicks hit a tiny fraction of links, so the cache absorbs almost everything.

Step 6 of 8

Links database

The database is the source of truth. Every code and its destination lives here, replicated so nothing is ever lost.

Step 7 of 8

Click events queue

Every click also drops an event onto a queue. The redirect never waits for analytics — that is the secret to staying fast.

Step 8 of 8

Analytics warehouse

A worker drains the queue into the warehouse, where dashboards count clicks by country, device and hour. And that is the whole system.

Watch it explain itself

Every step above is narrated aloud. Play it, or open it in the editor and make it yours — no account needed.