Node versus Edge runtime
What you need to know
A Next.js route runtime determines which server APIs and dependencies can execute. Choose Node.js when a route needs Node-specific modules, or consider Edge only when the complete dependency graph and deployment adapter support its smaller API surface.
By the end, you can: identify API compatibility; choose runtime for dependency needs.
A Web API-only handler
// app/api/edition/route.ts; Cache Components offexport const runtime = 'edge';export function GET(){ return Response.json({edition:'spring'});}Expected behavior: A compatible Edge adapter should respond with JSON containing edition spring; no filesystem or database needed.
How it works
Node is the default server runtime in the App Router. The Edge runtime exposes web-standard facilities such as Request, Response and URL, but does not support arbitrary native Node APIs. Neither runtime is the browser. A Client Component may be prerendered on the server and later execute in the browser; it is not selected by the route runtime setting. In the Next.js 16 lane with Cache Components disabled, a supported page, layout or Route Handler can declare a statically analyzable runtime export. Cache Components require Node; when migrating an Edge route to Cache Components, remove its Edge runtime export and verify the resulting Node deployment. Proxy in Next.js 16 also runs on Node, not a configurable Edge runtime. Edge does not support ISR in the documented route runtime. An adapter may impose more restrictions. Choose a runtime from required capabilities first, then compare measured latency near the data source and actual user locations.
A Node-only runtime choice
// app/api/bytes/route.tsimport { Buffer } from 'node:buffer';export const runtime = 'nodejs';export function GET(){ return Response.json({bytes:Buffer.byteLength('café','utf8')});}Expected behavior: The expected byte count is 5, not the JavaScript string length of 4. The Node import is deliberate.
Common mistake
Changing runtime to edge does not automatically make a Node database driver compatible. Do not select Edge with Cache Components enabled or use a runtime export in Proxy.
Practice and verification
Classify a public JSON route, a native database driver and a Cache Components page. Write down required APIs, adapter support and measurements needed before deployment.
Scope: Proposed Next.js 16.x / React 19, Cache Components disabled unless noted. Framework, browser and component examples are staged; local standalone tests are reported separately. Exact dependency patches and platform contracts pending.