Back to articles
How to Extract a Background Worker from Your Next.js Monolith (Express + Inngest + Docker)
How-ToDevOps

How to Extract a Background Worker from Your Next.js Monolith (Express + Inngest + Docker)

via Dev.to DevOpsnareshipme

The Problem You started with everything in Next.js — API routes, UI, and background jobs (video processing, LLM calls, file transforms). It worked great at first, but now: OOM crashes — background jobs eat memory that Vercel/your host needs for serving pages Cold starts — heavy deps (ffmpeg, Chromium for rendering) inflate your bundle Scaling mismatch — you want to scale compute independently from your frontend The fix: pull your background functions into a standalone Express worker. Here's the practical playbook. Architecture Before & After Before: One Next.js app does everything Next.js (Vercel) ├── pages / app router (UI) ├── API routes (REST) └── Background jobs (Inngest functions) ├── process-video ├── generate-clips └── export After: Next.js serves UI + API; Worker handles compute Next.js (Vercel) Worker (Railway/Fly/EC2) ├── UI ├── Express server ├── API routes ├── POST /api/inngest └── Inngest client └── GET /api/health (dispatches jobs) (runs the jobs) Step 1: Create the Worke

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
8 views

Related Articles