Skip to content

compilation

1 post with the tag “compilation”

pgflow 0.9.0: Control Plane and HTTP-Based Compilation

pgflow 0.9.0 introduces the ControlPlane edge function, enabling HTTP-based flow compilation without requiring a local Deno installation.

The CLI no longer spawns Deno processes locally. Instead, compilation requests go through the ControlPlane edge function:

pgflow compile my_flow --> ControlPlane --> SQL migration

This simplifies the development setup and lays groundwork for future auto-compilation features where workers will verify and compile flows at startup without any CLI involvement.

The pgflow compile command now takes a flow slug instead of a file path:

Before (0.8.x):

pgflow compile path/to/my_flow.ts --deno-json supabase/functions/deno.json

After (0.9.0):

pgflow compile my_flow

The --deno-json flag has been removed.

The installer now scaffolds a complete working setup:

npx [email protected] install

This creates:

  • supabase/flows/ - Directory for flow definitions with namespace imports
  • supabase/flows/greet-user.ts - Example GreetUser flow
  • supabase/functions/pgflow/ - Control Plane for compilation
  • supabase/functions/greet-user-worker/ - Example worker ready to run

The installer shows a clear summary and asks for a single confirmation before making changes.

ControlPlane now supports namespace imports, the recommended pattern:

import { ControlPlane } from '@pgflow/edge-worker';
import * as flows from '../../flows/index.ts';
ControlPlane.serve(flows);

Add flows by exporting from flows/index.ts:

export { GreetUser } from './greet-user.ts';
export { MyOtherFlow } from './my-other-flow.ts';

Existing compiled flows continue to work - no recompilation needed.

To compile new flows with v0.9.0:

  1. Run npx [email protected] install to add the ControlPlane and supabase/flows/ directory
  2. Create new flow files in supabase/flows/
  3. Export them from supabase/flows/index.ts

The --deno-json flag has been removed. Compilation now uses the ControlPlane edge function instead of local Deno. If you used this flag in CI/CD scripts, update them to use the new compilation approach.

Chat with Author