Modern CLI for Apache Kafka

Lightweight and efficient command-line tool for managing Kafka clusters. A modern alternative to JVM-based tools, inspired by kubectl.

🐹 Go
ā˜• Apache Kafka
⚔ CLI
Terminal - Kafta Demo

Powerful Features

Simplify Kafka cluster management with a modern, fast and intuitive CLI tool.

šŸ“Š

Topic Management

Create, delete, list and describe Kafka topics with simple and intuitive commands.

šŸ‘„

Consumer Groups

Monitor, describe and manage consumer groups, including real-time lag analysis.

šŸ’¬

Produce & Consume

Produce and consume messages directly from the terminal with interactive interface.

šŸ”§

Schema Registry

Manage Avro schemas with fast and detailed views. List subjects quickly or view compatibility levels and version counts.

🌐

Multi-cluster

Native support for multiple Kafka clusters across different environments.

šŸš€

Performance

Lightweight binary with no JVM dependency, ensuring fast and efficient execution.

šŸ”’

Security

Complete support for SASL authentication and secure communication via TLS.

šŸ“±

Output Formats

Display data in Table, JSON and YAML formats for different needs.

šŸ†•

Enhanced Schema Commands

Simplified syntax with positional arguments, automatic latest version detection, and smart error handling.

šŸ’”

Auto-complete

Smart suggestions and auto-complete for bash, zsh and fish shells.

Get Started

Install Kafta quickly using Go and configure your Kafka clusters. Requires Go 1.18+ and access to Apache Kafka.

# Install latest version
go install github.com/electric-saw/kafta/cmd/kafta@latest
# Verify installation
kafta --help
# Check version
kafta version
# For Go < 1.18 (legacy)
go get -u github.com/electric-saw/kafta
# Configure local development cluster
kafta config set-cluster local \
--bootstrap-servers localhost:9092
# Configure production cluster with SASL
kafta config set-cluster production \
--bootstrap-servers prod-kafka-1:9092,prod-kafka-2:9092 \
--security-protocol SASL_SSL \
--sasl-mechanism PLAIN \
--sasl-username myuser \
--sasl-password mypassword
# Configure staging cluster
kafta config set-cluster staging \
--bootstrap-servers staging-kafka:9092 \
--schema-registry http://staging-schema-registry:8081
# List all configured clusters
kafta config get-contexts
# Switch to production cluster
kafta config use-context production
# Set default output format
kafta config set output json
# Configure TLS with certificates
kafta config set-cluster secure \
--bootstrap-servers secure-kafka:9092 \
--security-protocol SSL \
--ssl-ca-location /path/to/ca-cert \
--ssl-certificate-location /path/to/client-cert \
--ssl-key-location /path/to/client-key
# Set request timeout
kafta config set request-timeout 30s
# Enable debug mode
kafta config set debug true
# List all schema subjects (fast - single API call)
kafta schema subjects
# List subjects with detailed compatibility info (slower)
kafta schema subjects --detail
# Get latest schema version (automatically uses latest)
kafta schema get user-events-value
# Get specific schema version
kafta schema get user-events-value --version 2
# List all versions with compatibility information
kafta schema versions user-events-value
# Compare schemas and see differences
kafta schema diff user-events-value \
--schema '{"type":"record","name":"Test","fields":[]}'
# Smart error handling - shows helpful messages
kafta schema get
# Output: Error: error: Subject not informed
# Usage: kafta schema get SUBJECT [flags]
# Bash completion
kafta completion bash > /etc/bash_completion.d/kafta
# Or for current user
kafta completion bash >> ~/.bashrc
# Zsh completion
kafta completion zsh > "${fpath[1]}/_kafta"
# Fish completion
kafta completion fish > ~/.config/fish/completions/kafta.fish
# PowerShell (Windows)
kafta completion powershell > kafta.ps1
. ./kafta.ps1

Usage Examples

See how to use Kafta to manage your Kafka clusters efficiently.

List Topics
View all topics in the cluster
$ kafta topic list
āœ“ user-events āœ“ order-events āœ“ payment-events
Create Topic
Create new topics with specific configurations
$ kafta topic create my-topic --partitions 3 --replication-factor 1
āœ“ Topic 'my-topic' created successfully
Consumer Lag
Monitor consumer group lag
$ kafta consumer lag my-group
TOPIC PARTITION LAG my-topic 0 15 my-topic 1 3
Switch Contexts
Switch between different Kafka clusters
$ kafta config get-contexts
CURRENT NAME CLUSTER * local localhost:9092 production prod-kafka:9092 staging staging-kafka:9092
List Schema Subjects (Fast)
View all schema subjects quickly with a single API call
$ kafta schema subjects
user-events-value order-events-key payment-events-value
Schema Subjects with Details
View subjects with compatibility levels and version counts
$ kafta schema subjects --detail
SUBJECT COMPATIBILITY VERSIONS user-events-value BACKWARD 3 order-events-key FULL 2 payment-events-value FORWARD 1
Get Latest Schema
Retrieve the latest version of a schema
$ kafta schema get user-events-value
{ "type": "record", "name": "UserEvent", "fields": [ {"name": "userId", "type": "string"}, {"name": "action", "type": "string"} ] }
Schema Versions with Compatibility
List all versions with compatibility information for each
$ kafta schema versions user-events-value
VERSION ID COMPATIBILITY 1 101 BACKWARD 2 102 BACKWARD 3 103 BACKWARD
Schema Comparison
Compare schemas and see differences
$ kafta schema diff user-events-value --schema '{"type":"record","name":"UserEvent","fields":[{"name":"id","type":"string"}]}'
Schema differences found: - field 'userId' removed - field 'action' removed + field 'id' added