Design a highly available distributed service that compresses long URLs into 7-character aliases and redirects users with sub-10ms latency.
Sandbox
System Design
Drag real components — CDNs, load balancers, caches, queues, sharded databases, inference tiers — onto a canvas to solve classic scale problems, then get a Socratic review of your diagram.
- challenges
- 66
- sections
- 12
- patterns
- 246
- components
- 35
Foundations & Core Patterns
8The primitives every other design reuses — hashing, ID generation, throttling, and failure isolation.
Design a low-latency API rate-limiting tier that protects downstream microservices from traffic spikes, DDoS, and noisy neighbors across global regions.
Design a service that hands out 64-bit, roughly time-ordered, globally unique identifiers without a central database sequence becoming a bottleneck.
Design the routing layer that maps billions of keys onto a changing set of storage nodes, so that adding or losing a node moves the minimum possible data.
Design the failure-isolation layer that stops one slow downstream dependency from consuming every thread and cascading into a full-site outage.
Design the mechanism that lets a client safely retry any mutating request — after a timeout, a crash, or a duplicate webhook — without the effect happening twice.
Design the single front door for a microservice fleet: authentication, routing, aggregation, and versioning, without becoming the bottleneck or the outage.
Design the cluster membership layer: services find each other as instances come and go, and exactly one instance holds a leadership lease at any moment.
Caching & Content Delivery
4Read paths that never reach the origin: edge caches, cache-aside, invalidation, and stampede control.
Design a global edge network that serves static and cacheable dynamic content from a PoP near the user, while keeping the origin from ever seeing the traffic.
Design the in-memory tier itself: how keys are partitioned across nodes, what gets evicted, and what happens to correctness when a node disappears mid-traffic.
Design the read path for an API with a 100:1 read-to-write ratio, where the hard part is not caching — it's deciding when a cached value stops being true.
Design where login state lives for a multi-region app: fast enough to check on every request, revocable within seconds, and surviving a region loss.
Data, Storage & Consistency
8Replication, partitioning, transactions across services, and choosing what to give up under CAP.
Design an always-writable key-value store that survives node and datacenter loss, resolves concurrent writes, and repairs its own divergence in the background.
Design how a single Postgres primary that has run out of headroom becomes a sharded fleet — including the migration, the cross-shard queries, and the failover story.
Design a booking flow that spans payment, inventory, and notification services, where there is no shared transaction to roll back — only compensations you have to write yourself.
Design a system whose source of truth is an append-only event log, with read models projected from it — and work out what that costs when a projection is wrong.
Design the pipeline that keeps a search index, a cache, and a warehouse in step with the primary database — without any service dual-writing to both.
Design durable blob storage for exabytes of immutable objects: how bytes are placed, how eleven nines of durability is achieved, and where the metadata lives.
Design a system that accepts writes in three regions at once, keeps them converging, and survives losing an entire region — deciding explicitly what CAP property to give up.
Design storage for a billion metric points an hour: append-only writes, range queries over arbitrary windows, and a cardinality problem that will eventually try to kill you.
Messaging & Event-Driven
5Queues, brokers, fanout, scheduling, and getting delivery guarantees you can actually reason about.
Design the broker itself: a partitioned, replicated, append-only log that guarantees ordering within a partition and lets consumers rewind.
Design one-to-many event distribution where a single publish reaches hundreds of independent subscribers, each of whom may be slow, broken, or temporarily gone.
Design cron for a fleet: recurring and one-off jobs that fire close to on time, exactly once, and keep firing when the node that owned them disappears.
Design outbound event delivery to customer-controlled HTTP endpoints — the ones that are slow, occasionally down, sometimes malicious, and always someone else's problem to fix.
Design one service that delivers push, SMS, email, and in-app notifications — with user preferences, quiet hours, deduplication, and third-party providers that fail independently.
Real-Time & Collaboration
5Persistent connections, presence, conflict resolution, and sub-second state shared between users.
Design a scalable real-time messaging architecture supporting 1-on-1 chats, group channels, online presence, and offline push notifications.
Design concurrent editing where twenty people type into the same paragraph at once, every client converges on the same document, and nobody's keystroke is lost.
Design live broadcast at scale: a streamer's RTMP ingest becomes an adaptive ladder delivered to millions of viewers within seconds, with synchronized chat.
Design the green dot: who is online, who is typing, and who just disconnected — for hundreds of millions of users whose connections drop without warning.
Design the authoritative simulation for a competitive game: tick-rate state sync, lag compensation, cheat resistance, and matchmaking that fills lobbies fast and fairly.
Search, Ranking & Discovery
5Crawling, inverted indexes, autocomplete, top-K streams, and recommendation serving.
Design a polite, distributed crawler that fetches billions of pages, never re-crawls the same URL twice, and revisits pages at a rate matched to how often they change.
Design the query side of search: an inverted index sharded across hundreds of nodes, scatter-gather retrieval, and ranking that runs in tens of milliseconds.
Design suggestions that appear as the user types: a keystroke-latency budget, a precomputed prefix structure, and a ranking that reflects what people searched for an hour ago.
Design real-time trend detection over a firehose: find the top 100 rising terms in the last 5 minutes without counting every term exactly.
Design the serving path for recommendations: narrow millions of items to a few hundred candidates, rank them with a model, and do it in under 100ms per request.
Geo, Maps & Marketplaces
5Spatial indexing, live location streams, and matching supply to demand in a moving market.
Design the matching core: millions of drivers streaming location updates, riders requesting nearby cars, and a dispatch decision that must be made in seconds and never double-assign.
Design 'what's near me' over hundreds of millions of mostly-static places: radius search, category filters, and ranking, at read volumes that dwarf the write rate.
Design a three-sided marketplace where an order's success depends on a restaurant, a courier, and a customer staying in sync through a multi-stage, failure-prone workflow.
Design inventory where overselling is unacceptable: holds that expire, searches across a huge date-and-price space, and a payment step that happens after the seat is already claimed.
Design turn-by-turn routing over a continental road graph: precomputed shortcuts, live traffic that changes edge weights, and map tiles served from the edge.
Commerce, Payments & Ledgers
6Money movement where correctness beats availability — idempotency, reconciliation, and flash-sale contention.
Design money movement where a duplicate charge is a headline: idempotent charge requests, asynchronous provider webhooks, and daily reconciliation against the processor's ledger.
Design the accounting core: an immutable journal where every transfer balances to zero, balances are derived rather than stored, and no concurrent transfer can overdraw an account.
Design cart-to-order for a large catalog: persistent carts across devices, inventory counts that are read constantly and decremented atomically, and checkout that survives partial failure.
Design for the worst traffic shape there is: a million people hitting one endpoint at 10:00:00 for fifty thousand seats, each of which may be sold exactly once.
Design click ingestion and near-real-time aggregation where the numbers are billed: deduplicated events, late arrivals, fraud filtering, and a batch layer that corrects the stream.
Design recurring revenue: metered usage aggregated per customer, plan changes prorated mid-cycle, invoices generated on schedule, and failed payments retried without losing the customer.
Media & Large-Scale Files
4Multi-gigabyte uploads, transcoding pipelines, chunked sync, and adaptive delivery.
Design an end-to-end video upload, transcoding, and adaptive bitrate streaming platform capable of delivering HD content to global audiences.
Design multi-device file sync: content-addressed chunks, delta uploads for a one-byte edit in a 2 GB file, and a conflict story for two devices editing offline.
Design the path from a user's camera roll to a fast-loading image: direct upload, validation, derivative generation, format negotiation, and edge delivery.
Design uploads that survive a two-hour transfer on a flaky connection: parts uploaded in parallel, verified independently, and resumable from where the client stopped.
Platform & Infrastructure
6The systems that run the other systems: metrics, tracing, deploys, config, and identity.
Design the system that tells you the other systems are broken: metric collection from a huge fleet, rule evaluation at interval, and alert routing that doesn't page ten people for one outage.
Design centralized logs and traces for a microservice fleet: ship, buffer, index, and search terabytes a day, with trace context that survives every network hop.
Design build and release for a large monorepo: a scheduler that only rebuilds what changed, ephemeral runners, artifact promotion, and deploys that roll back on their own.
Design runtime configuration that changes behaviour in seconds without a deploy — evaluated locally at nanosecond cost, and safe when the config service is unreachable.
Design identity for a platform: login, token issuance, permission checks on every request, and revocation that actually takes effect before the token expires.
Design how a build reaches a hundred thousand machines across every region: efficient artifact distribution, staged waves gated on health, and a rollback that beats the outage.
AI / ML Infrastructure
5Inference serving, retrieval, embeddings, and feature pipelines — the architecture, not the modelling.
Design the serving tier for models on expensive accelerators: request batching, version rollout, autoscaling that accounts for cold starts, and a fallback when the GPU pool is saturated.
Design retrieval-augmented generation over documents users own: ingestion and embedding, hybrid retrieval with reranking, and permission filtering that never leaks across tenants.
Design approximate nearest-neighbour search at billion-vector scale: index structure, recall against latency, quantization, and the awkwardness of updating an ANN index in place.
Design a Feature Store
MediumDesign the store that serves the same feature values to training and inference — the layer whose absence produces models that score well offline and fail in production.
Design the in-house front door to several model providers: token-based quotas, per-tenant budgets, caching, failover, and streaming responses that make cancellation meaningful.
Social, Feed & Engagement
5Fanout on write vs read, social graphs, ranking, counters, and the celebrity-user problem.
Design a News Feed (Facebook / X Timeline)
HardDesign the timeline: assemble a personalized, ranked feed in under 200ms for users who follow thousands of accounts, some of which have 100 million followers.
Design a Photo Sharing Service (Instagram)
HardDesign upload-to-feed for photos and short video: derivative generation, metadata storage, feed fanout, and delivery that keeps a mobile scroll smooth on a bad connection.
Design a Social Graph / Follow Service
MediumDesign storage and query for follows, friends, and blocks: bidirectional lookups, friends-of-friends traversal, and accounts with a hundred million edges.
Design a Nested Comment & Voting System (Reddit)
MediumDesign threaded discussion: deeply nested replies, live vote counts, multiple sort orders, and a hot thread where ten thousand people comment in the same minute.
Design a Real-Time Leaderboard
MediumDesign global and per-segment rankings that update live for millions of players, answering both 'top 100' and 'what is my rank' without scanning the whole set.