You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pgflow compiles TypeScript flow definitions to SQL migrations via an HTTP-based architecture. This design eliminates the need for a local Deno installation and ensures compilation uses the same runtime as production.
11
+
12
+
## How It Works
13
+
14
+
When you run `pgflow compile greet_user`, the following happens:
-**Registers flows** by slug in an in-memory registry
58
+
-**Exposes** the `/flows/:slug` endpoint for compilation
59
+
-**Returns 404** if a flow slug is not found in the registry
60
+
-**Returns 500** with error details if compilation fails
61
+
62
+
## Why HTTP-Based Compilation?
63
+
64
+
This architecture provides several benefits:
65
+
66
+
**No local Deno required** - Users don't need Deno installed on their machine. The Supabase Edge Functions runtime handles everything.
67
+
68
+
**Same runtime as production** - Flows are compiled using the exact same Deno environment they'll run in, eliminating "works on my machine" issues.
69
+
70
+
**Consistent dependency resolution** - The `deno.json` import map in your edge function ensures consistent package versions.
71
+
72
+
**Simpler CLI** - The CLI is a lightweight Node.js package that makes HTTP requests, rather than needing to bundle the entire compilation infrastructure.
73
+
74
+
## Adding New Flows
75
+
76
+
To make a flow available for compilation:
77
+
78
+
1. Create the flow definition in `_flows/`
79
+
2.Importitin`supabase/functions/pgflow/index.ts`
80
+
3. Add it to the `ControlPlane.serve([...])` array
0 commit comments