
Deploy Nextjs with Inngest
Nextjs + Inngest starter template
Inngest Production Template
InngestApp
Just deployed
InngestRedis
Just deployed
/data
InngestPostgres
Just deployed
/var/lib/postgresql/data
nextjs
Just deployed
Deploy and Host Nextjs with Inngest on Railway
==============================================
Next.js is a powerful React framework for building modern web applications, while Inngest is an event-driven queue and background job platform. Together, they allow developers to easily build, queue, and execute reliable background tasks, scheduled jobs, and complex workflows directly within their Next.js API routes without managing external worker servers.
About Hosting Nextjs with Inngest
Deploying a self-hosted Inngest setup alongside Next.js on Railway involves running both the Next.js application and the open-source Inngest server as separate services within a single project. The Inngest server requires Redis and PostgreSQL backing services to manage state and queues.
The core challenge is establishing secure, reliable communication between the two. The Next.js app must expose an API endpoint (usually /api/inngest) and actively sync its available functions with the Inngest server upon deployment. This template simplifies this by configuring the necessary environment variables and a custom startup script to ensure seamless service discovery, authentication, and background execution out of the box.
Common Use Cases
-
Heavy Background Processing: Offloading resource-intensive tasks (e.g., video processing, PDF generation, or bulk email sending) so they don't block the Next.js UI or hit serverless timeout limits.
-
Complex Step Functions: Building multi-step user journeys, drip campaigns, or onboarding workflows with built-in sleep, wait, and retry mechanics.
-
Resilient Webhooks: Handling unreliable third-party API integrations by queuing incoming webhooks and utilizing Inngest's automatic retry and failure handling.
Dependencies for Nextjs with Inngest Hosting
-
Next.js (Web Framework)
-
Inngest SDK (
inngest) -
Inngest Server (Self-hosted Go binary)
-
PostgreSQL (Database for Inngest event state)
-
Redis (Queue backend for Inngest execution)
Deployment Dependencies
Implementation Details
Automated App Syncing In a self-hosted environment, the Next.js app must actively ping the Inngest server to register its available functions. Because Railway deployments do not have curl installed by default in slim Node containers, this template uses a custom Next.js start command utilizing Node's native fetch API. It waits 10 seconds for the Next.js server to bind to the port, then triggers the sync in the background:
/bin/sh -c "(node -e \"setTimeout(() => fetch('http://127.0.0.1:8080/api/inngest', { method: 'PUT' }).catch(console.error), 10000)\") & pnpm start"
Environment Variable Requirements To bypass internal proxy header stripping and ensure the self-hosted Inngest server knows exactly how to reach your Next.js application, you must define the INNGEST_SERVE_ORIGIN variable in your Next.js service settings on Railway, and have it set to your Next.js service internal URL and port.
Why Deploy Nextjs with Inngest on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Nextjs with Inngest on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
InngestApp
inngest/inngest:v1.17.6InngestRedis
redis:8.2.1nextjs
darseen/nextjs-inngestInngestPostgres
ghcr.io/railwayapp-templates/postgres-ssl:17