How I Approach "Design a Chat System" in Interviews "Design a chat app like WhatsApp" is one of the most common system design questions. Here is the structure I use.
Requirements One-to-one and group messages, online status, delivery receipts, and message history. Ask about scale: daily active users and messages per day.
Connections Clients keep a persistent WebSocket connection to a chat server. A service registry maps each user to the server holding their connection.
Sending a message The sender's chat server writes the message to storage, then looks up the recipient's server and forwards it. If the recipient is offline, push a notification and deliver on reconnect.
Storage Messages are write-heavy and read by conversation, so a wide-column store keyed by (conversation id, message id) works well. Message ids should be sortable by time.
Groups and presence For small groups, fan out to each member. Presence uses heartbeats with a timeout and is published only to friends who are online.
Trade-offs to mention Ordering guarantees, end-to-end encryption, and what happens when a chat server crashes. I rehearse this answer with mock interviews at https://www.linkjob.ai/. Disclosure: I work on Linkjob AI.