Event Coordination for Go. Zero Dependencies.

Type-safe signals, async workers with backpressure, and decoupled event flows across your entire application.

Get Started
import "github.com/zoobz-io/capitan"

// Define typed keys
orderID := capitan.NewStringKey("order_id")
total   := capitan.NewFloat64Key("total")

// Define a signal
orderCreated := capitan.NewSignal("order.created", "New order placed")

// Emit with typed fields
capitan.Emit(ctx, orderCreated,
    orderID.Field("ORD-123"),
    total.Field(99.99),
)

// Hook a listener — extract typed values directly
capitan.Hook(orderCreated, func(ctx context.Context, e *capitan.Event) {
    id, _ := orderID.From(e)      // string
    amount, _ := total.From(e)    // float64
    process(id, amount)
})

// Observe all signals — unified visibility
capitan.Observe(func(ctx context.Context, e *capitan.Event) {
    log.Info("event", "signal", e.Signal().Name())
})
99%Test Coverage
A+Go Report
MITLicense
1.24+Go Version
v1.0.2Latest Release

Why Capitan?

In-process event coordination that stays out of your way.

Type-Safe Fields

Typed keys with compile-time safety. No runtime assertions, no interface{} gymnastics.

Zero Dependencies

Nothing but the Go standard library. No bloat, no surprises.

Async by Default

Per-signal workers with buffered queues and backpressure. Slow listeners can't block others.

Panic-Safe

Listener panics are recovered automatically. One bad handler won't crash your system.

Cross-Cutting Observers

Observe all signals or a filtered subset for logging, metrics, and audit trails.

Testable

Sync mode, event capture, and isolated instances for deterministic tests.

Capabilities

Everything capitan provides for decoupled event coordination in Go.

FeatureDescriptionLink
Typed FieldsBuilt-in keys for primitives and NewKey[T] for any custom type — all compile-time safe.Fields
Per-Signal WorkersEach signal gets its own goroutine and buffered queue. Isolated, async, backpressure-aware.Architecture
ObserversCross-cutting handlers that see all signals or a filtered whitelist.Concepts
ConfigurationBuffer sizes, rate limits, drop policies, and panic handlers.Configuration
Graceful ShutdownDrain pending events before exit. Safe to call multiple times.Best Practices
Testing UtilitiesSync mode, event capture, and isolated instances for deterministic tests.Testing

Articles

Browse the full capitan documentation.

Learn

OverviewIn-process event coordination for Go applications
QuickstartGet started with capitan in minutes
Core ConceptsSignals, keys, fields, and listeners - the building blocks of capitan
ArchitectureInternal design, workers, buffering, and event flow

Guides

ConfigurationInstance options, per-signal configuration, and runtime monitoring
ContextRequest tracing, cancellation, and propagating values through events
ErrorsError fields, severity levels, and failure workflows
TestingUtilities for testing event-driven code
Best PracticesGuidelines for using capitan effectively in production
PersistenceEvent storage and replay for audit trails and debugging

Integrations

apertureOpenTelemetry observability from capitan events
heraldMessage broker bridge for distributed capitan events
agoWorkflow orchestration with capitan event choreography

Reference

API ReferenceComplete API reference for the capitan package
Fields ReferenceComplete reference for typed keys and fields
Testing Package ReferenceComplete reference for the capitan testing package