System design examples
System design examples for interviews and real systems: chat, news feed, URL shortener, ride hailing, payments and more. Each part comes with the reason it is there.
- Chat app (Intermediate): Realtime messaging with WebSockets, presence in Redis and messages in a wide-column store.
- News feed (Intermediate): Timeline with fan-out on write, a per-user feed cache and media on a CDN.
- Video streaming (Intermediate): Uploads to object storage, queued transcoding, playback straight from a CDN.
- E-commerce checkout (Advanced): Cart, orders, inventory and payments with idempotency and an outbox.
- URL shortener (first try) (Beginner): One database behind a cache. Runs out of database capacity at 50k rps.
- URL shortener (scaled) (Beginner): Replicated cache at 97% hits and a Multi-AZ primary; survives losing an API instance.
- Search API (Beginner): A small search/create API over Redis and PostgreSQL — good for trying Simulate.
- Analytics platform (Advanced): App API fronting auth, search, metadata and query services with a cloud warehouse.
- RAG chatbot over documents (Intermediate): Hybrid retrieval, reranking and a cited LLM answer, with background chunking and embedding of documents.
- LLM serving platform (Advanced): Token-based limits, a per-model queue, continuously batched GPU workers and autoscaling on queue depth.
- ML feature store & training (Advanced): Shared features computed in batch and streaming, offline lake for training, online store for serving.
- Ticket booking (Advanced): Ticketmaster-style sales with a virtual waiting room and seat holds that expire on their own.
- Payment system with ledger (Advanced): Idempotent payments API, processor routing and an append-only double-entry ledger.
- Flash sale (Intermediate): Limited drop that sells from an atomic Redis counter and writes orders through a queue.
- Hotel & home-stay booking (Intermediate): Geo and date search over a stale-tolerant index, with reservations that lock per-night inventory.
- Stock exchange matching engine (Advanced): Sequencer plus single-threaded, in-memory order books, with trades fanned out to market data and clearing.
- Product catalog & search (Intermediate): Document-store catalog, a change-stream-fed search index, and a retrieve-then-rank search funnel.
- Ad click aggregation (Advanced): Log-then-count clicks with an exactly-once stream aggregator and a raw lake for batch recounts.
- Top-K & leaderboards (Intermediate): Exact leaderboards in Redis sorted sets and approximate trending lists from a count-min sketch.
- Batch + stream data platform (Intermediate): Lambda and kappa side by side: one retained event log feeding a speed layer, a batch layer and a merged query engine.
- Recommendation system (Advanced): Candidate retrieval then ranking online, nearline feature updates, and offline training with precomputed fallbacks.
- Rate limiter (Beginner): Token buckets in Redis checked at the gateway, so no single client can overwhelm the API.
- Pastebin (Beginner): Immutable text snippets under random short keys, served mostly from a CDN.
- Unique ID generator (Intermediate): Snowflake-style, time-sortable 64-bit ids generated on many machines without coordination.
- Web crawler (Intermediate): A polite, deduplicating crawler with a per-host frontier, fetcher fleet and link-extracting parsers.
- Notification system (Beginner): One API for push, email and SMS with preferences, per-channel queues and retries.
- Search autocomplete (Intermediate): Instant typeahead from a precomputed top-k trie, rebuilt offline from query logs.
- Key-value store (Intermediate): Dynamo-style: consistent hashing, three replicas, quorums, hinted handoff and Merkle-tree repair.
- Distributed cache (Intermediate): Sharded memcached behind consistent hashing, with cache-aside reads, delete-on-write and a gutter pool.
- Distributed message queue (Advanced): A Kafka-like partitioned, replicated log with independent consumer groups and tiered storage.
- Object storage (Advanced): S3-like storage: stateless front ends, a sorted key index and erasure-coded data with constant repair.
- Metrics & alerting (Advanced): Buffered metric ingestion into a time-series DB, a cached query tier and deduplicated alerting.
- Centralised logging (Intermediate): Agents ship logs into Kafka; processors redact and enrich; a hot index and cheap archive serve queries.
- Multi-region active-active (Advanced): Two live regions behind geo DNS, each self-sufficient, replicating writes to each other asynchronously.
- CI/CD build system (Intermediate): Event-driven pipelines with a merge queue, ephemeral runners, a remote build cache and canary deploys.
- Ride hailing (Advanced): Uber-style matching over an in-memory hexagon index of drivers, with surge pricing from the location stream.
- Nearby places search (Beginner): Yelp-style read-heavy geo search over geohash cells, with ratings rolled up in the background.
- Maps, routing & tiles (Advanced): Vector tiles from a CDN, routing over a contraction-hierarchy graph, and ETAs from live probe traffic.
- Food delivery dispatch (Advanced): Three-sided marketplace where a batch optimizer assigns couriers using ML prep and travel-time predictions.
- Netflix-style video on demand (Advanced): Cloud control plane, ISP-embedded cache appliances filled off-peak, per-title encoding.
- Spotify music streaming (Intermediate): Byte-range audio from CDNs, a BFF over catalogue and playlists, and an event pipeline for royalties.
- Twitch-style live streaming (Advanced): RTMP ingest at the edge, routed origin transcoding, two-second HLS segments from a CDN.
- Podcast hosting (Beginner): Episode upload and processing, RSS feeds behind a CDN, and IAB-style download counting.
- Google Docs collaborative editing (Advanced): Operational transformation on one owning server per document, with an op log and snapshots.
- Dropbox file sync (Advanced): Content-addressed 4 MB blocks, a metadata journal with cursors, and long-poll change notifications.
- Google Calendar (Intermediate): Recurrence rules expanded on read, free/busy, sync tokens and a reminder scheduler.
- Notion-like workspace (Intermediate): Block data model in workspace-sharded Postgres, optimistic transactions and record subscriptions.
- WhatsApp-style messaging (Advanced): Store-and-forward relay with delivery receipts, E2E key distribution and out-of-band media.
- Slack-style team chat (Advanced): Channel servers on a consistent-hash ring, regional gateway servers and an edge cache for boot.
- Zoom-style video calls (Advanced): WebSocket signalling, an allocator placing meetings on SFUs, UDP media with TURN fallback.
- Multiplayer game backend (Intermediate): Matchmaking and fleet allocation over HTTP, authoritative game servers over UDP.
- Twitter/X home timeline (Advanced): Hybrid fan-out: push tweets into cached timelines, pull celebrity tweets at read time.
- Instagram photo sharing (Intermediate): Early upload, async resizing, sharded PostgreSQL with time-sortable ids and cache-heavy reads.
- Reddit-style forum (Intermediate): Votes through a queue, hot-score ranking computed on write, CDN for logged-out readers.
- TikTok-style recommendation feed (Advanced): Retrieval → ranking funnel with a feature store and a model that retrains on live watch events.
- Live comments (Intermediate): Push comments and reactions to millions of live viewers with SSE and a dispatcher.