https://github.com/vfolgosa/bifrost-proxy
A lightweight Layer-7 Kafka proxy. Route traffic across clusters with port-based routing, SASL passthrough, and autonomous failover.
https://github.com/vfolgosa/bifrost-proxy
devops failover golang kafka kafka-proxy load-balancing proxy sre
Last synced: 3 days ago
JSON representation
A lightweight Layer-7 Kafka proxy. Route traffic across clusters with port-based routing, SASL passthrough, and autonomous failover.
- Host: GitHub
- URL: https://github.com/vfolgosa/bifrost-proxy
- Owner: vfolgosa
- Created: 2026-06-16T00:31:02.000Z (8 days ago)
- Default Branch: main
- Last Pushed: 2026-06-16T02:42:41.000Z (8 days ago)
- Last Synced: 2026-06-16T03:08:12.993Z (8 days ago)
- Topics: devops, failover, golang, kafka, kafka-proxy, load-balancing, proxy, sre
- Language: Go
- Homepage: https://github.com/vfolgosa/bifrost-proxy
- Size: 2.48 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Security: SECURITY.md
- Roadmap: docs/roadmap.md
Awesome Lists containing this project
README
# Bifrost โ Kafka L7 Proxy
> *"Route Kafka traffic across the nine realms."*
**Bifrost** is a lightweight, stateless **Layer-7 Apache Kafka proxy** written in Go. Routes Kafka protocol traffic using **port-based routing** โ each BU gets its own port, zero client-side changes beyond `bootstrap.servers`.
## โจ Features
| | |
|---|---|
| ๐ **Port-Based Routing** | One port per BU. No TLS/SNI required. |
| ๐ **SASL Passthrough** | Forwards SCRAM-SHA-512 and PLAIN credentials transparently. |
| ๐ **Metadata Rewrite** | Intercepts Metadata responses, rewrites broker addresses. |
| ๐๏ธ **Three Modes** | `active_passive` ยท `load_balance` ยท `single` |
| โค๏ธ **Health Checks** | SASL-authenticated Metadata pings with configurable thresholds. |
| ๐ **Live Dashboard** | Per-cluster health, records, bytes, failover events. |
| ๐ฅ **Hot Reload** | Edit `config.yaml` โ picks up changes without restart. |
| ๐ก **Prometheus** | `proxy_health_status` ยท `proxy_failover_total` ยท `proxy_connections_active` |
## ๐๏ธ Architecture
## ๐๏ธ Cluster Modes
## ๐ Quick Start
```bash
# Start everything (Kafka + Bifrost + Redpanda + Prometheus)
docker compose up -d
# Produce
echo "hello bifrost" | kcat -P -b localhost:9094 \
-X security.protocol=SASL_PLAINTEXT \
-X sasl.mechanisms=PLAIN \
-X sasl.username=admin -X sasl.password=admin-secret \
-t logistics-topic
# Consume
kcat -C -b localhost:9094 \
-X security.protocol=SASL_PLAINTEXT \
-X sasl.mechanisms=PLAIN \
-X sasl.username=admin -X sasl.password=admin-secret \
-t logistics-topic -o beginning -e
# Dashboard
open http://localhost:8080
```
## ๐ Monitoring
| Service | URL |
|---------|-----|
| Bifrost Dashboard | http://localhost:8080 |
| Prometheus | http://localhost:9090 |
| Redpanda kafka1 | http://localhost:8081 |
| Redpanda kafka2 | http://localhost:8082 |
## โ๏ธ Configuration
```yaml
proxy:
bind_address: "0.0.0.0"
metrics_port: 8080
clusters:
# active_passive โ DR failover
finance:
port: 9093
mode: "active_passive"
active: "primary"
primary: "pkc-11111.us-east-1.aws.confluent.cloud:9092"
secondary: "pkc-22222.us-east-2.aws.confluent.cloud:9092"
health_check:
enabled: true
auto_failover: true
auto_failback: false
# load_balance โ weighted distribution
logistics:
port: 9094
mode: "load_balance"
primary:
bootstrap: "pkc-33333.us-east-1.aws.confluent.cloud:9092"
weight: 70
secondary:
bootstrap: "pkc-44444.us-east-2.aws.confluent.cloud:9092"
weight: 30
health_check:
enabled: true
auto_rebalance: true
# single โ standalone cluster
# legacy:
# port: 9095
# mode: "single"
# primary: "old-kafka.internal:9092"
```
## ๐ Documentation
| Doc | Description |
|-----|-------------|
| [Consumer Behavior](docs/consumer-behavior.md) | How consumers work with load balancing, failover, ordering, and deduplication |
| [Failover & Message Durability](docs/failover.md) | Adaptive health checks, detection windows, message loss risk, client config |
| [Broker Rollout](docs/broker-rollout.md) | Proxy behavior during Kafka rolling restarts and leader changes |
| [Roadmap](docs/roadmap.md) | Planned features and next steps |
## ๐ Project Structure
```
bifrost-proxy/
โโโ cmd/proxy/ # Entry point
โโโ internal/
โ โโโ config/ # YAML parsing, validation, hot reload
โ โโโ protocol/ # Kafka wire protocol parser
โ โโโ proxy/ # TCP listener, connection handler, routing
โ โโโ routing/ # SASL, metadata, produce/fetch routing
โ โโโ pool/ # Connection pool, leader cache
โ โโโ health/ # Health check engine
โ โโโ failover/ # State machine, controller, rebalance
โ โโโ logger/ # Structured JSON logging
โ โโโ server/ # HTTP server + embedded dashboard
โโโ test/ # Test scripts
โโโ assets/ # Diagrams and branding
โโโ docker-compose.yml # Full dev stack
โโโ Dockerfile # Multi-stage build
โโโ config.example.yaml # Example config
```
## ๐ License
MIT