Introducing Firn — a durable event broker in Go
I’ve spent a good amount of time working with messaging systems — Kafka, RabbitMQ, NATS, SQS, you name it. Each one solves a specific problem well, but I always found myself wanting something simpler that could handle both streaming and queue workloads without dragging in a whole ecosystem of dependencies. That itch led me to build Firn.
Firn is a from-scratch event broker written in Go. It provides streaming (topics, partitions, offsets, consumer groups) and queue (ack, redelivery, DLQ) semantics over a shared append-only log. It’s MIT licensed, secure by default, and ships as a single binary.
What Firn is
At its core, Firn is an event broker with two modes of consumption over the same log:
| Mode | Semantics | Use case |
|---|---|---|
| Stream | Topics, partitions, offsets, consumer groups | Event streams, replayable logs, fan-out consumers |
| Queue | Pull, ack, visibility timeout, redelivery, DLQ | Work queues, task processing, at-least-once delivery |
The idea is simple: you shouldn’t need separate infrastructure for “Kafka-style” streaming and “RabbitMQ-style” queueing when the underlying primitive is an append-only log.
Quick start
Getting Firn running locally is straightforward:
make build # go build ./...
make verify # go vet ./... && go test ./...
go run ./cmd/firnd # HTTP admin/health on :9460, gRPC on :9461; data persisted in ./data
Once it’s up:
curl localhost:9460/healthz
curl localhost:9460/metrics
curl -X POST localhost:9460/topics -d '{"name":"orders","partitions":3}'
curl localhost:9460/topics
The broker exposes two surfaces — an HTTP admin/operations port (:9460) and a gRPC data plane (:9461). firn-cli wraps the same APIs so you don’t have to hand-craft requests.
Stream mode
Stream topics work the way you’d expect. You create a topic with partitions, produce records, and consume them through consumer groups with committed offsets.
curl -X POST localhost:9460/topics -d '{"name":"orders","partitions":3,"mode":"stream"}'
Consumer groups support JoinGroup, SyncGroup, Heartbeat, and LeaveGroup, with range and round-robin assignment strategies. Committed offsets are stored in __consumer_offsets and survive restarts — membership does not, which keeps the recovery model simple.
Queue mode
Queue mode is where things get interesting. You create a queue topic, pull messages with a visibility lease, and ack them when done.
# create a queue topic
curl -X POST localhost:9460/topics -d '{"name":"jobs","partitions":1,"mode":"queue"}'
# pull up to 10 messages (30s default visibility lease)
curl -X POST localhost:9460/queues/jobs/pull -d '{"max_messages":10,"visibility_timeout_ms":30000}'
# ack a delivery
curl -X POST localhost:9460/queues/jobs/ack -d '{"delivery_id":"<id from pull>"}'
If a message isn’t acked before the visibility lease expires, it gets redelivered. After 3 delivery attempts, it gets diverted to jobs.dlq, which is auto-created as a stream topic. The guarantee is at-least-once, per-message, with best-effort ordering.
Secure by default
One thing I wanted to get right early was security. A fresh Firn broker is fail-closed — it serves only /healthz until you mint the first API key.
On first start, firnd prints a one-time bootstrap token to stderr. You use that token to create the first admin key, and from that point on, bearer auth is enforced everywhere except /healthz.
# bootstrap: create the first (admin) key before serving traffic
curl -X POST localhost:9460/apikeys -d '{"name":"root","role":"admin"}'
firn-cli -api-key 'ev-…' list
A few details that matter in practice:
- Keys are SHA-256-hashed and stored in the replicated
__api_keysinternal topic - Roles are
viewer<operator<admin - Per-key token-bucket rate limiting (default 100 ops/s)
- Anonymous traffic is rate-limited per IP
- Admin mutations are recorded in the replicated
__audittopic - TLS support for both listeners with
-tls-cert/-tls-key(min TLS 1.2) - A read-only admin UI at
/ui/
For local development, you can pass -dev to re-enable open mode — but it’s loud about it, as it should be.
Cluster mode
Firn supports a 3-node cluster mode with an embedded Raft quorum — no ZooKeeper, no etcd. Topics and their blocks replicate across the cluster, and the client just needs the node list.
firn-cli -peers 127.0.0.1:9538,127.0.0.1:9540,127.0.0.1:9542 \
-http-peers 127.0.0.1:9537,127.0.0.1:9539,127.0.0.1:9541 \
create-topic --name orders --partitions 3
Cluster mode is GA as of v0.5.0, validated on 2-node and 3-node clusters covering topics, produce/fetch, consumer groups, queue lifecycle (including DLQ diversion), replication catch-up, and kill -9 + restart round-trips.
That said, it’s important to be honest about the envelope. Cluster mode today is single-region, fixed membership (no dynamic join/leave), and needs 3+ voting nodes for HA. A 2-node cluster is fine for dev/test, but it can’t lose a node. There’s no rolling upgrade without a restart window, and unsealed tails (≤ lease TTL / seal interval) are the at-risk window. The operator docs lay this out clearly.
Federation (preview)
Firn also has a preview of multi-cluster federation. Two or more clusters can replicate topics and queues between them over mTLS with a federation-scoped key.
There are two modes per peer:
- Passive — one-way DR. The sink stays fenced and offsets are preserved byte-identically until an operator cuts over.
- Active-active — both clusters accept writes. Records are re-originated per cluster with fresh local offsets, while timestamp, key, and value are preserved. Echo is filtered server-side.
It’s still in preview, but the building blocks are there — selective per-topic/per-queue scoping, federation-specific keys, CLI commands for peer management, cursor lag metrics, and a read-only /ui/federation view.
Observability
Observability was not an afterthought. Firn exposes Prometheus metrics at /metrics, emits structured JSON logs via log/slog, and includes an audit log for admin mutations. The SRE docs cover the metrics catalog, scrape config, alerting rules, and on-call workflows.
For day-to-day operations, the read-only admin UI at /ui/ gives a quick view into what’s happening without needing to wire up a full dashboard first.
Installation options
Firn has three supported installation paths, all designed to prompt for what they need (TLS, cluster peers, mesh CA, data dir):
- Linux (systemd) / macOS (launchd) —
sudo ./packaging/install.sh - Kubernetes — plain manifests in
deploy/k8s/or the Helm chart indeploy/helm/firn/ - Docker / Podman — image
ghcr.io/rahulkj/firn:v<tag>with compose files indeploy/compose/
Documentation and design
One thing I’ve tried to do with Firn is document the “why”, not just the “how”. The repo has a solid set of docs — install, configuration, API reference, operator guide, developer guide, SRE guide, comparison matrix, migration playbooks, and more.
The design decisions are captured as ADRs, starting from scope and API surface all the way through storage invariants, consistency, cluster design, federation, security model, and group commit. If you’re curious about the system map, ADR-012 is a good place to start.
Where it fits (and where it doesn’t)
Firn isn’t trying to replace Kafka for every use case. If you need a massive ecosystem of connectors, years of battle-tested tooling, or very specific semantics from an established platform, those systems exist for a reason.
Where Firn shines is when you want a simpler, self-contained broker that can do both streaming and queueing, is easy to operate, and doesn’t require a pile of external dependencies to get a secure cluster running. The comparison doc in the repo goes into the details — including where Firn wins and where it loses.
If you’ve been looking for a lightweight event broker that speaks both stream and queue, give Firn a look. The docs site has the full reference, and the repo is the best place to dig into the design.
Enjoy!