Skip to content

limhaneul12/kafka-gov

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

90 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Kafka Gov Logo

πŸ›‘οΈ Kafka Governance Platform

Enterprise-grade Kafka management with rich metadata, policy enforcement, and batch operations

Python FastAPI React Coverage License

"Without knowing who owns a topic and what it's used for, Kafka is just a message queue."

πŸš€ Quick Start β€’ ✨ Features β€’ πŸ“– Documentation β€’ πŸ—ΊοΈ Roadmap


🧭 Onboarding Guide

If you're new to Kafka-Gov, we recommend the following onboarding path.

  1. Choose your mode

    • Just want to try the UI and features quickly β†’ Lite Mode (SQLite)
    • Running a team PoC or a more production-like environment β†’ Full Stack Mode (Docker + MySQL)
  2. Prepare your environment

    • Lite Mode:
      • Install Python 3.12+ and uv
      • If you do not set any DB-related values in .env, Kafka-Gov will automatically use SQLite
    • Full Stack Mode:
      • Install Docker / Docker Compose
      • Optionally adjust Kafka/Schema Registry settings in .env for your environment
  3. Configure the metadata database

    • Default: when nothing is configured, sqlite+aiosqlite:///./kafka_gov.db is used
    • MySQL example:
      KAFKA_GOV_DATABASE_URL=mysql+aiomysql://user:password@mysql:3306/kafka_gov?charset=utf8mb4
    • PostgreSQL example:
      KAFKA_GOV_DATABASE_URL=postgresql+asyncpg://user:password@postgres:5432/kafka_gov
  4. Run migrations

    • Alembic always uses settings.database.url, so as long as the URL is correct, migrations target the right DB.
    • Local (Lite Mode) example (recommended):
      bash script/migrate.sh
      # or, if executable
      ./script/migrate.sh
    • Advanced (run Alembic directly):
      uv run alembic upgrade head
    • In Docker environments, the migration service included in docker-compose.yml is responsible for running migrations.
  5. Open the UI and register your first connections

    • Open http://localhost:8000 in your browser
    • Register Kafka Cluster / Schema Registry connections directly through the UI
    • From then on, all governance metadata is stored in the selected DB (SQLite/MySQL/Postgres)

After onboarding, see Quick Start and Configuration for more details.


🌟 What is Kafka-Gov?

Kafka-Gov transforms Kafka from a simple message broker into a governed enterprise platform with:

  • 🏷️ Rich Metadata: Owner, team, tags, documentation links for every topic
  • πŸ›‘οΈ Policy Enforcement: Environment-specific rules (naming, replication, ISR)
  • πŸš€ Batch Operations: YAML-based bulk create/update/delete with dry-run
  • πŸ“¦ Schema Management: Integrated Schema Registry with auto-correlation
  • πŸ“Š Real-time Monitoring: Consumer lag, fairness index, stuck partition detection
  • πŸ“ Complete Audit Trail: Track every change (who, when, what, why)
Dashboard

πŸ’‘ Why Kafka-Gov?

Traditional Tools Kafka-Gov
❌ No ownership tracking βœ… Mandatory owner, team, tags
❌ No policy enforcement βœ… Environment-specific validation
❌ Manual one-by-one operations βœ… YAML-based batch operations
❌ No audit trail βœ… Complete change history
❌ Separate schema tool βœ… Integrated schema management

Problems we solve:

  • πŸ€” Who owns this topic? β†’ Track ownership across hundreds of topics
  • πŸ“ What is it for? β†’ Required documentation links
  • ⚠️ Policy violations? β†’ Auto-detect risky configs before deployment
  • πŸš€ Bulk operations? β†’ Create 50+ topics in one YAML file
  • πŸ”„ Change history? β†’ Complete audit trail with before/after snapshots

ν”„λ‘œμ νŠΈ λ°©ν–₯μ„±

Although we initially approached this project from a governance perspective, over time it started to drift toward operational concerns. To realign with its original direction β€” governance β€” we are refocusing on topics and scenario-based policy alerts as the core of the project.


πŸš€ Quick Start

Kafka-Gov supports Airflow-style metadata DB switching.

1) Lite Mode (SQLite, no Docker required)

For local development or quick evaluation, Kafka-Gov uses a SQLite file as the metadata store.

# 1. Clone and setup
git clone https://github.com/limhaneul12/kafka-gov.git
cd kafka-gov
cp .env.example .env

# 2. (optional) If you do not set any DB env vars, SQLite is used by default
#    When KAFKA_GOV_DATABASE_URL is unset, ./kafka_gov.db is created/used automatically

# 3. Install dependencies
uv sync

# 4. Run DB migrations (uses settings.database.url β†’ default SQLite)
bash script/migrate.sh

# 5. Start backend API
uv run uvicorn app.main:app --reload

# 6. (optional) Start frontend (from ./frontend)
# pnpm install
# pnpm dev

In this mode, the local file ./kafka_gov.db is used as the metadata database.

2) Full Stack Mode (Docker Compose + MySQL)

For production-like setups, use Docker Compose to start MySQL/Kafka/Schema Registry/Redis together.

# 1. Clone and setup
git clone https://github.com/limhaneul12/kafka-gov.git
cd kafka-gov
cp .env.example .env

# 2. Start all services (includes MySQL-backed metadata DB)
docker-compose up -d

# 3. Access web UI (proxied by nginx)
open http://localhost:8000

That's it! πŸŽ‰

See Quick Start Guide for more details.


✨ Features

🏷️ Rich Topic Metadata

Every topic includes owner, team, documentation URL, and custom tags:

name: prod.orders.created
metadata:
  owner: team-commerce
  doc: "https://wiki.company.com/orders"
  tags: ["orders", "critical", "pii"]

πŸš€ YAML-Based Batch Operations

Create dozens of topics at once:

kind: TopicBatch
env: prod
items:
  - name: prod.orders.created
    action: create
    config:
      partitions: 12
      replication_factor: 3

Upload β†’ Review dry-run β†’ Apply changes

Batch Operations

πŸ›‘οΈ Policy Enforcement

Environment-specific rules prevent production incidents:

Policy DEV PROD
Min Replication β‰₯ 1 β‰₯ 3 ⚠️
Min ISR β‰₯ 1 β‰₯ 2 ⚠️
'tmp' prefix βœ… 🚫

πŸ“Š Real-time Monitoring

  • Consumer lag tracking with p50/p95/max metrics
  • Fairness index (Gini coefficient) for partition distribution
  • Stuck partition detection with configurable thresholds
  • Rebalance stability scoring with time windows
  • WebSocket streaming for live updates
Monitoring

πŸ“¦ More Features


πŸ“– Documentation

Getting Started

Features

Architecture & API

Operations


πŸ› οΈ Tech Stack

Backend: Python 3.12+ β€’ FastAPI β€’ Pydantic v2 β€’ SQLAlchemy 2.0 β€’ Confluent Kafka
Frontend: React 19 β€’ TypeScript β€’ TailwindCSS β€’ Rolldown
Infrastructure: SQLite (Lite Mode) β€’ MySQL (Production) β€’ Kafka β€’ Schema Registry β€’ MinIO


πŸ—ΊοΈ Roadmap

v1.0 (Current):

  • βœ… Core governance features
  • βœ… Real-time monitoring
  • βœ… Policy enforcement

v1.1 (In Progress):

  • πŸ”„ Enhanced frontend filters
  • πŸ”„ Preset management UI

v2.0 (Planned):

  • πŸ“… RBAC & multi-tenancy
  • πŸ“… Prometheus/Grafana integration
  • πŸ“… GitOps integration

View Full Roadmap


🀝 Contributing

Contributions welcome! Please read our Contributing Guide before submitting PRs.

# Setup development environment
uv sync
uv run pytest --cov=app

# Code standards
uv run ruff check app/
uv run ruff format app/

πŸ“„ License

MIT License - see LICENSE for details.


Make Kafka safer and more efficient πŸš€

Made with ❀️ by developers, for developers

⭐ Star if you find this useful! ⭐