The type-safe, event-driven workflow orchestration library that scales with your business.
Build robust, distributed workflows in Go with compile-time safety, automatic retries, and horizontal scaling out of the box.
// Define your business logic as type-safe state machines
b := workflow.NewBuilder[Order, OrderStatus]("order-processing")
b.AddStep(OrderCreated, ProcessPayment, PaymentProcessed)
b.AddStep(PaymentProcessed, FulfillOrder, OrderCompleted)
wf := b.Build(kafkaStreamer, sqlStore, roleScheduler)Unlike other orchestrators, Workflow leverages Go generics for compile-time guarantees. Catch errors before deployment, not in production.
// Your IDE knows exactly what data flows where
func processPayment(ctx context.Context, r *workflow.Run[Order, OrderStatus]) (OrderStatus, error) {
// r.Object is typed as *Order, OrderStatus is your enum
// Compiler catches mismatches before they cause runtime errors
}Built for modern distributed systems. Steps communicate through durable events, enabling:
- Loose coupling between workflow components
- Automatic retries with exponential backoff
- Horizontal scaling across multiple instances
- Fault tolerance that survives network partitions
Your choice of database, message queue, and coordination service. Start simple, scale when needed:
// Development: Everything in-memory
wf := b.Build(memstreamer.New(), memrecordstore.New(), memrolescheduler.New())
// Production: Battle-tested infrastructure
wf := b.Build(kafkastreamer.New(), sqlstore.New(), rinkrolescheduler.New())Production-ready monitoring without the setup overhead:
- Prometheus metrics for throughput, latency, and error rates
- Web UI for real-time workflow visualization
- Structured logging with correlation IDs
- Distributed tracing support
- Order Processing: Payment, inventory, fulfillment pipelines
- User Onboarding: Multi-step verification and activation flows
- Financial Operations: Transaction processing with compliance checks
- Data Processing: ETL pipelines with validation and cleanup
- Approval Workflows: Multi-stakeholder review processes
| Feature | Workflow | Temporal | Zeebe/Camunda |
|---|---|---|---|
| Type Safety | β Compile-time (Go generics) | β Runtime validation | β Runtime (BPMN) |
| Architecture | β Event-driven state machines | ||
| Infrastructure | β Your choice (adapters) | β Requires Temporal cluster | β Requires external engine |
| Deployment | β Library in your app | β Separate server/workers | β Separate engine |
| Learning Curve | β Native Go patterns | β BPMN modeling | |
| Language | β Go-native |
go get github.com/luno/workflowpackage main
import (
"context"
"fmt"
"github.com/luno/workflow"
"github.com/luno/workflow/adapters/memstreamer"
"github.com/luno/workflow/adapters/memrecordstore"
"github.com/luno/workflow/adapters/memrolescheduler"
)
type TaskStatus int
const (
TaskStatusUnknown TaskStatus = 0
TaskStatusCreated TaskStatus = 1
TaskStatusProcessed TaskStatus = 2
TaskStatusCompleted TaskStatus = 3
)
type Task struct {
ID string
Name string
}
func main() {
b := workflow.NewBuilder[Task, TaskStatus]("task-processor")
b.AddStep(TaskStatusCreated, func(ctx context.Context, r *workflow.Run[Task, TaskStatus]) (TaskStatus, error) {
fmt.Printf("Processing: %s\n", r.Object.Name)
return TaskStatusProcessed, nil
}, TaskStatusProcessed)
b.AddStep(TaskStatusProcessed, func(ctx context.Context, r *workflow.Run[Task, TaskStatus]) (TaskStatus, error) {
fmt.Printf("Completed: %s\n", r.Object.Name)
return TaskStatusCompleted, nil
}, TaskStatusCompleted)
wf := b.Build(memstreamer.New(), memrecordstore.New(), memrolescheduler.New())
ctx := context.Background()
wf.Run(ctx)
defer wf.Stop()
// Trigger a workflow
runID, _ := wf.Trigger(ctx, "task-1", workflow.WithInitialValue(&Task{
ID: "task-1",
Name: "Process Invoice",
}))
// Wait for completion
wf.Await(ctx, "task-1", runID, TaskStatusCompleted)
fmt.Println("β
Workflow completed!")
}Workflow provides enterprise-grade features:
- β Exactly-once processing guarantees via transactional outbox pattern
- β Built-in error handling with pause and retry mechanisms
- β Comprehensive observability via Prometheus metrics and Web UI
- β Horizontal scaling through role-based scheduling
- β Infrastructure flexibility via pluggable adapters
- β Production deployment patterns for various scales
| Topic | Description |
|---|---|
| Getting Started | Install and build your first workflow |
| Core Concepts | Understand Runs, Events, and State Machines |
| Architecture | Deep dive into system design and components |
| Steps | Build workflow logic with step functions |
| Callbacks | Handle external events and webhooks |
| Timeouts | Add time-based operations |
| Connectors | Integrate with external event streams |
| Hooks | React to workflow lifecycle changes |
| Configuration | Tune performance and behavior |
| Monitoring | Observability and debugging |
| Adapters | Infrastructure integration guide |
| Example | Description |
|---|---|
| Order Processing | Complete e-commerce workflow with payments & fulfillment |
- π Documentation - Comprehensive guides and examples
- π Issues - Bug reports and feature requests
- π¬ Discussions - Community Q&A
go get github.com/luno/workflow
# Production adapters (install as needed)
go get github.com/luno/workflow/adapters/kafkastreamer
go get github.com/luno/workflow/adapters/sqlstore
go get github.com/luno/workflow/adapters/rinkrolescheduler
go get github.com/luno/workflow/adapters/webuiReady to build reliable workflows? Get started in 5 minutes β
