Design a Real-Time Chat & Messaging System (WhatsApp / Slack)
Architect real-time chat: Persistent WebSockets, Gateway connection manager, Erlang/Go actor model, message delivery status (sent, delivered, read), and group chat fan-out.
01.1. Functional & Non-Functional Requirements
A Real-Time Chat System enables instantaneous 1-to-1 and group messaging, presence tracking, message delivery receipts, and media exchange across millions of concurrent mobile and web clients.
Functional Requirements
- 1-to-1 Real-Time Messaging: Sub-100ms bidirectional message exchange between two online users.
- Message Delivery Receipts: Support 3 distinct message states:
- Sent (single tick
\checkmark): Received and saved by server. - Delivered (double tick
\checkmark\checkmark): Successfully pushed to recipient's device. - Read (blue double tick
\checkmark\checkmark): Opened/viewed by recipient.
- Sent (single tick
- Group Messaging: Support group chats with up to
1,000members. - Offline Storage & Sync: If a recipient is offline, store messages reliably and deliver them immediately upon reconnect, accompanied by mobile push alerts (APNs/FCM).
- Presence & Last Seen: Real-time online/offline indicator and typing indicators.
Non-Functional Requirements
- Ultra-Low Latency: p99 message delivery latency
< 50 msfor online recipients. - Massive Concurrency: Support
50 millionconcurrent persistent connections (WebSockets). - High Availability & Fault Tolerance: Messages must never be lost (zero message loss durability guarantee).
- End-to-End Encryption (E2EE): Optional zero-knowledge Signal Protocol encryption.
Real-Time Chat & WebSocket Gateway Architecture ๐ฌ
Real-Time Chat & WebSocket Gateway Architecture ๐ฌ
Persistent WebSocket connections managed by stateless session registries, internal gRPC/Kafka message routing, and Cassandra message history storage.
Unlock Topic #239: Design a Real-Time Chat & Messaging System (WhatsApp / Slack)
You are viewing a preview. The full in-depth engineering deep dive, interactive simulators, architecture flowcharts, and self-assessment quizzes for this topic are available with Pro or Lifetime Access.
Failure modes, high-throughput bottlenecks, and real FAANG implementation decisions.
Interactive system topology diagrams, live parameter simulators, and downloadable SVG charts.
Staff-level multiple-choice quiz questions with instant feedback and answer explanations.
Firebase Google authentication automatically syncs your completed topics and quiz scores.
How clear and staff-actionable was this system breakdown?