A minimal Kafka server clone written in Go.
Kafka-clone-go is a learning-oriented project that replicates the basic TCP server behavior of Apache Kafka. It listens on port 9092 and handles incoming client connections, parsing and responding to API version requests in a way similar to a real Kafka broker. This project is ideal for those wanting to understand Kafka's wire protocol and the fundamentals of building network servers in Go.
- Listens for TCP connections on port 9092 (default Kafka port)
- Handles multiple client connections concurrently
- Parses incoming API version requests and responds with protocol-compliant messages
- Demonstrates error handling and binary protocol manipulation
- Lightweight and easy to read
- Go 1.18 or newer
# Compile and run
./your_program.shAlternatively, you can build and run manually:
go build -o kafka-server app/*.go
./kafka-serverThe server will start and listen for TCP connections on 0.0.0.0:9092.
app/server.go: Main server implementation and protocol logic.codecrafters/compile.sh,.codecrafters/run.sh: Scripts for CodeCrafters platformyour_program.sh: Local build and run helper script
- Accepts raw TCP connections from clients (e.g., Kafka CLI tools or custom clients)
- Reads incoming binary-encoded requests and extracts the API version and correlation ID
- Responds with a versioned API response or error code, mimicking Kafka's protocol
This project is for educational purposes only and does not implement a fully functional Kafka broker.
Inspired by Codecrafters Kafka challenge.