English | 简体中文
A Kafka visualization and management tool written in Go, converted from the original Java Spring Boot version.
Key Advantages:
- Single Binary - No dependencies required, runs standalone
- Lightweight - Binary size < 10MB with embedded frontend
- Fast Deployment - Just download and run, no installation needed
- Multi-cluster Management - Add, remove, and manage multiple Kafka clusters
- Cluster Monitoring - View cluster status, partition counts, replica counts, storage size, offsets
- Topic Management - Create, delete, expand partitions, view configurations
- Broker Monitoring - View broker status and configurations
- Consumer Group Management - View, delete consumer groups, monitor lag
- Offset Management - Reset consumer group offsets (beginning, end, or specific offset)
- Message Operations - View, search, and send messages to topics
- Authentication - Token-based authentication with password management
- Embedded Frontend - React frontend embedded in single binary
- Gin - Web framework
- GORM - ORM for database operations
- Sarama - Kafka client library
- SQLite - Embedded database (no CGO dependency)
- BCrypt - Password encryption
- React - UI framework
- Vite - Build tool
- Embedded using Go's
embedpackage
- Go 1.21 or higher
- Node.js 18+ and npm (for building frontend)
# Build the application (includes frontend build)
make build
# Build for ARM64
make build-arm# Install Go dependencies
go mod download
# Build frontend
cd web
npm install --legacy-peer-deps
npm run build
cd ..
# Copy frontend assets
mkdir -p cmd/server/web
cp -r web/index.html web/assets cmd/server/web/
# Build Go application
go build -o kafka-map-go ./cmd/server
# Run
./kafka-map-go# Build Docker image (optionally specify version)
make docker VERSION=1.0.0
# Or use docker directly
docker build -t kafka-map-go:latest .
# Run container
docker run -p 8080:8080 -v $(pwd)/data:/app/data kafka-map-go:latestEdit config/config.yaml:
server:
port: 8080
database:
path: data/kafka-map.db
default:
username: admin
password: admin
cache:
token_expiration: 7200 # 2 hours in seconds
max_tokens: 100You can override any of the YAML settings (or provide new defaults) via the following environment variables:
| Variable | Description |
|---|---|
KAFKA_MAP_SERVER_PORT |
Override server.port. |
KAFKA_MAP_DATABASE_PATH |
Override database.path. |
DEFAULT_USERNAME / KAFKA_MAP_DEFAULT_USERNAME |
Override the initial admin username. |
DEFAULT_PASSWORD / KAFKA_MAP_DEFAULT_PASSWORD |
Override the initial admin password. |
KAFKA_MAP_CACHE_TOKEN_EXPIRATION |
Override cache.token_expiration (seconds). |
KAFKA_MAP_CACHE_MAX_TOKENS |
Override cache.max_tokens. |
DEFAULT_CLUSTER_NAME / KAFKA_MAP_BOOTSTRAP_NAME |
Name of a cluster to auto-create at startup. |
DEFAULT_CLUSTER_SERVERS / KAFKA_MAP_BOOTSTRAP_SERVERS |
Comma-separated broker list for the bootstrap cluster. |
DEFAULT_CLUSTER_SECURITY_PROTOCOL / KAFKA_MAP_BOOTSTRAP_SECURITY_PROTOCOL |
Optional security protocol (defaults to PLAINTEXT). |
DEFAULT_CLUSTER_SASL_MECHANISM / KAFKA_MAP_BOOTSTRAP_SASL_MECHANISM |
Optional SASL mechanism. |
DEFAULT_CLUSTER_SASL_USERNAME / KAFKA_MAP_BOOTSTRAP_SASL_USERNAME |
SASL username (if required). |
DEFAULT_CLUSTER_SASL_PASSWORD / KAFKA_MAP_BOOTSTRAP_SASL_PASSWORD |
SASL password (if required). |
DEFAULT_CLUSTER_AUTH_USERNAME / KAFKA_MAP_BOOTSTRAP_AUTH_USERNAME |
Alias for SASL username. |
DEFAULT_CLUSTER_AUTH_PASSWORD / KAFKA_MAP_BOOTSTRAP_AUTH_PASSWORD |
Alias for SASL password. |
Example of injecting a default admin and a bootstrap cluster:
export DEFAULT_USERNAME=ops
export DEFAULT_PASSWORD=supersecret
export DEFAULT_CLUSTER_NAME=prod-kafka
export DEFAULT_CLUSTER_SERVERS="kafka-1:9092,kafka-2:9092"
export DEFAULT_CLUSTER_SECURITY_PROTOCOL=PLAINTEXTEach cluster entry accepts name, servers, securityProtocol, saslMechanism, saslUsername, and saslPassword (or the aliases authUsername/authPassword). During startup the server validates the connection info and inserts any missing clusters into SQLite, so you can fully provision environments without manual UI steps.
- Username: admin
- Password: admin
Important: Change the default password after first login!
POST /api/login- User loginPOST /api/logout- User logoutGET /api/info- Get current user infoPOST /api/change-password- Change password
GET /api/clusters- List all clustersGET /api/clusters/:id- Get cluster detailsPOST /api/clusters- Create clusterPUT /api/clusters/:id- Update clusterDELETE /api/clusters/:id- Delete cluster
GET /api/brokers?clusterId=:id- List brokersGET /api/brokers/:id/configs?clusterId=:id- Get broker configsPUT /api/brokers/:id/configs?clusterId=:id- Update broker configs
GET /api/topics?clusterId=:id- List topicsGET /api/topics/names?clusterId=:id- Get topic namesGET /api/topics/:topic?clusterId=:id- Get topic detailsPOST /api/topics?clusterId=:id- Create topicPOST /api/topics/batch-delete?clusterId=:id- Delete topicsPOST /api/topics/:topic/partitions?clusterId=:id- Expand partitionsPUT /api/topics/:topic/configs?clusterId=:id- Update topic configsGET /api/topics/:topic/data?clusterId=:id- Get messagesPOST /api/topics/:topic/data?clusterId=:id- Send message
GET /api/consumerGroups?clusterId=:id- List consumer groupsGET /api/consumerGroups/:groupId?clusterId=:id- Get group detailsDELETE /api/consumerGroups/:groupId?clusterId=:id- Delete groupGET /api/topics/:topic/consumerGroups?clusterId=:id- Get groups by topicGET /api/topics/:topic/consumerGroups/:groupId/offset?clusterId=:id- Get offsetsPUT /api/topics/:topic/consumerGroups/:groupId/offset?clusterId=:id- Reset offsets
kafka-map-go/
├── cmd/
│ └── server/
│ ├── main.go # Application entry point
│ └── web/ # Embedded frontend assets
├── internal/
│ ├── config/ # Configuration management
│ ├── controller/ # HTTP handlers
│ ├── dto/ # Data transfer objects
│ ├── middleware/ # Middleware (auth, CORS)
│ ├── model/ # Database models
│ ├── repository/ # Data access layer
│ ├── service/ # Business logic
│ └── util/ # Utilities
├── pkg/
│ └── database/ # Database initialization
├── web/ # Frontend source code
├── config/
│ └── config.yaml # Configuration file
├── Dockerfile
├── Makefile
└── README.md
make fmtmake clean- Token-based Authentication - 2-hour token expiration
- BCrypt Password Hashing - Secure password storage
- CORS Support - Configurable cross-origin requests
- SASL/SCRAM Support - Secure Kafka authentication (PLAIN, SCRAM-SHA-256, SCRAM-SHA-512)
- SSL/TLS Support - Encrypted Kafka connections
- PLAINTEXT
- SASL_PLAINTEXT
- SASL_SSL
- SSL
- PLAIN
- SCRAM-SHA-256
- SCRAM-SHA-512
- Delay Message System - The 18-level delay message feature is not implemented in this version
- Single Binary - Frontend embedded in Go binary
- Smaller Footprint - No JVM required
- Faster Startup - Native binary execution
- Simpler Deployment - Single executable file
# Build optimized binary (with UPX compression)
make build
# The binary will be created as 'kafka-map-go'
# Deploy with config directory and run
./kafka-map-goIf frontend build fails, try:
cd web
rm -rf node_modules package-lock.json
npm install --legacy-peer-deps
npm run buildContributions are welcome! Please feel free to submit a Pull Request.
This project is converted from the original Java version of Kafka-Map.
- Project repository: Kafka Map Go
- Original Java version: Kafka Map
- Built with Gin
- Kafka client: Sarama
- ORM: GORM