System Design Library
How well-known systems are put together, as walkthroughs you can play. Press play and watch a request travel through the services, queues and databases, with the reasoning written beside each step. Found one you want to change? Remix it into your own workspace, free.
Learning explainers based on public engineering writing and general design practice: simplified, not any company's actual architecture, and possibly inaccurate.
Web fundamentals14 walkthroughs
- URL shortenerHow a link shortener creates unique short keys, serves redirects from a cache in a few milliseconds, and counts clicks off the redirect path.
- Distributed rate limiterHow an API rate limiter shares token buckets across gateways, answers 429 with a retry hint, fails safely and sheds load when the system is stressed.
- Distributed cacheHow a distributed cache places keys with consistent hashing, replicates shards, evicts entries, invalidates on writes and resists stampedes.
- Web crawlerHow a large-scale web crawler manages a URL frontier, stays polite per host, filters duplicate URLs and pages, and decides when to revisit.
- Search autocomplete (typeahead)How search autocomplete answers in milliseconds: prefix indexes, caching, offline ranking from query logs, trending queries and policy filtering.
- API gatewayHow an API gateway authenticates, rate-limits and routes every request to healthy backends, with config pushed from a separate control plane.
- Load balancerHow a two-tier load balancer spreads traffic with ECMP and consistent hashing at L4, then balances each request at L7 using health checks.
- Distributed key-value storeHow a Dynamo-style key-value store places keys on a hash ring, replicates them with tunable quorums, and repairs replicas that fall behind.
- Distributed unique ID generatorHow a distributed ID generator packs a timestamp, worker id and sequence into 64 bits so ids are unique and roughly time-ordered.
- PastebinHow a pastebin stores text in object storage behind a small metadata table, serves reads from a CDN and cache, and expires pastes on time.
- Message queueHow a partitioned, replicated log stores messages durably, keeps them ordered per key, and lets consumer groups read at their own pace.
- Distributed job schedulerHow a distributed job scheduler turns cron schedules into runs, shares work with row locks, and retries jobs safely when workers fail.
- Distributed lock serviceHow a distributed lock service grants locks through a consensus log, frees them with expiring leases, and uses fencing tokens to stop stale holders.
- Multi-region active-active setupHow an active-active setup serves users from several regions at once, replicates data asynchronously, and picks a consistency model per data type.
Marketplaces6 walkthroughs
- Ride-hailing platformHow a ride-hailing platform streams driver locations, matches a rider to a nearby driver, prices the trip with surge, and takes payment.
- Ticket booking with seat reservationHow a ticketing system sells each seat once under heavy demand: waiting room, cached seat map, time-limited holds, conditional updates and safe payment.
- E-commerce checkout and inventoryHow an online store turns a cart into an order: stock reservation, idempotent payment, a saga with compensation, and reliable order events.
- Food delivery platformHow a food delivery platform runs each order as a durable state machine, tracks couriers in a geo index, and times dispatch to when food is ready.
- Hotel booking systemHow a hotel booking system searches cached availability, books every night of a stay in one transaction, and holds rooms while payment completes.
- Online auctionHow an online auction serializes concurrent bids with conditional updates, streams price changes to watchers, and closes auctions on time.
Messaging & social5 walkthroughs
- WhatsApp-style chat appHow a chat system holds millions of persistent connections, routes end-to-end encrypted messages, and falls back to push when users are offline.
- Notification system at scaleHow a notification platform validates requests, applies user preferences, queues by priority, and delivers push, SMS and email with retries and fallbacks.
- Social news feed (Twitter-style timeline)How a social feed pushes posts into follower timelines, handles accounts with millions of followers by merging at read time, and ranks the result.
- Twitter-style timeline systemHow a timeline system fans tweets out to followers' cached timelines, pulls in large accounts at read time, and serves a home feed from cache.
- Chat application (1:1 and group)How a chat app keeps a WebSocket per online user, orders and stores messages per channel, and lets reconnecting clients catch up from history.
AI applications8 walkthroughs
- RAG chatbot over your docsHow a retrieval-augmented chatbot ingests company documents, retrieves permitted passages with hybrid search and reranking, and answers with citations.
- AI agent platform with toolsHow an AI agent platform runs a model-and-tools loop on workers, checkpoints each step, scopes tools to the user, and pauses risky actions for approval.
- LLM gateway and routerHow an LLM gateway gives every team one API, enforces token limits and budgets, routes to the right model, and falls back when a provider fails.
- Semantic search with embeddingsHow semantic search embeds passages into a vector index, runs keyword search alongside it, fuses both rankings, and reranks the top results.
- Recommendation systemHow a recommendation system retrieves thousands of candidates from millions of items, ranks them with a model, and filters for freshness and diversity.
- ML feature storeHow a feature store computes features once, keeps timestamped history for point-in-time training sets, and serves the latest values to live models.
- Model inference servingHow a model serving platform batches requests on CPUs and GPUs, manages the LLM KV cache, scales GPU capacity from queue depth, and canaries versions.
- AI code review botHow an AI code review bot queues pull request webhooks, gathers diff context in a sandbox, verifies model findings, and posts inline comments.
Media & streaming7 walkthroughs
- Netflix-style video streamingHow a streaming service encodes each title into many bitrates, caches it near viewers on a CDN, and personalises what each person sees.
- Video sharing platform (YouTube-style)How a video platform takes resumable uploads, encodes segments in parallel into several renditions, and serves them via a CDN with adaptive bitrate.
- Photo sharing platformHow a photo sharing platform takes uploads straight to object storage, resizes them in the background, and builds follower feeds from cached post ids.
- Content delivery networkHow a CDN routes users to a nearby PoP, serves cached copies, shields the origin with a regional tier, and purges content worldwide in seconds.
- Video conferencingHow a video conferencing system connects clients with WebRTC, forwards streams through an SFU, and adapts quality to each viewer's bandwidth.
- Music streaming serviceHow a music streaming service pre-encodes tracks into encrypted segments, checks rights before playback, and turns play events into royalties.
- Live streaming platformHow a live streaming platform ingests one creator stream, transcodes it in real time, and serves short HLS segments to large audiences via a CDN.
Payments3 walkthroughs
- Stripe-style payments platformHow a payments platform tokenises cards, authorises a payment through the card networks, records it in a ledger, and settles funds to merchants.
- Stock trading platformHow a trading platform sequences every order into a deterministic in-memory matching engine, replicates it by replay, and settles trades separately.
- Digital walletHow a digital wallet records every movement in a double-entry ledger, makes retries safe with idempotency keys, and reserves funds for withdrawals.
SaaS & data8 walkthroughs
- Multi-tenant SaaS analytics pipelineHow a SaaS product collects events from many customers, keeps each tenant's data isolated, and serves fast dashboards from a columnar store.
- Metrics and monitoring systemHow a monitoring system scrapes metrics from every service, alerts through grouped and routed notifications, and keeps years of data in object storage.
- Log aggregation pipelineHow a log pipeline collects lines from every host, buffers them in a topic, indexes only labels, and keeps compressed text in object storage.
- Time-series databaseHow a time-series database appends samples behind a write-ahead log, compresses them into immutable blocks, and answers range queries by label.
- Feature flag serviceHow a feature flag service publishes rule snapshots that SDKs evaluate locally, rolls out by stable user buckets, and pushes kill switches in seconds.
- Data warehouse ingestion pipelineHow a data pipeline captures database changes, API records and events, lands them in lake tables, and builds tested warehouse models with SQL.
- CI/CD pipelineHow a CI/CD pipeline builds and tests each commit on ephemeral runners, signs artifacts, and rolls out to production in metric-checked canary steps.
- Authentication and SSO serviceHow an SSO service signs users in once with MFA and federation, issues short-lived signed tokens via OpenID Connect, and revokes access when needed.
Storage & collaboration2 walkthroughs
- File sync and storage (Dropbox-style)How a file sync service chunks and hashes files, uploads only missing blocks, orders changes in a journal and keeps every device in step.
- Real-time collaborative document editingHow collaborative editors keep several people's edits in sync: ordering operations, OT versus CRDT, snapshots and live cursors.
Gaming & realtime3 walkthroughs
- Real-time leaderboardHow a real-time leaderboard ranks millions of players with in-memory sorted sets, takes scores only from game servers, and rolls boards over by season.
- Maps and navigationHow a maps system serves vector tiles from a CDN, routes over a preprocessed road graph with live traffic weights, and builds traffic from GPS traces.
- Multiplayer game backendHow a multiplayer game backend matches players by skill and latency, runs each match on an authoritative server, and processes results afterwards.