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

Score yourself

3 min read+10 XP

Score yourself

Give yourself 0, 1 or 2 points per row.

Area0 points1 point2 points
RequirementsStarted drawingSend and receiveOrder, duplicates, offline, multi-device, groups and encryption agreed
EstimatesNoneNumbers, not used laterConnections and message rate drove gateways and sharding
API and dataSkippedREST onlyWebSocket messages with client_id, seq, delivered/read; cursors per device
High-level designServer pollsGateways without routingStore-then-deliver, registry routing, push + sync walked
Deep diveHand-wavedOne topicOrdering and dedupe, ticks across devices, offline sync or groups done properly
Trade-offsNone namedNamed when askedRaised unprompted (per-chat order, retention, receipt cost, E2E limits)
CommunicationLong silencesMostly clearThought out loud, checked in, managed time

12 to 14: strong hire signal. 8 to 11: solid, polish the weak rows. Under 8: redo the round in a week, timer on.

The bar: fresher vs SDE-2

FresherSDE-2
TransportWebSocketGateway tier, registry, heartbeats, reconnect storms
OrderingTimestampsPer-chat sequence from one writer; client IDs for dedupe
TicksSent and readStored / all devices / read, "up to N" acks, privacy setting
Offline"Store and forward"Per-device cursors, push nudges, deletion after delivery
Groups and mediaLoop over membersSender keys, receipt aggregation, encrypted blobs with keys in messages

Common mistakes

  • Ordering by client timestamps.
  • No client ID, so a retried send appears twice.
  • Delivering before storing, so a crash loses messages.
  • Two grey ticks after the first device acks, ignoring the user's other devices.
  • Sending big media through the chat socket instead of object storage.

Quick check

Five questions on this chapter. Pick an answer, then check it.

quiz