Design a TCP Discord-like chat server

Read the full interview experience this question came from →

Quick Overview

This question evaluates a candidate's skills in system design, TCP-based protocol design, real-time messaging, data modeling, persistence, session/reconnection handling, and concurrency control for backend services.

Design a TCP Discord-like chat server

Company: Discord

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Onsite

Design a Discord-like chat server that accepts multiple clients over raw TCP (e.g., test via PuTTY/telnet). Functional requirements: - Clients connect over TCP and can send line-based messages. - Support slash commands: - `/help` show available commands - `/nick <name>` set/change nickname - `/users` list users (at least in current room, or globally—state your choice) - `/quit` disconnect - Chat rooms: - Create rooms, join rooms, and list rooms - Messages sent to a room are broadcast to all users currently in that room - Reconnection: - If a client disconnects and later reconnects (identify how), they should be able to rejoin their previous rooms - Message history: - When a user joins a room, show the last 10 messages from that room - Persistence: - Data must persist across server restarts (users/rooms/membership/messages as needed) Non-functional requirements: - Keep scalability in mind (multiple concurrent clients; discuss how to scale beyond one process/host). Explain your protocol, core data model, key components, and how you would handle concurrency, durability, and scaling.

Overview: This question evaluates a candidate's skills in system design, TCP-based protocol design, real-time messaging, data modeling, persistence, session/reconnection handling, and concurrency control for backend services.

Read the full Discord Software Engineer interview experience this question came from

|Home/System Design/Discord
Discord logo
Discord
Jan 27, 2026
mediumSoftware EngineerOnsiteSystem Design
56
0

Design a Discord-like chat server that accepts multiple clients over raw TCP (e.g., test via PuTTY/telnet).

Functional requirements:

  • Clients connect over TCP and can send line-based messages.
  • Support slash commands:
    • /help show available commands
    • /nick <name> set/change nickname
    • /users list users (at least in current room, or globally—state your choice)
    • /quit disconnect
  • Chat rooms:
    • Create rooms, join rooms, and list rooms
    • Messages sent to a room are broadcast to all users currently in that room
  • Reconnection:
    • If a client disconnects and later reconnects (identify how), they should be able to rejoin their previous rooms
  • Message history:
    • When a user joins a room, show the last 10 messages from that room
  • Persistence:
    • Data must persist across server restarts (users/rooms/membership/messages as needed)

Non-functional requirements:

  • Keep scalability in mind (multiple concurrent clients; discuss how to scale beyond one process/host).

Explain your protocol, core data model, key components, and how you would handle concurrency, durability, and scaling.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...