A comprehensive trip booking system demonstrating Inngest's Durable Endpoints approach, built with Next.js.
Durable Endpoints is a new durable execution approach in Inngest that allows you to make regular HTTP handlers durable using step.run() directly, without defining separate Inngest functions or using events.
import { step } from "inngest";
import { Inngest } from "inngest";
import { endpointAdapter } from "inngest/next";
const inngest = new Inngest({ id: "my-app", endpointAdapter });
// This Next.js API route is now durable!
export const GET = inngest.endpoint(async (req) => {
// Each step is persisted - survives crashes/restarts
const result = await step.run("my-step", async () => {
return await doSomething();
});
return new Response(JSON.stringify({ result }));
});This example showcases production-ready patterns using Inngest Durable Endpoints:
- Durable HTTP Handlers - Next.js API routes made durable with
inngest.endpoint() - 4-Step Booking Orchestration - Flight search, reservation, payment, and confirmation
- Automatic Retries - Step failures trigger Inngest's built-in retry mechanism
- Real-time UI Updates - Live progress tracking with polling
- Code Viewer - See the durable endpoint code highlighted as each step executes
┌─────────────────────────────────────────┐
│ Next.js App (Port 3000) │
├─────────────────────────────────────────┤
│ Frontend: │
│ - Booking Form │
│ - Progress Tracker │
│ - Code Viewer │
│ │
│ API Routes (Durable): │
│ - GET /api/booking (endpoint) │
│ - GET /api/booking/events (polling) │
└─────────────────────────────────────────┘
| Traditional Inngest | Durable Endpoints |
|---|---|
| Define separate functions | Inline in HTTP handlers |
| Trigger via events | Direct HTTP calls |
inngest.createFunction() |
inngest.endpoint() |
{ event, step } from context |
Import step directly |
Separate /api/inngest endpoint |
No separate endpoint needed |
- Node.js 20+
1. Install Dependencies
cd next-app
npm install2. Start the App
cd next-app
npm run dev
# Runs on http://localhost:30003. Create a Booking
- Open http://localhost:3000
- Select origin and destination airports
- Pick a departure date
- Click "Search & Book"
- Watch real-time progress as each durable step executes
MIT