Next.js supports two different runtimes: Node.js (full server features) and Edge (faster, distributed, but limited features).
Interactive Simulation Engine
Runtime Comparison
Global Edge vs. Centralized Node
Visitor
US-EAST-1
Centralized Server
Full Node.js Runtime
Latency
0 ms
Capability
Full access to all libraries and Node APIs.
Distance
Request travels to a single data center.
Executable Code Workbench
page.tsx
Live Code Editor1// Choosing a runtime
2export const runtime = 'edge' // or 'nodejs' (default)
3
4export default function Page() {
5 return <div>Running on the Edge!</div>
6}Mental Model
A full kitchen (Node.js) vs a quick-service kiosk (Edge). One can cook anything; the other is everywhere and lightning fast.
Why This Exists
To allow developers to choose the best runtime for their specific needs, whether it's full server compatibility or global low-latency.
Critical Note
"Edge is always better. No! Edge has limitations on library support (e.g., some database drivers) and smaller memory limits."