Skip to content

Install pgflow

Let’s set up pgflow in your Supabase project. This setup needs to be done only once per project.

You can install pgflow using the automatic installer (recommended) or manually if you want more control over the process.

Run the automatic installer with npx:

npx pgflow@latest install

The installer will:

  • Detect your Supabase project automatically or allow you to specify it manually
  • Update your config.toml to enable connection pooling
  • Copy the required migrations to your migrations folder (with timestamps that ensure they run after your existing migrations)
  • Create a functions environment file if needed
  • Prevent duplicate migrations if you run the installer multiple times

Restart your Supabase instance to apply the configuration changes:

npx supabase stop
npx supabase start

If you haven’t already, apply the migrations to create the pgflow schema and tables:

npx supabase migrations up

The installer set up:

  1. Database schema - Tables for workflow definitions and runtime state
  2. SQL functions - Core functions to create, start, and manage workflows
  3. Connection pooling - Required for Edge Worker operation
  4. Environment variables - Database connection for Edge Functions
  5. Smart migrations - Migration files are copied with timestamps that ensure they run after your existing migrations and won’t be duplicated if you upgrade pgflow later

Your Supabase project now has everything needed to create and run workflows with pgflow!