Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kafka-clone-go

A minimal Kafka server clone written in Go.

Overview

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.

Features

  • 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

Getting Started

Prerequisites

  • Go 1.18 or newer

Running Locally

# Compile and run
./your_program.sh

Alternatively, you can build and run manually:

go build -o kafka-server app/*.go
./kafka-server

The server will start and listen for TCP connections on 0.0.0.0:9092.

Project Structure

  • app/server.go: Main server implementation and protocol logic
  • .codecrafters/compile.sh, .codecrafters/run.sh: Scripts for CodeCrafters platform
  • your_program.sh: Local build and run helper script

How It Works

  • 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

License

This project is for educational purposes only and does not implement a fully functional Kafka broker.


Inspired by Codecrafters Kafka challenge.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages