Workflow
Type-safe workflow orchestration for Go. Event-driven state machines with pluggable infrastructure.
Stop gluing services together with ad-hoc retry loops and home-grown state machines. Workflow gives you a production-grade primitive for multi-step processes that are reliable, observable, and maintainable — backed by Go generics for full compile-time safety.
Capabilities
Everything you need in production
Architecture
How it works
Workflow models your domain as an event-driven state machine. Each step listens on a stream, processes a record transactionally, and advances its status. The pluggable layer means you choose the infrastructure — Workflow handles the rest.
State Transitions
Auto-generated state diagrams
Workflow auto-generates Mermaid state diagrams from your workflow definition. Every possible transition is documented without any extra effort — always in sync with the code.
Example
Clean by design
No YAML. No DSL. Just Go. Define your domain types, wire up your steps, and hand off infrastructure at build time. The generics keep every status transition compile-time safe.
// Define your domain types
type Order struct { ID string; Total float64 }
type Status int
const (
Created Status = iota
PaymentProcessed
Fulfilled
)
// Build the workflow
b := workflow.NewBuilder[Order, Status]("orders")
b.AddStep(Created, processPayment, PaymentProcessed)
b.AddStep(PaymentProcessed, fulfillOrder, Fulfilled)
wf := b.Build(
kafkastreamer.New(brokers),
sqlstore.New(db),
rinkrolescheduler.New(client),
)
// Run and trigger
ctx := context.Background()
wf.Run(ctx)
defer wf.Stop()
runID, _ := wf.Trigger(ctx, "order-123",
workflow.WithInitialValue(&Order{ID: "123", Total: 99.99}),
)Integrations
Bring your own infrastructure
First-party adapters for the most common stacks. Swap any layer without touching your workflow logic.
Event Streaming
Persistence
Coordination
Monitoring
Open source
Try Workflow
Workflow is MIT licensed, production-grade, and actively maintained. Star it on GitHub or reach out to talk about your use case.
