Build your own Message Broker
A Kafka-like log broker: producers append records to partitioned topics, and consumers read from offsets they commit.
- Advanced
- About 15–30 h
- 5 checkpoints
- 2 tutorials · C, Java
Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.
Choose a tutorialWhy build it
Queues and event streams sit between most services. Building a log broker explains ordering, delivery guarantees, consumer offsets and retention better than any diagram.
You will be able to
- Store records in a segmented, append-only log with an offset index.
- Serve producers and consumers over a simple TCP protocol.
- Track consumer offsets and explain at-least-once versus at-most-once delivery.
- Reason about ordering within and across partitions.
Skills it exercises
- Messaging & Event Streaming
- Event-Driven Architecture
- Distributed Systems Fundamentals
- Stream Processing
- File Systems
Recommended on Data Engineer, Software Architect and System Design.
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
Append-only log
Done when: Records are appended to segment files with an offset index, and reading from any offset returns the right record after a restart.
- Checkpoint 2Self-check
Protocol
Done when: A producer CLI and a consumer CLI talk to the broker over TCP using a documented framing format.
- Checkpoint 3Self-check
Partitions
Done when: Records with the same key always land in the same partition and keep their order, checked with 10,000 records.
- Checkpoint 4Self-check
Consumer offsets
Done when: A consumer that crashes resumes from its last committed offset, and a test shows which records can be delivered twice and why.
- Checkpoint 5Self-check
Retention
Done when: Old segments are deleted by size or age without affecting consumers of newer offsets.
Stretch goals
- Replicate partitions to a follower.
- An MQTT broker with QoS levels, following the second tutorial.
Step-by-step guides
Pick one in a language you know (tutorial languages: C, Java). They open on the author’s site.
- Java
Building Your Own Kafka-like System From Scratch: A Step-by-Step Guide(external site)
Java: a Kafka-like system step by step.
- C
Sol - An MQTT broker from scratch(external site)
C: an MQTT broker from scratch. A different protocol, the same broker ideas.
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.