Design a distributed chat + voice platform in the shape of Discord. Users join servers (guilds), which are organized into categories and channels. Each channel is either a text channel (real-time messaging with history), a voice channel (persistent audio room with WebRTC), or a stage/forum channel. Permissions are role-based with inheritance across the guild/category/channel hierarchy. Rich presence shows what users are doing. Bots extend the platform with slash commands and event subscriptions.
The interesting challenges: - Real-time message fan-out to every connected member of a channel with per-channel ordering. - Persistent voice rooms over WebRTC using Selective Forwarding Units (SFUs), not peer mesh — one user speaks, the SFU forks their audio stream to every other participant. - Presence at scale — 150M+ MAU with millions concurrently online means a presence update storm (user goes online → every friend + every mutual-server member must be notified). - Voice region routing to minimize audio RTT across a global user base. - Role-based permissions with inheritance evaluated on every message/voice-join/action. - Gateway WebSocket scaling — a single user connection drives many fan-out writes, and a gateway node must route updates from all guilds the user cares about.
Scope: 150M MAU, 15M peak concurrent users, 4B messages/day, 10M+ concurrent voice participants across ~200K active voice channels.
Suggested time: 90 minutes
Loading the workspace...
Discord looks like "just another chat app" until you stare at it long enough to notice the three things that make it different: persistent voice rooms, the guild/channel/role hierarchy, and presence-at-scale. Once you internalize those three, the rest of the design falls out of them.
Guild/category/channel hierarchy
Text channels
Durable message history
Voice channels
Rich Presence
Slash commands, webhooks, and bots
The building blocks this design relies on, each explained in its own lesson.
Design ChatGPT (hard)
Design a Load Balancer (hard)
Design a Key Value Store (hard)
Design a Video Conferencing system (medium)
Design Facebook Messenger (medium)