Configure a page
A page needs an explicit runtime declaration for clarity or configuration consistency.
Next.js 16+ · Const
runtime selects the JavaScript runtime used to render a Next.js route segment. Node.js is the default; the documentation marks Edge as deprecated.
Export runtime from a page, layout, or route handler to choose the JavaScript runtime used to render that route segment. Use 'nodejs' for the supported default runtime; the page identifies 'edge' as deprecated.
export const runtime = 'nodejs'| Name | Type | Description |
|---|---|---|
runtime | 'nodejs' | 'edge' (deprecated) | The JavaScript runtime for the route segment; the documented default is Node.js. |
No runtime value is returned; exporting the constant configures route rendering.
'edge' for new code; the documentation marks it as deprecated.export const runtime = 'nodejs'
export default function Page() {
return <main>Runs on Node.js</main>
}This page explicitly selects the default Node.js runtime.
A page needs an explicit runtime declaration for clarity or configuration consistency.
A route handler should run with the standard server runtime.
A layout governs runtime configuration for its route segment.
runtime export control?runtime is a Route Segment Config export that selects the JavaScript runtime for rendering a route. It can be exported from a page, layout, or route handler, and 'nodejs' is the default.
Follow-up: What should a new application use if it does not need a different runtime? Use the default Node.js behavior and omit the export.
The supported default is 'nodejs'. The documentation also lists 'edge', but explicitly marks the Edge Runtime as deprecated.
Follow-up: How should existing Edge usage be handled? Remove the runtime export from the route files when migrating away from Edge.
runtime be declared?A route segment can declare the setting directly with export const runtime = 'nodejs'. The same declaration can be placed in a layout or route handler.
Follow-up: Why might a layout-level declaration matter? The setting applies to the route segment represented by that layout and its configured descendants.
Route Segment ConfigpagelayoutRoute Handler