Skip to content

Run reliable AI Workflows and Background Jobs directly in Supabase

With pgflow, you can seamlessly run workflows directly in Supabase, ensuring reliability and visibility without adding extra infrastructure.
Terminal window
npx pgflow@latest install
Sets up pgflow in your Supabase project. View full setup guide →

While Supabase provides the essential building blocks, pgflow brings enhanced orchestration for advanced workflow management.

Real comments after seeing early demos

Have you run into any of these situations?

Section titled “Have you run into any of these situations?”

As apps grow, a little extra coordination can save a lot of engineering time. pgflow steps in right there:

Bringing the Pieces Together

Queues and Edge Functions shine on their own. pgflow wraps them in one orchestration interface, so you write features-not glue code.

Wanting a Bird’s-Eye View

When your workflows span several functions or use multiple cron schedules, it’s handy to follow progress from a single place. pgflow’s approach prioritizes at-a-glance visibility for runs, step states, retries and outputs.

Extra Type Confidence

Define workflows in TypeScript and get a compile-time safety for the data flow between steps.

Keeping Everything Inside Supabase

All state, retries, and dependencies stay in the Postgres database you already trust-no extra services required.

pgflow works in harmony with Supabase’s tools, simplifying orchestration and enabling a more cohesive workflow.

Eliminate manual orchestration with Postgres‑native workflows, zero extra servers, and built‑in reliability

Postgres-Native Orchestration

pgflow handles state transitions, dependencies, and execution control directly inside in your Supabase Postgres database. Everything is self-contained.

Durable Queue-Based Workers

Edge Functions pull tasks from a Postgres queue with automatic retries, back‑offs, and concurrency limits.

Simple, Typed Flow Definitions

You specify flow logic once. pgflow enforces retries, timeouts, and step dependencies without custom plumbing.

Zero Extra Infra, Zero Lock-In

Everything stays in your Supabase project. No extra runtimes, no vendor dashboards.

  • AI Workflows: Chain LLMs, scrape data, reason across tools, and recover from failures - all natively in Supabase.
  • Background Jobs: Handle emails, file processing, and scheduled tasks with full visibility
  • Data Pipelines: Extract, transform, and load data across systems without losing track of progress

A complete workflow engine built on Postgres

Section titled “A complete workflow engine built on Postgres”

pgflow is a workflow orchestration system with its core state management in your database, combining:

SQL Core

Manage workflow state and transitions natively in Postgres with full ACID compliance

TypeScript DSL

Type-safe workflows with automatic inference and end-to-end compile-time safety.

Edge Worker

Auto-respawning, continuously running worker for low latency, reliable task execution.

CLI Tools

One-command setup: quickly deploy pgflow with automatic DB migrations.

Define parallel, type-safe DAG workflows effortlessly.

new Flow<{ url: string }>({
slug: 'analyze_website',
})
.step(
{ slug: 'website' },
async (input) => await scrapeWebsite(input.run.url)
)
.step(
{ slug: 'summary', dependsOn: ['website'] },
async (input) => await summarizeWithAI(input.website.content)
)
.step(
{ slug: 'tags', dependsOn: ['website'] },
async (input) => await extractTags(input.website.content)
)
.step(
{ slug: 'saveToDb', dependsOn: ['summary', 'tags'] },
async ({ run, summary, tags }) =>
await saveWebsite({
user_id: run.user_id,
website_url: run.url,
summary,
tags,
})
);

Single source of truth

All workflow definitions, state, and execution history stored in your Postgres database-simplifying monitoring and debugging.

Reliable task processing

Automatic retries, timeouts, at-least-once delivery and dead-letter handling built directly into your database.

Supabase-native

Deploy as Edge Functions with automatic restarts and zero-config integration with your existing Supabase project.

Developer experience

Full type inference between workflow steps with IDE autocompletion and compile-time safety for your entire workflow DAG.

Create and run workflows with a straightforward process:

  1. Define workflows using TypeScript DSL
  2. Compile them to SQL migrations
  3. Deploy as Supabase Edge Functions
  4. 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.