Case Studies
29 real-world architectures: requirements, capacity estimation, and detailed component design.
Url Shortener
A URL shortener converts a long URL into a short, unique alias and redirects any request for that alias back to the original URL. The design is read-heavy and latency-sensitive, since a shortened link may be resolved millions of times after it is created once.
Distributed Rate Limiter
A distributed rate limiter caps how many requests each client may make in a time window, enforcing that limit consistently across every node of a horizontally scaled service rather than per instance. It protects backends from overload and abuse while adding negligible latency to each request.
Chat And Messaging Service
A chat service delivers messages between users in near real time, supporting one-to-one and group conversations with delivery and read receipts. The central challenge is maintaining persistent, low-latency connections for millions of concurrent users while guaranteeing ordered, durable message delivery.
Social Media News Feed
A news feed service builds each user a personalized, reverse-chronological (or ranked) stream of posts from the accounts they follow. It must ingest a high write volume of posts while serving feed reads with low latency to a much larger read audience.
Notification System
A notification system accepts requests from many internal services and delivers messages to users across multiple channels - push, SMS, and email - while honoring user preferences and avoiding duplicate sends. It must fan a single event out to the right channels reliably and at high throughput.
Ride Sharing Service
A ride-sharing service matches riders requesting trips with nearby available drivers, then tracks the trip in real time until completion. The core challenges are ingesting a continuous stream of driver location updates and answering low-latency geospatial "nearest driver" queries at city scale.
Video Streaming Service
A video streaming service lets users upload, process, and watch video on demand at global scale. The design centers on transcoding uploads into multiple bitrates and delivering the resulting segments from edge locations close to viewers with minimal buffering.
File Storage And Sync Service
A file storage and sync service (think Dropbox or Google Drive) lets users store files in the cloud and keep them synchronized across all their devices. The core challenges are efficient upload/download of large files, detecting changes cheaply, and resolving conflicts when the same file is edited on multiple devices.
Search Typeahead
A search typeahead (autocomplete) service returns the top-ranked query suggestions for whatever prefix a user has typed so far, updating on each keystroke. Because it fires on nearly every character, it must answer in tens of milliseconds at very high read volume.
Distributed Cache
A distributed cache is an in-memory key-value store spread across multiple nodes, designed to serve hot data with sub-millisecond latency and shield backend databases from read load. Think Redis or Memcached deployed as a cluster. The design challenge is keeping data distributed evenly, handling node failures gracefully, and managing cache consistency at scale.
Payment System
A payment system processes financial transactions - charges, refunds, and payouts - across merchants, users, and external payment providers (card networks, banks). The defining challenge is correctness under failure: money must never be lost, duplicated, or charged without authorization. Every design decision is anchored in exactly-once semantics, auditability, and regulatory compliance.
Web Crawler
A web crawler systematically discovers and downloads pages from the web, starting from a set of seed URLs and following links outward, so their content can be indexed by a search engine. The design must be polite to hosts, avoid re-fetching the same page, and scale to billions of URLs.
Collaborative Editor
A collaborative editor lets multiple users simultaneously view and edit the same document in real time, with every participant seeing changes within milliseconds. The central challenge is conflict resolution: when two users type at the same position at the same time, the system must converge to the same document state on every client without losing either user's work.
Distributed Message Queue
A distributed message queue accepts messages from producers, stores them durably, and delivers them to consumers, decoupling the two sides in time and in load. This is a design-a-Kafka question: the defining challenges are durability (never lose an acknowledged message), high throughput (millions of messages per second), horizontal scalability, and configurable ordering and delivery guarantees.
Proximity Service
A proximity service returns businesses or points of interest near a user's location - "coffee shops within 2 km," ranked by distance and relevance. Unlike ride-sharing, the data is mostly read-heavy and slow-changing (a restaurant doesn't move), so the design centers on an efficient, cacheable geospatial index rather than on absorbing a firehose of location updates.
Top K Trending
A top-K system continuously answers "what are the K most frequent items right now" - trending hashtags, most-viewed videos, top search queries, best-selling products. The hard part is scale: you cannot keep an exact counter for billions of distinct items in memory, so the design leans on approximate counting (count-min sketch) for real-time answers and an accurate batch recompute for correctness - a textbook Lambda architecture.
Distributed Job Scheduler
A distributed job scheduler runs tasks at specified times or intervals - cron at scale. It accepts one-off and recurring jobs, guarantees each scheduled run executes (despite worker crashes), scales to millions of jobs, and does not double-run a job just because a node failed mid-execution. The tension is between not missing a run (at-least-once) and not duplicating side effects, resolved with idempotency and careful ownership.
Ticket Booking System
A ticket booking system reserves finite inventory - a specific seat, hotel room, or event ticket - under heavy concurrent demand. The defining challenge is preventing double-booking: two users must never be sold the same seat, even when thousands click "buy" for a hot concert in the same second. This is fundamentally a concurrency and consistency problem, not a raw-throughput one.
Ad Click Aggregation
An ad click aggregation system ingests a massive stream of click events and produces near-real-time aggregated metrics - clicks per ad, per minute, per region - that power advertiser dashboards and billing. Because clicks translate directly into money owed by advertisers, the design must balance real-time freshness with eventually exact, auditable counts, and defend against duplicate and fraudulent clicks.
LLM Chat Assistant
An LLM Chat Assistant (like ChatGPT or Claude) is a conversational Gen AI application. It provides stateful, natural language interactions by routing user prompts to Large Language Models (LLMs). The central challenges include managing conversation history, filtering content for safety, routing to the optimal model based on workload, and streaming token-by-token responses back to the client at massive scale.
Retrieval-Augmented Generation (RAG) System
A Retrieval-Augmented Generation (RAG) system grounds LLM outputs in an external knowledge base. Instead of relying purely on the model's parametric memory, the system fetches relevant documents in real-time and injects them into the prompt. This prevents hallucinations, allows the model to answer questions about proprietary or private data, and removes the need for frequent fine-tuning.
Recommendation System
A Recommendation System (like those used by YouTube, Netflix, or TikTok) curates a highly personalized feed of content for a user. The core challenge is distilling a catalog of millions of items down to a few dozen highly relevant choices in under a few hundred milliseconds. Modern architectures solve this using a two-stage funnel: a lightweight Candidate Generation stage followed by a heavy, feature-rich Ranking stage.
Search / Feed Ranking System (Learning-to-Rank)
While basic search relies on keyword matching (TF-IDF/BM25), a modern Search or Feed Ranking system uses Machine Learning (Learning-to-Rank) to order candidates based on probability of relevance, engagement, or conversion. This system takes a list of candidate items, enriches them with hundreds of real-time features, and scores them using ML models (like XGBoost or deep neural networks) in milliseconds.
Ad Click-Through-Rate (CTR) Prediction System
Ad CTR Prediction is the financial engine of digital advertising. When a user loads a page, an ad auction runs in milliseconds. The system must predict the exact probability that the user will click a specific ad. Because advertisers pay per click (CPC) or per impression (CPM), a tiny improvement in model accuracy (even 0.1%) directly translates to millions of dollars in revenue.
AI Code Completion Assistant
An AI Code Completion Assistant (like GitHub Copilot or Tabnine) provides real-time, inline code suggestions directly within an IDE. Unlike conversational chatbots, it operates primarily via "ghost text" predictions while the user types. The defining challenge is extreme low-latency requirements (
Text-to-Image Generation Service
A Text-to-Image Generation Service (like Midjourney or DALL·E) uses diffusion models to convert natural language prompts into high-resolution images. Unlike text generation which streams instantly, image generation is computationally heavy and takes 5 to 60 seconds per request. The core system design challenge is managing asynchronous GPU workloads, strict queuing, dynamic batching, and handling massive, bursty traffic without dropping requests.
Vector Database (Semantic Search Engine)
A Vector Database (like Pinecone, Milvus, or Qdrant) is specialized for storing and querying high-dimensional vectors (embeddings) generated by AI models. Unlike traditional SQL databases that rely on exact row matching, a vector database performs similarity searches—finding data that means the same thing conceptually. It powers RAG applications, image search, and recommendation engines.
Content Moderation System (Toxicity & Policy)
A Content Moderation System automatically reviews user-generated content (text, images, video) to detect toxicity, hate speech, spam, and policy violations. It acts as the protective shield for platforms like Facebook, Discord, and Reddit. Because AI models aren't perfect, the system must balance aggressive automated filtering with human-in-the-loop review for ambiguous cases.
Fraud & Anomaly Detection System
A Fraud Detection System operates in the high-stakes environment of financial transactions, account takeovers, and payment processing (e.g., Stripe, PayPal, banking). The system must analyze a transaction in milliseconds, compare it against the user's historical behavior and global fraud patterns, and definitively approve or decline the action. It requires a blend of real-time stream processing, Graph Databases to detect fraud rings, and Machine Learning classifiers.