This starter is a template for a Next.js project that uses Workflow DevKit with the Postgres World. It follows the Workflow DevKit: Next.js Getting Started Guide to bootstrap a new project, with the few additions necessary to run it with the Postgres world.
-
Clone this example and install dependencies:
git clone https://github.com/vercel/workflow-examples cd workflow-examples/postgres bun install -
Spin up a Postgres database locally or online and obtain the pogstgresql URL.
It should look something like
postgresql://<username>:<password>@<host>:<port>/<database>This is an exercise left to the user.
-
Run the database migration to setup postgres
WORKFLOW_POSTGRES_URL="postgresql://<username>:<password>@<host>:<port>/<database>" bunx workflow-postgres-setupThis needs to be run whenever you update the @workflow/world-postgres package to update your schemas to the latest version.
-
Start the development server pointing to your postgres database:
WORKFLOW_TARGET_WORLD="@workflow/world-postgres" WORKFLOW_POSTGRES_URL="postgresql://<username>:<password>@<host>:<port>/<database>" bun dev
-
Invoke the workflow by
curl:curl -X POST --json '{"email":"hello@example.com"}' http://localhost:3000/api/signup
The postgres world is incompatible with Vercel deployments (on Vercel, workflow deployments are automatically configured to use the Vercel World with zero configuration).
Coming soon: instructions on deploying workflows using the Postgres World off-Vercel.