KatInterview

Design a Real-Time Enterprise Team Chat Platform

System DesignModel answer
MediumModel answerSystem Designsystem-designdistributed-systemswebsockets

Last updated

Architect a low-latency, highly durable workplace chat platform supporting real-time delivery, missed message catch-up, channel fanout, and per-conversation ordering.

Design a real-time workplace collaboration and messaging platform similar to Slack or Microsoft Teams. The platform must allow users to participate in organization workspaces, public/private channels, and direct message (DM) conversations.

Key Requirements & Objectives

  1. Core Data & Messaging: Support workspaces, channels, direct messages, user memberships, and conversation messages.
  2. Durability & Latency: Messages must be persisted durably before client acknowledgement. Online recipients should receive messages with sub-second end-to-end latency.
  3. Ordering Guarantees: Ensure strict, total message ordering within a single conversation (channel or DM). Global ordering across different conversations is not required.
  4. Real-Time Delivery & Fanout: Deliver messages to connected clients across multiple devices per user. Efficiently handle high-volume fanout for channels with up to 100,000 members.
  5. Catch-Up & Missed Messages: Allow clients returning from network disruptions or app restarts to seamlessly fetch missed messages without missing updates or seeing duplicate entries.
  6. Cold Start Optimization: Fast initial boot time for clients without fetching historical data for inactive channels.
  7. Push Notifications: Trigger external push notifications (APNs/FCM) for offline or inactive users without sending redundant alerts to actively engaged sessions.

Scale & Operating Assumptions

  • Active Scale: 10 Million Daily Active Users (DAU), 10 Million Workspaces.
  • Peak Write Load: ~100,000 incoming messages per second.
  • Channel Sizes: Range from 2-person DMs to 100,000-member organization-wide channels.
  • Client Footprint: Web, Desktop, iOS, and Android. A single user can have multiple concurrent active sessions.