Middleware now supports Node.js
By Steven Van ·
Experimental Node.js runtime support for middleware arrives in Next.js 15.2 canary, still deployed globally, behind a config flag.
Node.js is now a supported runtime for middleware, so Vercel projects can use the full Node.js API set for things like authentication and personalization. Middleware is still deployed globally on Vercel, whichever runtime it uses.
The first release is in Next.js 15.2 and is experimental. It needs the Next.js canary channel, so projects must upgrade to next@canary.
- In next.config.ts, set experimental.nodeMiddleware to true.
- In middleware.ts, export a config object with runtime: "nodejs".
Vercel
The platform for frontend developers — deploy, preview, and scale web apps and AI agents with zero config.
View Vercel →