Design Slack
Understanding the Problem
💼 What is Slack? Slack is team chat organized into workspaces (one per company or community) and channels inside them. People post in channels and direct messages, everything they post is kept as searchable history, and every open client (desktop, web, phone) sees new messages, reactions, edits and who's online in real time. Unlike a phone messenger, the server holds the history, and a channel can have tens of thousands of members.
"Design Discord" is the same problem. Discord calls workspaces servers (often called guilds internally) and has the same channels, history and presence, but the extremes are different: a single Discord server can have hundreds of thousands to millions of members, mostly strangers, mostly lurking. We'll design for Slack-like workspaces and use the deep dives for Discord-scale servers, presence at scale, and search.
How this differs from Design WhatsApp: WhatsApp delivers each message into each recipient's inbox (fan-out on write). Slack stores a message once per channel and lets clients read the channel (fan-out on read for history), while pushing live updates only to clients that are connected right now. That one difference changes most of the design.
Functional Requirements
Core Requirements
- Users should be able to send messages to channels and DMs in a workspace, and every online member should see them in real time.
- Users should be able to scroll back through a channel's history and see unread counts and mentions, consistent across their devices.
- Users should be able to see which teammates are online.
- Users should be able to search messages they have access to.
Below the line (out of scope)
- Voice/video calls and screen sharing.
- File storage beyond "upload to object storage, post a link."
- Apps, bots and workflows (they use the same message API).
- Enterprise grid features (cross-workspace channels, data residency), beyond a mention.
Non-Functional Requirements
Ask for numbers. We'll design for 20 million workspaces, 50 million daily active users, 15 million concurrent connections at peak, and 1.5 billion messages a day. Most channels have tens of members; the largest have 100,000+ (company-wide announcements, or Discord-style communities).
Core Requirements
- A message should appear on other members' screens within about 500 ms (p99 under a second).
- Messages must be durable and ordered within a channel; every client should converge to the same history.
- The system should be highly available; a problem in one workspace shouldn't take down others.
- Search should return results within a second or two and never show a message from a channel the user can't see.
- Presence should be close to real time (seconds) without dominating server load.
Below the line (out of scope)
- Strict ordering across channels.
- Offline-first clients; Slack clients are mostly online and fetch from the server.
The math. 1.5B messages/day ÷ 86,400 ≈ 17k messages/s average, 50k/s peak. That's a modest write load for a sharded database. Fan-out is where the work is: if the average message lands in a channel with 30 online members across ~2 devices each, that's 50k × 60 = 3M real-time deliveries per second at peak. Reactions, edits, typing indicators and presence changes are events too, and in practice outnumber messages.
Storage: at ~1 KB per message with metadata, 1.5B/day is 1.5 TB/day, about 550 TB a year before replication. History is kept for years, so storage grows forever and must be sharded from the start.
Separate the two jobs early: storing a message (once, in a channel's history, sharded and durable) and delivering it (live, to the connections that care, best effort with a recovery path). Candidates who mix them end up fanning out writes to millions of inboxes, which is exactly what Slack-style systems avoid.