1. Design a URL Shortener
Create short links, resolve them quickly and handle expiry without sending users to the wrong destination.
Pick a system. Work through the problem. Compare your approach.
Company tags are community-reported. Counts on cards show how many people reported that design.
Create short links, resolve them quickly and handle expiry without sending users to the wrong destination.
Enforce tenant quotas across servers while making burst behavior and outage policy explicit.
Partition cached data, survive node loss and keep cache misses from overwhelming the source of truth.
Deliver email, push and SMS with preferences, retries and honest delivery status.
Send durable messages, reconnect devices and explain ordering and delivery receipts.
Build a paginated feed that handles high-fan-out authors, fresh posts and visibility changes.
Upload and share large files with resumable transfer, versions and safe metadata changes.
Turn uploads into playable renditions and serve viewers through unreliable networks.
Route API traffic with authentication, tenant limits and safe configuration rollout.
Reconcile desired workloads, schedule containers and recover from failed nodes safely.
A read-heavy service sends every request to a database that is slower and more expensive per read than memory, and the same few rows are asked for over and over.
A service commits to its database and then publishes an event. If it dies in between, the row exists and no one hears about it. Publishing first has the mirror problem: an event for a write that never happened. There is no ordering of two independent systems that makes this safe.
Building a timeline when someone opens the app means reading from everyone they follow and merging — slow, and slowest for the most active users. Building it when someone posts makes reads a single lookup, but one post by an account with fifty million followers becomes fifty million writes.
A limit enforced per server is not a limit: ten servers each allowing a hundred requests a minute allow a thousand. And a counter per fixed window lets twice the limit through across a window boundary.
Any request can time out after the server has already acted. The client cannot tell that from a request that never arrived, and the only safe response to uncertainty is to retry — which, without help, charges the card twice.
Millions of future actions — reminders, retries, expiries — must fire near their due time. Scanning everything every minute does not scale, and an in-process timer dies with the process.
To push a message to someone you must find the one server out of hundreds that currently holds their connection — and connections are long-lived, unevenly distributed, and disappear without warning.
Finding the nearby members of a set that is constantly moving. A table scan with a distance function is hopeless at any scale, and a stale position is worse than none — it sends a car to someone who left ten minutes ago.
Scarce inventory — a seat, a room, the last unit — with far more buyers than units. Holding a database row for the minutes someone takes to pay does not scale, and checking availability before writing is a race that sells the same seat twice.
Streaming multi-gigabyte uploads through application servers wastes the most expensive capacity in the system on copying bytes, and ties up a request for minutes on a connection that may drop.
Google Calendar-style events with recurrence, RSVPs and on-time reminders, using CDC for change notifications and a delay queue for reminders.
Count every ad click once, fast enough to chart live and exactly enough to bill. One-hour interview boards for junior, senior and staff: requirements, data layer, low-level design and what goes wrong at every component.
The classes and code behind the ad click aggregator: signed click tokens, a redirect that never waits on the log, and a stream counter that de-duplicates and handles late clicks. Tests run all of it.
Collect 5 million samples a second from 500,000 hosts, store them as time series, chart them and page people.
The K most-viewed videos for the last hour, day, month and all time from 700,000 views a second, exactly and in milliseconds.
Watch prices on 500 million products with a polite crawler and a million browsers, verify what you are told, and notify subscribers within minutes of a drop.
Run 10,000 jobs a second within two seconds of their time, at least once, with retries, fairness between tenants and exactly-once effects.
Ten billion pages in five days, politely, without losing progress: fetchers and parsers, domain locks, bandwidth math, deduplication and a crawl that stays fresh. One-hour boards for junior, senior and staff.
Run strangers' code safely in single-use microVMs, return verdicts within 5 seconds, and rank 100,000 contestants live.
Hold seats with one conditional write, pay by authorize and capture, and put ten million fans in a fair waiting room without selling a seat twice.