System Design: Slack-like Messaging (Channels + DMs)
Design a Slack-like messaging backend that supports:
-
Public/private
channels
with many members
-
1:1 and small group
direct messages
-
Sending and receiving messages with low latency
-
Message history (scrollback)
Interview focus areas (expect deep follow-ups):
-
Data model
for channels, membership, messages
-
Fanout strategy
(write fanout vs read fanout)
-
Indexing / querying
for message history and (optional) search
-
Database choice
and sharding/partitioning
-
Ordering guarantees and handling edits/deletes
-
Hot channels and performance bottlenecks
State your assumptions (scale, retention, consistency needs) and propose an end-to-end architecture.