Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkgs/website/src/components/CodeOverlay.astro
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@
const button = document.querySelector('.reveal-button') as HTMLElement | null;
const overlay = document.querySelector('.code-overlay') as HTMLElement | null;
const scrollableContainer = document.querySelector('.scrollable-content') as HTMLElement | null;
const scrollableInner = document.querySelector('.scrollable-inner') as HTMLElement | null;
// Cast non-null: the guard below protects runtime; hoisted animateScroll can't inherit the narrowing.
const scrollableInner = document.querySelector('.scrollable-inner') as HTMLElement;

if (!button || !overlay || !scrollableContainer || !scrollableInner) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,11 @@ Set these variables in your process host:

Use `DATABASE_URL` for process hosts when possible. `EDGE_WORKER_DB_URL` remains supported for deployments that share configuration with Supabase Edge Functions. If both are set, `DATABASE_URL` takes priority.

<Aside type="caution" title="Apply the worker start mode migration first">
Apply the pgflow migration that adds `worker_functions.start_mode` and the
two-argument `track_worker_function` before the first process worker
deployment. Process workers require this migration; existing HTTP Edge
workers remain compatible with databases that only have the one-argument
function.
<Aside type="caution" title="Update your pgflow schema first">
Process workers need the pgflow 0.15.0 database migrations (`start_mode`).
Run `npx pgflow@latest install` and apply new migrations before your first
process worker deployment — see
[Update pgflow](/deploy/update-pgflow/).
</Aside>

## Run The Worker
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: 'pgflow 0.15.0: Standalone Workers with Node and Bun'
description: 'Run pgflow workers as long-lived Node or Bun processes on any hosting platform with the new @pgflow/edge-worker npm package'
date: 2026-08-18
authors:
- jumski
tags:
- feature
- minor
featured: false
---

import { Aside } from '@astrojs/starlight/components';

pgflow workers are no longer tied to Supabase Edge Functions. This release publishes `@pgflow/edge-worker` to npm and adds a process runtime that runs workers as long-lived Node or Bun processes — on Railway, Fly.io, Docker, or any VM.

<Aside type="note" title="Supabase is still required">
Flows, runs, and task queues still live in your Supabase Postgres database — only the worker *process* moved. It runs on your infrastructure and connects back to Supabase. Edge Function workers keep working as before.
</Aside>

## Run a worker with Node or Bun

Install the package with your package manager of choice, set your connection variables, and start a worker script:

```sh frame="none"
npm add @pgflow/edge-worker
pnpm add @pgflow/edge-worker
bun add @pgflow/edge-worker
```

```ts title="worker.ts"
import { EdgeWorker } from '@pgflow/edge-worker';
import { ProcessOrders } from './flows/process-orders.js';

await EdgeWorker.start(ProcessOrders);
```

Process workers handle `SIGTERM`, `SIGINT`, and `SIGQUIT` with graceful drain: tasks finish, the worker is marked stopped, and connections close before exit.

See the [Node/Bun Process Workers guide](/deploy/node-bun-process-workers/) for deployment recipes and configuration.

Already using pgflow? 0.15.0 ships a database migration — follow [Update pgflow](/deploy/update-pgflow/) before deploying process workers.

## Supabase Edge Function improvements

Edge Function workers also got lifecycle hardening in this release:

- **Bounded shutdown.** Shutdown finishes within a five-second deadline; PostgreSQL connections are force-closed if it expires.
- **Serialized startup.** Concurrent requests share one startup; none observe a half-started worker.
- **Retry backoff.** Persistent database failures back off exponentially (100 ms to 5 s) instead of hot-looping.

This file was deleted.

2 changes: 1 addition & 1 deletion pkgs/website/src/pages/demos.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { AuthDemo } from '../components/AuthDemo';
---

<StarlightPage
hasSidebar={false}
frontmatter={{
title: "pgflow Demos",
description: "Interactive demonstrations of pgflow functionality with authenticated examples.",
editUrl: false,
sidebar: { hidden: true },
tableOfContents: false,
lastUpdated: false,
topic: 'pgflow'
Expand Down
Loading