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:
- How do clients receive messages in real time, and how does the server route a message from sender to all recipients?
- Where is the message stored, and what is the read path when a user opens the app?
- What happens if a user's device is offline — how do they catch up?