System Design: Real-Time Chat at Scale

Walk through how you would design the backend for a real-time chat app handling millions of messages a day.

Technical Reference & Key Concepts

The Challenge: Real-Time Chat Backend

You are designing the backend for a chat app. Users send messages that must appear instantly in other clients, messages must be durable (survive crashes), and history must load fast.

Core questions to address:

  1. How do clients receive messages in real time, and how does the server route a message from sender to all recipients?
  2. Where is the message stored, and what is the read path when a user opens the app?
  3. What happens if a user's device is offline — how do they catch up?