Design WhatsApp

Mobile messaging platform inspired by WhatsApp: persistent connections, store-and-forward delivery (the server keeps messages only until they're delivered), push for offline phones, server-side group fan-out and Signal-protocol end-to-end encryption with encrypted media. A teaching design, not Meta's internal architecture.

Functional requirements

  • Users send and receive text messages in 1-on-1 chats with sub-second delivery when both parties are online
  • Users send and receive images, video, and voice messages; media is compressed and delivered efficiently
  • Messages are end-to-end encrypted — the server must never have access to plaintext message content
  • Offline users receive all missed messages in order when they come back online
  • Delivery receipts: single tick (sent to server), double tick (delivered to device), blue tick (read by recipient)
  • Typing indicators and online/last-seen presence are shown to contacts in real time
  • Group chats support up to 1,024 members with the same delivery and receipt guarantees
  • Users can search their message history, contacts, and groups by keyword
  • The system captures usage analytics and exposes operational metrics/logs for monitoring, without impacting message delivery latency

Non-functional requirements

  • Message delivery latency < 200ms p99 end-to-end when both users are online
  • Support 2 billion registered users; 100 million concurrent online users
  • Messages must be delivered at-least-once; deduplication on the client side
  • End-to-end encryption: server stores only ciphertext; keys never leave the device
  • Message history stored for 90 days; media stored for 30 days with CDN caching
  • Search queries return results within 300ms p99 via a dedicated, asynchronously-updated search index
  • All services and workers emit metrics/logs to a centralized observability pipeline for production monitoring and alerting
  • 99.99% uptime — users must be able to send messages even during partial outages

How the design evolves

Stage 1: Single Server, Polling, Messages Kept Forever

See why polling a server that keeps every message can't serve billions of phones.

What was missing: Nothing yet: phones poll one server that stores every message.

Why that's risky: Polling multiplies requests by every idle phone, messages arrive only on the next poll, and the database grows forever with content the server never needs again.

What gets added: A chat server that phones poll every few seconds, and a database keeping every message forever.

Trade-offs: Simple request/response, but it wastes battery and server capacity on empty polls.

Stage 2: Persistent Connections and Store-and-Forward

Push messages the moment they are sent, and keep them on the server only until they are delivered.

What was missing: Phones polled for new messages, and the server kept every message forever.

Why that's risky: An offline phone only gets its messages when the user happens to open the app.

What gets added: Chat gateways holding one persistent connection per online phone, a session registry recording which gateway each user is on, a chat service that routes each message to the recipient's gateway or into their offline inbox, and sent/delivered receipts.

Trade-offs: Store-and-forward keeps the server small and private (messages are deleted on delivery), but chat history lives only on phones and their backups.

Stage 3: Push Notifications for Offline Phones

Wake up offline phones so they connect and fetch their messages.

What was missing: Offline phones had no way of knowing a message was waiting.

Why that's risky: Group messages would make the sender upload one copy per member.

What gets added: A push queue and workers that wake offline recipients through APNs and FCM. The notification carries no readable content; the phone connects and fetches from its inbox.

Trade-offs: Push providers are outside our control and can delay or drop notifications; the inbox, not the push, is what guarantees delivery.

Stage 4: Group Chats

Send once from the phone and deliver to every member of a group.

What was missing: There were only one-to-one chats; a group would mean one upload per member.

Why that's risky: The server can still read every message and every photo passes through it unencrypted.

What gets added: A group service and database for membership, and a fan-out queue and worker: the sender uploads a group message once, and the worker delivers a copy to each member's gateway or offline inbox.

Trade-offs: Fan-out happens on the server, so a 1,024-member group means 1,024 deliveries per message; groups are capped to bound this.

Stage 5: End-to-End Encryption and Media

Make the server unable to read messages or media, and move media out of the chat path.

What was missing: Messages and media were readable on the server, and media travelled through the chat path.

Why that's risky: Spammers can still blast messages, and nobody can see delivery latency or backlogs.

What gets added: A key service and store distributing public identity keys and one-time prekeys so phones set up end-to-end encrypted sessions (Signal protocol). Media is encrypted on the phone, uploaded to object storage and served by a CDN; the chat carries only its URL and key.

Trade-offs: The server can't scan content or offer server-side search; it only ever sees ciphertext and metadata needed for routing.

Stage 6: Abuse Limits and Observability

Slow down spam and watch delivery health.

What was missing: No protection against bulk sending, and no view of the system's health.

Why that's risky: Remaining risk is regional: losing a data centre means its phones reconnect elsewhere while the inbox fails over.

What gets added: An abuse limiter capping sends and new-chat rates per account, and monitoring of connection counts, delivery latency, inbox backlog and push failures.

Trade-offs: Rate limits can slow legitimate bursts (New Year's Eve); limits are per account and generous for established ones.

PRISM
System Design Interview
Round 1 of 4 · Architecture Design · 60:00 remaining
PRISM logo PRISM logo
Problems
AI Interview
Interview Challenges
Build & Stress Test NEW
System Architectures
Design & Fix NEW
Interactive Roadmap
System Design Guides Interview Prep Guide
Problems
Today's mission
Notifications
    Theme
    Pricing Community NEW Send feedback Report a problem NEW
    Sign in
    Theme
    Community NEW Send feedback Report a problem NEW
    All problems
    Phase
    Build & Stress Test
    Phase 01: Thinking in Systems
    Upcoming

    Components

    User
    CDN
    Load Balancer
    Server
    Cache
    Database
    Blob Storage
    Search Index
    Queue
    Worker
    Rate Limiter
    Service
    API Gateway
    Reverse Proxy
    WebSocket Server
    Third-party API

    Inspector

    Notes
    Use clear names so your design intent is easy to understand.
    Good
    Name by business meaning
    "Order API", "Restaurant Service"
    Avoid
    Generic names = zero signal
    "Server 1", "API", "Queue"
    A short description for each component makes feedback much better.
    100%
    Start by identifying:
    • Users & entry points
    • APIs & services
    • Databases & storage
    • Traffic flow & scale

    Round 1 of 4 Architecture Design

    Run a simulation to see results.

    Time Remaining
    60:00
    System Design Interview

    What are the core functional requirements?
    What are the key non-functional constraints?

    Questions

    Start Evaluation to unlock questions.

    EVALUATE MODE

    Test yourself like it's the real thing.

    A structured 4-module evaluation that mirrors how top companies assess system design candidates.

    Architecture Design
    Draw your system on the canvas. Define components, connections, and data flow.
    FR & NFR Requirements
    Answer functional and non-functional requirement questions about your design.
    MCQ Round
    Multiple choice questions testing your depth on the chosen system.
    Tradeoff Analysis
    Justify your design decisions and defend your architectural tradeoffs.
    AI Report Generated
    Choose a Problem
    No problem selected
    • 30 min
    • 45 min
    • 60 min
    Round 2 of 4
    MCQ Round
    Answer multiple-choice questions based on your design.

    Exit Interview?

    You're in the middle of an interview session. Leaving now will end your current attempt.

    Your progress will be saved.

    Open a saved design

    Select a design to load into the canvas.

    My Evaluations

    Your past evaluation sessions

    Here’s a simple request flow that follows the expected layer order.

    External User
    →
    Edge CDN → API Gateway → Load Balancer
    →
    Compute App Servers / Services
    →
    DataAccess Cache
    →
    Storage Database / Search Index
    →
    Async Queue → Worker

    Tip: keep arrows moving forward through layers (Edge → Compute → Storage). Avoid sending storage back to compute.

    Evaluation Instructions

    Read the rules carefully before starting. The test auto-submits on refresh.

    Before you start

    • Build your architecture on the canvas. The timer starts when you click Start Evaluation.
    • Don't forget to answer Functional Requirement and Non Functional Requirements.
    • When satisfied with your design, click Next to lock it and view the questions.
    • Please answer final step questions to complete the evaluation.

    Dos

    • Do read each question carefully before answering.
    • Do include required components to maximize component coverage.
    • Do save a copy of your design if you want to keep it before submission.

    Don'ts

    • Don't refresh or close the tab during an active evaluation — this will auto-submit your answers.
    • Don't switch app modes or open another tab while the evaluation is running.
    • Don't attempt to edit the design after clicking Next; the workspace will be locked.

    All the best!!

    Confirm

    Input

    Notice

    Evaluation Report
    Report a problem

    Evaluation Complete

    Generating Your Report

    Hang tight — our AI is evaluating your design…

    Did you know?

    Loading…

    Share feedback

    Tell us what worked well and what we can improve.

    Let's personalize this

    Answer a couple of quick questions so we can tailor your journey and missions.

    Your welcome gift: of Full PRISM Access

    Your Pro access starts as soon as you press Start my journey.

    SYSTEM BRIEF

    System Constraints

    What the system must do — every item is a user-facing behaviour your architecture must support.

      ↑ Engineering Constraints

      These are the failure modes you must design against — latency SLAs, durability targets, traffic ceilings.

        ⇆ Architecture Constraints

        Core Concepts to Master

        Your Journey
        PHASE – –
        0 / 0 0%
        0
        Mock Interview Checklist

        Pick a topic to start

        Explore concept overviews, real-system examples, key tradeoffs, and interview talking points for each roadmap section.

        Phase Mastered

        You've conquered this phase. These are the skills you now own:

          +500 XP

          Company Interview Paths

          Progress Summary