Preparing your design workspace

Loading the problem and your latest saved attempt…

Design a Real-Time Direct Messaging System

Design durable one-to-one and small-group messaging with ordered conversation history, offline delivery, and multi-device synchronization.

Problem statement

For this exercise, assume that a user sends a message, sees a durable acknowledgment, and the recipient receives it on one or more devices or later after reconnecting. Send an idempotent message to a conversation and return its durable identity.

Deliver new messages to connected recipient devices and queue them for offline devices. Read ordered conversation history and resume from a per-device cursor. Create a conversation and enforce membership changes for future messages. Assume 100 million daily active users and one million message sends per second at peak.

A connected recipient should receive a durable message within one second at p99. Retain conversation history for one year and tolerate duplicate delivery while preserving idempotent display.

Preserve this invariant: one client message identity creates one stored message, and conversation order is stable within a membership epoch. Keep unrelated product features and company-specific infrastructure outside the first version.

What to build

  1. Send an idempotent message to a conversation and return its durable identity.
  2. Deliver new messages to connected recipient devices and queue them for offline devices.
  3. Read ordered conversation history and resume from a per-device cursor.
  4. Create a conversation and enforce membership changes for future messages.

At scale

  • For this exercise, assume 100 million daily active users and one million message sends per second at peak.
  • For this exercise, a connected recipient should receive a durable message within one second at p99.
  • For this exercise, retain conversation history for one year and tolerate duplicate delivery while preserving idempotent display.