Design a Chat Application
HardSystem design · Realtime Messaging · Meta
Design a messaging application in the style of WhatsApp or Messenger: one-to-one and small group conversations (up to about 1,000 members) with real-time delivery, delivery and read receipts, presence, offline delivery and history.
In scope: connection handling, message routing, per-conversation ordering and idempotency, offline and multi-device delivery, group fanout, push notifications, and regional routing. Out of scope: workspaces, channels and message search (see the Slack problem), and voice or video calls.
Requirements
- Order messages per conversation with a server-assigned sequence, not client clocks
- Treat the wire as at-least-once and make sends idempotent with client-generated ids
- Deliver to online recipients over persistent connections and to offline recipients via push and sync on reconnect
- Route across regions and keep working through gateway failure and reconnect storms