Skip to content

What is Turbine?

Turbine is a SQLite-based durable workflow engine for Go. No external dependencies, single binary.

You define workflows as Go functions. Turbine handles persistence, retries, scheduling, and recovery.

Turbine dashboard

Install

bash
go get github.com/YakirOren/turbine

Use Cases

Background Jobs

Enqueue work to run asynchronously with concurrency control and rate limiting.

go
handle, err := turbine.Run(rt, SendEmail, recipient,
    turbine.WithQueue("emails"),
)

Multi-Step Pipelines

Each step checkpoints its result. If the process crashes, it resumes from the last completed step.

go
func OrderWorkflow(ctx turbine.Context, orderID string) (string, error) {
    charge, err := turbine.Do(ctx, ChargePayment, turbine.WithStepName("charge"))
    if err != nil {
        return "", err
    }

    _, err = turbine.Do(ctx, ShipOrder, turbine.WithStepName("ship"))
    if err != nil {
        return "", err
    }

    return fmt.Sprintf("order %s shipped (charge: %s)", orderID, charge), nil
}

Scheduled Tasks

Run workflows on a cron schedule using the built-in scheduler.

go
turbine.Register(rt, DailyCleanup, turbine.WithSchedule("0 3 * * *"))

Human-in-the-Loop

Pause a workflow and wait for a human decision. Survives crashes and restarts.

go
result, err := turbine.WaitForApproval(ctx)
if !result.Approved {
    return "rejected: " + result.Comment, nil
}

Rate-Limited Queues

Control concurrency, enforce rate limits, and partition work across tenants.

go
rt.Queue("api-calls",
    turbine.WithWorkerConcurrency(5),
    turbine.WithRateLimiter(turbine.RateLimiter{Limit: 100, Period: time.Minute}),
    turbine.WithPartitionQueue(),
)

Features

FeatureDescription
Durable StepsStep results recorded in SQLite, replayed on recovery
Step RetriesAutomatic retries with exponential backoff
QueuesConcurrency control, priority, rate limiting, partitioning
SchedulingCron expressions via the built-in scheduler
CommunicationInter-workflow messaging and key-value events
ApprovalsHuman-in-the-loop approval gates
ProductsFile outputs from workflows
KV StoreGlobal persistent key-value storage
WebhooksHTTP notifications on workflow completion
DashboardBuilt-in UI for monitoring workflows, queues, and schedules