Design a URL shortener
The classic warm-up, and the one candidates most often answer shallowly. This works it in interview order — requirements, numbers, id generation, storage, the read path, then the parts that decide the grade: expiry, custom aliases, analytics that don't slow the redirect, and abuse.
What you'll be able to do
- Size the system from a stated read:write ratio and derive the storage and QPS budget
- Compare counter-based, hash-based, and random id generation on collision, enumerability, and coordination cost
- Implement base62 encoding and a block allocator that issues unique ids without per-request coordination
- Keep the redirect path fast while still recording analytics, and say what breaks under abuse
Before this: back-of-the-envelope, consistent-hashing
The rest of this lesson is in the app
The classic warm-up, and the one candidates most often answer shallowly. This works it in interview order — requirements, numbers, id generation, storage, the read path, then the parts that decide the grade: expiry, custom aliases, analytics that don't slow the redirect, and abuse. This walkthrough runs about 28 minutes, with runnable code you can edit and re-run as you read.
Continue in ChannelPulseThe first module of every track is free to read on the web — see what's open in System design.