Lesson 13 of 17
38. Design a Chat App (WhatsApp)

38.12 What would you say in the last five minutes?

3 min read+10 XP

Step 6: Wrap-up (5 minutes)

  • Bottlenecks: connection count (gateway tier), message writes (store sharded by chat), receipts in large groups (aggregation).
  • Single points of failure: none central; gateways are interchangeable; chat shards are replicated with failover (Chapter 14); session registry entries are rebuilt on reconnect.
  • Correctness: client IDs for de-duplication, per-chat sequence numbers for order, store-then-deliver for no loss, per-device cursors for sync.
  • Privacy: end-to-end encryption means servers route ciphertext; metadata (who talks to whom, when) still needs protection and minimal retention.
  • Next with more time: voice and video calls (separate media servers, WebRTC), message editing and deleting (as new events in the chat), backups, and spam/abuse controls that work without reading message content.

Memory code: "Ordered, de-duplicated, stored before delivered, synced by cursor."