← Discord Interview Insights

Discord·Software Engineer·Onsite - System Design / Architecture·Senior

Senior
Jun 2026

Summary

System design round at Discord for a software engineer role. The prompt was to build a Discord-like TCP chat server from scratch, which felt a little meta. A lot of ground to cover in one question.

Questions Asked (1)

Q1

Design a Discord-like chat server that supports multiple concurrent clients over raw TCP, including slash commands, chat rooms, message history, reconnection, and persistence across server restarts.

System DesignData ModelingTechnical Trade-offs
Author's notes

This is a big one.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then sketch a high-level architecture with TCP connection handling, a message broker, and persistent storage. Walk through the data model and protocol design, and discuss trade-offs for reliability, reconnection, and persistence.

Pro tip: Emphasize idempotency and message ordering—use client-generated message IDs and server-side sequence numbers to handle reconnection and deduplication gracefully. Also, mention that you'd start with a simple design and iterate based on metrics, showing pragmatic engineering.

1. Clarify Requirements and Scale

Ask about expected number of concurrent users, message throughput, latency requirements, and persistence guarantees. Define functional requirements like slash commands, chat rooms, history, and reconnection.

2. High-Level Architecture

Outline components: TCP gateway for connection handling, a message broker (e.g., Redis Pub/Sub or Kafka) for fan-out, a database for persistence, and a service for slash command processing. Consider load balancers and horizontal scaling.

3. Protocol and Data Model

Design a simple length-prefixed or newline-delimited JSON protocol over TCP. Define data schemas for users, rooms, messages, and commands. Discuss indexing for efficient history retrieval.

4. Reliability and Reconnection

Explain how clients reconnect and resume: use session tokens, last-received message ID, and server-side message buffers. Ensure at-least-once delivery with deduplication.

5. Persistence and Trade-offs

Choose storage (e.g., PostgreSQL for messages, Redis for presence) and discuss trade-offs: consistency vs. availability, latency vs. durability, and cost. Mention sharding and replication for scale.

Key Points to Mention

  • TCP connection management: keep-alive, heartbeats, and handling half-open connections.
  • Message ordering and delivery guarantees: per-room sequence numbers, at-least-once with idempotent consumers.
  • Slash command parsing and execution: extensible command registry, rate limiting, and permissions.
  • Chat room membership and message fan-out: pub/sub model, presence tracking, and scalability.
  • Persistence strategy: write-ahead logging, database choice, and efficient history queries with pagination.
  • Reconnection handling: session resumption, missed message replay, and client state synchronization.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.