This add-on wires up Inngest for durable workflows, background jobs, and AI agents — a client, a sample event and function, the serve() API route, and an interactive demo page.
Inngest needs two processes: your app and the Inngest Dev Server.
First, uncomment INNGEST_DEV=1 in .env.local. In v4 the SDK defaults to cloud mode and requires a signing key — INNGEST_DEV=1 points it at your local Dev Server instead. Don't set it in production.
# Terminal 1 — your app
npm run dev # or INNGEST_DEV=1 npm run dev
# Terminal 2 — Inngest Dev Server (UI at http://localhost:8288)
npx inngest-cli@latest devOpen http://localhost:3000/demo/inngest, click the button to send an event, and watch it run in the Dev Server UI.
| File | What it does |
|---|---|
src/inngest/client.ts |
Shared inngest client |
src/inngest/functions.ts |
Events + functions — ships with a helloWorld event and helloWorldFn |
src/routes/api/inngest.ts |
The serve() handler mounted at /api/inngest (GET/POST/PUT) |
src/routes/demo/inngest.tsx |
Demo page at /demo/inngest that sends the sample event |
.env.local |
Commented INNGEST_DEV=1 and placeholders for production keys |
-
Define an event type and function in
src/inngest/functions.ts:export const userSignedUp = eventType('app/user.signed-up', { schema: staticSchema<{ userId: string }>(), }) export const userSignedUpFn = inngest.createFunction( { id: 'user-signed-up', triggers: [userSignedUp] }, async ({ event, step }) => { await step.run('send-welcome-email', async () => { // event.data.userId is typed }) }, )
-
Register it in
src/routes/api/inngest.ts:const handler = serve({ client: inngest, functions: [helloWorldFn, userSignedUpFn], })
-
Send the event from anywhere in your app:
await inngest.send(userSignedUp.create({ userId: '123' }))
eventType() ties the event name to its payload shape, so event.data is inferred in both the function handler and inngest.send(). Want runtime validation too? Swap staticSchema for a Zod schema — see the trigger helpers reference.
- Sync your app from the Inngest dashboard, pointing it at
https://your-domain.com/api/inngest. - Set these environment variables in your deployment:
INNGEST_EVENT_KEY— authorizesinngest.send()to deliver eventsINNGEST_SIGNING_KEY— lets theserve()handler verify requests from Inngest
- Make sure
INNGEST_DEVis not set.
Running on serverless (Vercel, Netlify, etc.)? Set
checkpointing: { maxRuntime: '50s' }on the client (~80% of your platform's max duration) so checkpointed steps don't get cut off mid-run. More on checkpointing here.
See Inngest's deploy guides for platform specifics.