System design: Slack/Discord-like chat
Design the chat subsystem for an app like Slack/Discord.
Product requirements
-
The product has
workspaces
. Each workspace contains
channels
.
-
Users can
join workspaces
and view all channels in that workspace.
-
Users can send
plain-text messages
in any channel they have access to.
-
Users can also have
1:1 private chats (DMs)
.
-
Users can
scroll back and read the full message history
(assume no expiration).
-
Users should
see new messages without refreshing
(real-time updates).
-
Anticipated top feedback: support
editing and deleting messages
.
What to cover
-
Core APIs (send message, fetch history, subscribe for real-time, edit/delete)
-
Data model and storage
-
Real-time delivery approach
-
Ordering/consistency expectations
-
Scaling considerations and key trade-offs
You may assume typical Slack-like scale (many workspaces, many channels, high fanout).