export const runtime
The route segment option that picks the runtime for a page, layout or Route Handler: 'nodejs' (default) or 'edge'.
In more detail
Set it per route, for example edge for a fast geolocation endpoint and nodejs for a PDF report. Anything the route imports must work in the chosen runtime.
Example
export const runtime = 'edge';Related terms
- Node.js runtime — The default Next.js runtime, where server code runs on Node.js with access to every Node API and npm package.
- Edge runtime — A lightweight Next.js runtime based on V8 isolates and standard Web APIs, which starts almost instantly but cannot use most Node.js APIs.
- route segment config — Constants exported from a page, layout or route file, such as dynamic, revalidate or runtime, that change how that segment is rendered and cached.
Taught in
- Runtime Environments: Node.js vs Edge Runtime Choice — Next.js 15 & Modern App Router Architecture