
Background Jobs in Next.js 15 with Inngest: Step Functions, Type-Safe Events, and TDD
Background jobs are one of those things that seem simple until they're not. You need retries, observability, step-level restarts, and a way to test without spinning up a real queue. Inngest solves all of this with a developer-friendly API that integrates cleanly with Next.js 15 App Router. Here's a practical guide to wiring it up — including the parts the docs gloss over. The Stack Next.js 15 (App Router) TypeScript Inngest (background jobs + queues) Vitest (testing) 1. Install and Create the Client npm install inngest Create src/lib/inngest.ts : import { Inngest } from " inngest " ; export const inngest = new Inngest ({ id : " my-app " }); That's your singleton client. You'll import it everywhere else. 2. Create a Function Inngest functions are typed, step-based handlers. Each step.run() call is independently retried if it fails. // src/inngest/functions/process-video.ts import { inngest } from " @/lib/inngest " ; export const processVideo = inngest . createFunction ( { id : " process
Continue reading on Dev.to Webdev
Opens in a new tab




