code.davidloor.com

Open prompt · 45 min recommended

Design a Chat App

00:00

Target 45:00

Design a Chat App

You have 45 minutes. Sketch the system in this notes pane.

Scope

Functional requirements

Non-functional requirements

Out of scope

Suggested approach

  1. Clarify requirements — group size, message retention period, delivery guarantees (at-most-once vs. at-least-once), offline message handling
  2. High-level design — persistent WebSocket connections to a chat server tier; message storage; a presence service; a notification service for offline users
  3. API + data modelsendMessage(from, to/group, body, idempotency_key) over WebSocket; messages table (msg_id, channel_id, sender_id, body, created_at, type); channels table for groups
  4. Storage + caching — recent messages in a cache; older messages in persistent storage; last-seen message ID per (user, channel) for delivery tracking
  5. Bottlenecks + mitigations — connection fan-out for large groups, hot server nodes with many active users, message ordering across distributed servers

Reference talking points

Your notes

Saved locally · 0 chars