Build your own Chat Server
A multi-room chat server, first over raw TCP and then over WebSockets, that serves hundreds of concurrent clients.
- Intermediate
- About 8–16 h
- 5 checkpoints
- 4 tutorials · C, C#, Ruby
Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.
Choose a tutorialWhy build it
Chat is the standard example of a real-time system: long-lived connections, fan-out, presence and message ordering. It is also the system behind the classic chat design interview question.
You will be able to
- Serve many long-lived connections with an event loop or async I/O.
- Broadcast to rooms without letting one slow client delay the others.
- Upgrade an HTTP connection to WebSocket and frame messages.
- Reason about delivery, ordering and message history.
Skills it exercises
- Real-Time APIs & Webhooks
- TCP & UDP
- Concurrency & Synchronization
- Chat System Design
- Async I/O in Python
Recommended on Backend Engineer, System Design and Network Engineer.
How you know you are there
Work in any language. Each checkpoint ends with something you can run or observe, so you can check it yourself.
- Checkpoint 1Self-check
TCP chat
Done when: Several
ncclients connect, choose a nickname and see each other's messages. - Checkpoint 2Self-check
Rooms and commands
Done when: /join, /leave and /who work, and a disconnecting client is announced and cleaned up.
- Checkpoint 3Self-check
Slow clients
Done when: A client that stops reading does not delay messages to others; its buffer is capped and it is disconnected when the cap is reached.
- Checkpoint 4Self-check
WebSocket
Done when: A browser page connects over WebSocket and chats with the TCP clients.
- Checkpoint 5Self-check
History
Done when: After a server restart, a new member of a room receives its last 50 messages in order.
Stretch goals
- Run two server instances connected through a pub/sub broker.
- Load-test with 1,000 simulated clients and report latency.
Step-by-step guides
Pick one in a language you know (tutorial languages: C, C#, Ruby, Rust). They open on the author’s site.
- C
Beej's Guide to Network Programming(external site)
C: the standard guide to sockets, including select() and a multi-user chat server.
- Rust
Writing Scalable Chat Service from Scratch(external site)
Rust: a chat service on an event loop, with WebSockets.
- Ruby
Building a simple websockets server from scratch in Ruby(external site)
Ruby: the WebSocket handshake and framing from scratch.
- C#
C# Networking: Create a TCP chater server, TCP games, UDP Pong and more(external site)
C#: a TCP chat server and other small networked programs.
Where to go next
- Build your own TCP/IP Stack
Advanced · 30–60 h
Practice builds are self-paced: Tech Atlas does not track them or count them as evidence. To show a skill, take its knowledge check from the skill page.
Tutorials come from codecrafters-io/build-your-own-x (CC0, snapshot of 2026-07-14, commit aa17439; links checked on 2026-10-19). Each tutorial belongs to its author and keeps its own licence; Tech Atlas links to it and does not host it. Briefs, checkpoints and the mapping to skills are Tech Atlas editorial drafts.