cleat

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: Apache-2.0

README

cleat

CI Go Version License Go Report Card Discord Go Reference

Durable workflow engine -- runs on PostgreSQL, MySQL, or SQL Server. Write in Go, compile to WASM, deploy via INSERT.

go install github.com/cleat-team/cleat/cmd/cleat@latest
cleat dev --entry-point PlaceOrder \
    --input '{"userID":"u1","cart":[{"sku":"widget","quantity":2}]}' \
    ./testdata/basic/

What is Cleat

Cleat is a durable workflow engine that turns your existing PostgreSQL, MySQL, or SQL Server database into an orchestration backend. Workflows are written in Go (or Rust), compiled to WebAssembly, and stored directly in the database. A stateless Go worker daemon polls the database, claims ready workflows, and drives execution with deterministic replay, checkpointing, and failover -- no new infrastructure required.

Cleat ships with an embedded Svelte web UI for monitoring, a CLI for build/deploy/ management, and a WASM-free test framework for fast unit tests. It is self-hosted, Apache 2.0 licensed, and designed for teams that already run a supported relational database.

Quick Start

# 0. Verify your toolchain (one command)
make setup

# 1. Install the CLI
go install github.com/cleat-team/cleat/cmd/cleat@latest

# 2. Start Postgres and apply the schema. `cleat-worker` (step 5) also
#    applies migrations/postgres/*.sql automatically on boot, but `cleat
#    deploy` (step 4) does not, and deploy runs first in this walkthrough --
#    so the schema has to exist before that. See
#    docs/explanation/postgresql-schema.md for the full procedure.
docker compose -f docker-compose.partner.yml up -d postgres
for f in migrations/postgres/*.sql; do
    psql "postgres://postgres:postgres@localhost:5432/cleat?sslmode=disable" -f "$f"
done

# 3. Compile a workflow package to WASM
cleat build -o ./out ./testdata/basic/
# Wrote ./out/cancel_order.wasm -- cleat build bundles every entry point
# in the package (PlaceOrder, CancelOrder, LongRunning) into one module,
# named after the first entry point it found. All three are still callable
# from that one file; --entry-point at trigger time (step 6) picks one.

# 4. Deploy to your database
cleat deploy --db "postgres://postgres:postgres@localhost:5432/cleat?sslmode=disable" \
    --name place_order ./out/cancel_order.wasm

# 5. Start the worker daemon
cleat-worker --db "postgres://postgres:postgres@localhost:5432/cleat?sslmode=disable"

# 6. Trigger a workflow (via REST API) -- POST .../<name>/start, not POST
#    .../workflows (that route is GET-only and returns 405 on POST)
curl -X POST http://localhost:8080/api/workflows/place_order/start \
    -d '{"input":{"userID":"u1","cart":[{"sku":"widget","quantity":2}]},"entry_point":"PlaceOrder"}'

See the Quick Start Tutorial for a complete walkthrough with a real-world example.

Key Features

  • Durable execution -- deterministic replay via event history; workflows survive worker crashes, restarts, and network partitions.
  • Multi-DB backends -- PostgreSQL 16+, MySQL 8.0+, SQL Server 2022+, each with an independent implementation of the full workflow store. Database-enforced tenant isolation (row-level security) exists on PostgreSQL and SQL Server -- FORCEd RLS policies on PostgreSQL, a native SECURITY POLICY/FILTER PREDICATE on SQL Server. MySQL has no row-level security feature at all, so it is documented single-tenant only rather than emulating isolation the database can't back up (see docs/reference/multi-tenancy.md). All of the above is engine support, not CLI support: the cleat CLI (deploy, versions, rollback, schedule, lock, plugin) only connects to PostgreSQL today, and refuses a MySQL or SQL Server connection string with an explicit error rather than a confusing driver failure. cmd/deploy-workflow --driver mysql|mssql is the one multi-dialect entry point, and it covers deploy only (see tiers.yaml).
  • Plugin system -- extensible via LLM, Slack, webhooks, and custom plugins; plugins run in-process with lifecycle hooks.
  • WASM workflows -- write in Go, Rust, Python, Java, or AssemblyScript, compile to WebAssembly. wasmtime is the backend of record (CPU/wall-clock/memory limits via epoch interruption, fuel, and store limits); wazero is a pure-Go, CGO-less fallback with no compute-bound fencing -- see docs/explanation/security-model.md.
  • Signals and human-in-the-loop -- AwaitSignals pauses workflows for external input; signals are recorded in the event history for deterministic replay.
  • Saga / compensating transactions -- structured rollback with DurableDefer, DurableDeferFunc, and cleat.NewSaga().
  • Horizontal scaling -- stateless workers, SELECT ... FOR UPDATE SKIP LOCKED claim model, scale out by adding worker processes.
  • CLI toolchain -- cleat build, vet, deploy, versions, rollback, and cron schedule management.
  • Observability -- embedded Svelte web UI, Prometheus metrics, structured logging.

Documentation

Section Description
Tutorials Step-by-step walkthroughs: quick start, first workflow, signals
How-To Guides Practical guides: plugins, testing, deployment
Reference CLI reference, SDK API, worker configuration
Explanation Architecture, execution model, security, WASM compilation
Operations Production deployment, disaster recovery, upgrading
Migration Guides Migrating from Temporal, DBOS, Restate
Contributor Guide Setting up a dev environment, coding standards, PR process

Start at the Documentation Home to find the right page for your goal.

Installation

# Install all CLI tools
go install github.com/cleat-team/cleat/cmd/cleat@latest
go install github.com/cleat-team/cleat/cmd/cleat-worker@latest
go install github.com/cleat-team/cleat/cmd/cleat-gen@latest

Or build from source: git clone https://github.com/cleat-team/cleat.git && cd cleat && go install ./cmd/...

License

Apache 2.0. See LICENSE for details.

Directories

Path Synopsis
Package auth provides tenant-aware API key authentication for cleat.
Package auth provides tenant-aware API key authentication for cleat.
cleat module
cmd
cleat command
Command cleat is the workflow transformer CLI.
Command cleat is the workflow transformer CLI.
cleat-bench command
Command cleat-bench is a performance benchmark tool for cleat workers.
Command cleat-bench is a performance benchmark tool for cleat workers.
cleat-gen command
Command cleat-gen generates typed client wrappers for cleat services.
Command cleat-gen generates typed client wrappers for cleat services.
cleat-plugin-verify command
Command cleat-plugin-verify validates that all DurableCall/PluginCall plugin names in workflow Go files match registered plugin names.
Command cleat-plugin-verify validates that all DurableCall/PluginCall plugin names in workflow Go files match registered plugin names.
cleat-worker command
Command cleat-worker is a production worker daemon for executing cleat workflows.
Command cleat-worker is a production worker daemon for executing cleat workflows.
cleatctl command
Command cleatctl is a CLI tool for managing Cleat workflow versions, deployments, and operational tasks.
Command cleatctl is a CLI tool for managing Cleat workflow versions, deployments, and operational tasks.
deploy-workflow command
Command deploy-workflow deploys a workflow WASM binary to a cleat database.
Command deploy-workflow deploys a workflow WASM binary to a cleat database.
wit-rewrite command
Package engine provides the core workflow execution engine for cleat.
Package engine provides the core workflow execution engine for cleat.
internal
analyzer
Package analyzer loads Go packages with full type information and builds the internal representation used by the rest of the WASM compilation pipeline: call graph construction, closure computation, and AST transformation.
Package analyzer loads Go packages with full type information and builds the internal representation used by the rest of the WASM compilation pipeline: call graph construction, closure computation, and AST transformation.
callgraph
Package callgraph builds a directed graph of function calls within user packages and identifies cleat leaves (functions that directly call HostCalls methods).
Package callgraph builds a directed graph of function calls within user packages and identifies cleat leaves (functions that directly call HostCalls methods).
closure
Package closure computes the transitive closure of cleat functions, validates supported Go constructs, and verifies HostCalls threading.
Package closure computes the transitive closure of cleat functions, validates supported Go constructs, and verifies HostCalls threading.
plugingen
Package plugingen provides multi-language code generation from cleat plugin manifests.
Package plugingen provides multi-language code generation from cleat plugin manifests.
telemetry
Package telemetry provides OpenTelemetry tracing initialization and span helpers for cleat workflows.
Package telemetry provides OpenTelemetry tracing initialization and span helpers for cleat workflows.
transform
Package transform implements AST source-to-source transformation that automatically threads cleat.HostCalls through the cleat closure.
Package transform implements AST source-to-source transformation that automatically threads cleat.HostCalls through the cleat closure.
Package migration provides a lightweight SQL migration runner for cleat.
Package migration provides a lightweight SQL migration runner for cleat.
monitoring
prometheus
Package prometheus provides OpenTelemetry-based metrics instrumentation for the cleat workflow engine.
Package prometheus provides OpenTelemetry-based metrics instrumentation for the cleat workflow engine.
packages
cleat-as/test_runner
Package test_runner provides a Go test harness for AssemblyScript cleat workflows compiled to WASM.
Package test_runner provides a Go test harness for AssemblyScript cleat workflows compiled to WASM.
Package plugin provides a minimal plugin system for cleat.
Package plugin provides a minimal plugin system for cleat.
Package pluginapi is a compatibility shim that re-exports types from github.com/cleat-team/cleat/plugin.
Package pluginapi is a compatibility shim that re-exports types from github.com/cleat-team/cleat/plugin.
plugins
auditlog
Package auditlog provides a comprehensive audit trail of all API access.
Package auditlog provides a comprehensive audit trail of all API access.
blobstore
Package blobstore provides content-addressed blob storage with metadata queries, tenant isolation, and TTL-based expiry.
Package blobstore provides content-addressed blob storage with metadata queries, tenant isolation, and TTL-based expiry.
dag
Package dag provides the host-side half of the DAG composition model: DAGSpec/TaskSpec (a JSON-serializable DAG description) and ParseSpec, which structurally validates a spec without needing the cleat/ SDK.
Package dag provides the host-side half of the DAG composition model: DAGSpec/TaskSpec (a JSON-serializable DAG description) and ParseSpec, which structurally validates a spec without needing the cleat/ SDK.
datadogexport
Package datadogexport exports workflow metrics to Datadog.
Package datadogexport exports workflow metrics to Datadog.
email
Package email provides SendGrid transactional email integration for workflows.
Package email provides SendGrid transactional email integration for workflows.
eventstore
Package eventstore provides append-only event streams with Server-Sent Events (SSE) support.
Package eventstore provides append-only event streams with Server-Sent Events (SSE) support.
eventtriggers
Package eventtriggers provides event-driven workflow triggers.
Package eventtriggers provides event-driven workflow triggers.
featureflags
Package featureflags provides feature flag evaluation with targeting rules and gradual rollout.
Package featureflags provides feature flag evaluation with targeting rules and gradual rollout.
jobqueue
Package jobqueue provides a standalone job queue.
Package jobqueue provides a standalone job queue.
kafkaconnect
Package kafkaconnect provides Kafka publish and consume capabilities for workflows.
Package kafkaconnect provides Kafka publish and consume capabilities for workflows.
kvstore
Package kvstore provides a versioned JSONB key-value store with optimistic concurrency control.
Package kvstore provides a versioned JSONB key-value store with optimistic concurrency control.
llm
llm/providers
Package providers defines shared types for LLM provider implementations.
Package providers defines shared types for LLM provider implementations.
notifications
Package notifications provides webhook delivery with retry and delivery tracking.
Package notifications provides webhook delivery with retry and delivery tracking.
oauthprovider
Package oauthprovider provides OAuth2/OIDC authentication with support for Google, GitHub, and Okta as identity providers.
Package oauthprovider provides OAuth2/OIDC authentication with support for Google, GitHub, and Okta as identity providers.
pagerdutyalert
Package pagerdutyalert provides PagerDuty incident management from workflows.
Package pagerdutyalert provides PagerDuty incident management from workflows.
ratelimiter
Package ratelimiter provides per-tenant rate limiting middleware using a token bucket algorithm.
Package ratelimiter provides per-tenant rate limiting middleware using a token bucket algorithm.
scheduledbackup
Package scheduledbackup provides scheduled PostgreSQL backups with pg_dump.
Package scheduledbackup provides scheduled PostgreSQL backups with pg_dump.
scheduler
Package scheduler provides user-managed cron schedules that trigger workflow executions.
Package scheduler provides user-managed cron schedules that trigger workflow executions.
slacknotify
Package slacknotify provides Slack webhook integration for workflows.
Package slacknotify provides Slack webhook integration for workflows.
webhookingest
Package webhookingest receives inbound webhooks from external services (GitHub, Stripe, etc.) and delivers them as workflow signals.
Package webhookingest receives inbound webhooks from external services (GitHub, Stripe, etc.) and delivers them as workflow signals.
tests
Package wasm provides WASM compilation, binary scanning, metadata embedding, and component model support for cleat workflows.
Package wasm provides WASM compilation, binary scanning, metadata embedding, and component model support for cleat workflows.
Package wasmrw provides encoding helpers for WASM host function return values.
Package wasmrw provides encoding helpers for WASM host function return values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL