Postgres World

This page is a work in progress.

This world is a reference implementation, not a production-ready product. We do not recommend using it in production. However, you can definitely use it as inspiration for a real-world database-backed solution that might run workflow and step workers separately from the triggering applications.

The PostgreSQL world is a reference implementation of a world that's fully backed by PostgreSQL, including job processing (using pg-bossExternal link) and streaming (using PostgreSQL's NOTIFY and LISTEN).

This world is designed for long-running processes, so it can receive and dispatch events from a PostgreSQL database, and isn't meant to be deployed on serverless platforms like Vercel due to that nature.

Usage

Install the package and set the world target using the following commands:

# Install the package
$ npm install @workflow/world-postgres
# Set the world target environment variable
$ export WORKFLOW_TARGET_WORLD="@workflow/world-postgres"

Configuration

Configure the world using the following environments variables:

VariableDescriptionDefault
WORKFLOW_POSTGRES_URLPostgreSQL connection stringpostgres://world:world@localhost:5432/world
WORKFLOW_POSTGRES_JOB_PREFIXPrefix for queue job namesworkflow_
WORKFLOW_POSTGRES_WORKER_CONCURRENCYNumber of concurrent workers10