Design Slack-like chat system
Company: Discord
Role: Software Engineer
Category: System Design
Difficulty: easy
Interview Round: Onsite
##### Question
Design the **chat subsystem** for an app like Slack/Discord. State your assumptions (scale, retention, consistency needs) and propose an end-to-end architecture, then expect deep follow-ups on the trade-offs.
**Product requirements**
1. The product has **workspaces**; each workspace contains **channels**. Users can join a workspace and view all channels they have access to (public and private channels).
2. Users can send **plain-text messages** in any channel they are a member of, and the channel may have many members (some "announcement" channels can reach 100k+).
3. Users can also have **direct messages** — 1:1 and small group DMs.
4. Users can **scroll back and read the full message history** (assume no expiration / long retention).
5. Users should **see new messages in real time without refreshing**.
6. Support **editing and deleting** messages.
**Design areas to cover (expect a deep dive on each)**
1. **Core APIs** — send message, fetch history (pagination), subscribe for real-time, edit/delete.
2. **Data model** for workspaces, channels/conversations, membership, and messages.
3. **Storage choice**, sharding/partitioning, and how history queries stay efficient.
4. **Real-time delivery** (WebSocket / pub-sub) and connection/subscription management.
5. **Fanout strategy** — write fanout vs read fanout — and the trade-offs at different channel sizes.
6. **Ordering and consistency** guarantees (per-conversation ordering, read-your-writes) and handling **edits/deletes**.
7. **Indexing / full-text search** over message history (if asked).
8. **Hot channels** and performance bottlenecks — how you mitigate very large or very active conversations.
Quick Answer: An onsite system-design interview question asking you to design the chat subsystem for a Slack/Discord-like app: workspaces, channels, 1:1 and group DMs, full message history, real-time updates, and edit/delete. It tests data modeling, storage and partitioning, fanout strategy, real-time WebSocket delivery, and per-conversation ordering and consistency.