Question presented to candidate: "What is the difference between the Node.js and Edge runtimes in Next.js, when would you have chosen Edge, and what is the recommendation today?"
What a strong answer should cover:
- Node.js runtime: the default for pages, layouts, Route Handlers and, in Next.js 16, Proxy; full Node APIs and npm compatibility.
- Edge runtime: a smaller runtime based on Web APIs, historically chosen for low latency and fast cold starts close to users.
- Edge limits: no Node built-ins such as
fs, restricted packages, size limits; the lab showedprocess.versionsmissing. - The Edge runtime is deprecated (16.3.4 and 16.4.2 both warn at build time), and on a page it disables static generation; with Cache Components any
runtimeexport, even'nodejs', fails the build. - The recommendation is the Node.js runtime everywhere, including proxy.ts, which now runs on Node by default.
Clarifying questions expected:
- "Does the code need Node APIs or native packages?" β they only work on Node.js.
- "Is the goal latency?" β caching and static rendering usually beat moving compute.
Code / implementation expected: Optional β the runtime export and what the build says.