"Things just happen. What the hell. And the reason things just happen is that a hundred billion other things just happened, all working unheeded and unseen, to make sure that they do."
–- Terry Pratchett, Last Continent, reflecting on the elegant machinery of complex systems
pgflow is a workflow orchestration system that runs directly in your Postgres database - ideal for building reliable AI workflows, background jobs, and data pipelines on Supabase without external services.
The system combines:
- SQL Core - Workflow state management natively in Postgres with ACID compliance
- TypeScript DSL - Type-safe workflow definitions with automatic inference
- Edge Worker - Auto-respawning task processor that handles retries and concurrency
- CLI Tools - One-command setup with automatic schema migrations
The pgflow documentation is available on pgflow.dev.
File an issue on GitHub or join our Discord.
When you need more than just isolated background jobs, but don't want the complexity of external orchestration systems:
- Postgres as the Single Source of Truth - All definitions, state, and history in your database
- Zero Infrastructure - No external services, dashboards, or control planes
- Type-Safe Workflows - Full compile-time safety between workflow steps
- Reliable Background Jobs - Automatic retries with backoff and observability
- AI Workflows - Chain LLMs, scrape data, reason across tools, and handle failures
- Background Jobs - Process emails, files, and scheduled tasks with full visibility
- Data Pipelines - Extract, transform, and load data with built-in dependency handling
- Define workflows using TypeScript DSL
- Compile them to SQL migrations
- Deploy as Supabase Edge Functions
- Trigger workflows from your app or SQL
The execution system handles the rest - scheduling steps when dependencies complete, retrying failed tasks, and aggregating results automatically.
Package | Description |
---|---|
cli | Command-line interface for installing and compiling flows |
core | SQL Core for the workflow engine - foundational tables and functions |
dsl | TypeScript DSL for defining flows with type inference |
edge-worker | Task queue worker for Supabase Edge Functions with reliability features |
website | Documentation site |
example-flows | Example workflow definitions |
- 📖 Documentation: pgflow.dev
- 🚀 Demo: pgflow-demo.netlify.app
- 🛠️ Getting Started: pgflow.dev/getting-started
Note
This project and all its components are licensed under Apache 2.0 license.