A minimal multi-step workflow with retries and a durable sleep on Neon Functions, with job state in Lakebase Postgres.
About this template
This template runs a minimal multi-step workflow as a Neon Function. Inngest orchestrates the steps. It checkpoints and retries each step.run on its own, and step.sleep waits without keeping the function running. The function stores job state in Lakebase Postgres.
How it works
POST /api/events sends an app/job.created event to Inngest.
Inngest calls POST /api/inngest to run the workflow:
start-job inserts the job with status running
wait-before-finishing sleeps durably for 5 seconds
finish-job marks the job completed
GET /api/jobs/:id shows the current row, so you can see the job change from running to completed.
Inngest retries a failed step without re-running the steps that already succeeded.
Route
Purpose
POST /api/events
Send an app/job.created event
GET /api/jobs/:id
Read a job's current state
GET, PUT, POST/api/inngest
Inngest's serve endpoint
GET /
Route index
Scaffold it
Install the latest Neon CLI, then create the function from the registry:
Signing key from Inngest Cloud. Inngest uses it to sign requests to /api/inngest; find it under Apps > Sync new app.
Yes
INNGEST_EVENT_KEY
Event key from Inngest Cloud. The function uses it to send app/job.created events; find it under Manage > Keys.
Yes
For local runs, any non-empty values work because the Inngest Dev Server ignores them. neon dev still validates the env declared in neon.ts, so add placeholders before you start it:
INNGEST_SIGNING_KEY=devINNGEST_EVENT_KEY=dev
Run locally
Local development uses the Inngest Dev Server, so the placeholder keys above are enough.
neon dev prints the URL it serves. The examples below use http://localhost:8787, the port it picks when that port is free. If it prints a different URL, use that one instead.
Replace <function-url> with the URL from neon functions get inngestworkflow.
Notes
The function creates the jobs table on its first run with CREATE TABLE IF NOT EXISTS, so there is no migration step.
POST /api/events has no authentication in this demo, so anyone with the function URL can start a workflow. Add authentication before you expose it.
Add more step.run calls around the sleep to extend the workflow. Keep side effects inside step.run so a retry doesn't repeat completed work.
step.sleep("wait-before-finishing", "5s") simulates a processing window. Inngest holds the timer, so the function isn't running or billed while it waits.