Design the architecture for WhatsApp - the world's most-used messaging app with 2 billion monthly active users sending 100 billion messages per day. Your design must cover:
- 1:1 messaging - real-time text messaging with end-to-end encryption (Signal Protocol). Messages are delivered in order, exactly once, with delivery receipts (sent ✓, delivered ✓✓, read 🔵).•Group chats - groups of up to 1,024 members. Messages are fan-out to all members with E2EE (sender encrypts once per member using pairwise keys).•Offline delivery - when a recipient is offline, messages are stored server-side (encrypted) and delivered when they reconnect. Messages are deleted from the server after delivery.•Media sharing - photos, videos (up to 2 GB), documents, and voice notes. Media is encrypted, uploaded to a blob store, and a download link is sent in the message.•Voice & video calls - peer-to-peer WebRTC calls with TURN server fallback for NAT traversal.•Status / Stories - ephemeral 24-hour updates visible to contacts.•Last seen & online status - real-time presence indicators.
The key challenge is delivering 100 billion messages per day with E2E encryption, exactly-once semantics, and offline support - all while the server never sees plaintext.
Design WhatsApp's messaging platform - E2E encryption, group chats, media, and offline delivery for 2 B users. Build this architecture under realistic production constraints, then validate tradeoffs in the design lab simulation.
Request path: The solution keeps ingress, service logic, and stateful dependencies separated so each layer can scale independently.
Reference flow: Mobile Clients -> DNS -> Load Balancer -> API Gateway -> Core Service -> Auth Service -> Primary NoSQL DB -> Replica SQL DB