Open-Source Wikis

/

Next.js

/

Next.js

/

Glossary

vercel/next.js

Glossary

Terms used throughout the Next.js codebase, with pointers to where they live.

Routers and rendering

App Router — The React Server Components-based router, rooted at the app/ directory in user code. The renderer is packages/next/src/server/app-render/app-render.tsx. Client runtime is packages/next/src/client/components/app-router.tsx.

Pages Router — The original pages/-based router. Renderer is packages/next/src/server/render.tsx. Both routers are supported simultaneously in the same app.

RSC (React Server Components) — Components rendered only on the server, never shipped as JavaScript to the client. Output as a "Flight" stream encoded by react-server-dom-webpack or react-server-dom-turbopack. The boundary file is packages/next/src/server/app-render/entry-base.ts.

Flight payload — The serialized RSC stream. Helpers live in packages/next/src/client/flight-data-helpers.ts.

SSR (Server-Side Rendering) — Rendering React to HTML on the server. In the App Router this happens after RSC encoding; in the Pages Router it happens directly via renderToString / renderToPipeableStream.

SSG (Static Site Generation) — Pre-rendering pages at build time. Driven by packages/next/src/build/static-paths/.

ISR (Incremental Static Regeneration) — Pages rendered statically with revalidation. Implementation lives in packages/next/src/server/lib/incremental-cache/.

PPR (Partial Prerendering) — A rendering mode where a static shell streams first and dynamic content fills in later. The "postponed state" is in packages/next/src/server/app-render/postponed-state.ts. Cache components enables PPR by default when __NEXT_CACHE_COMPONENTS=true.

Cache components — A new caching primitive that replaces previous Data Cache and Router Cache designs. When __NEXT_CACHE_COMPONENTS=true, most app-dir pages use PPR implicitly.

Server Actions — Mutating endpoints declared with 'use server'. Implementation: packages/next/src/server/app-render/action-handler.ts.

Route Handler — User-defined route.ts files. Implementation: packages/next/src/server/route-modules/app-route/.

Build pipeline

Turbopack — The Rust-based bundler that is the default for next dev and next build. Lives at turbopack/crates/.

SWC — The Rust-based JavaScript/TypeScript compiler used for source transforms. The Next.js-specific transforms live at crates/next-custom-transforms/. The npm shippable wrapping lives at packages/next-swc/.

rspack — A drop-in webpack replacement, supported via packages/next-rspack/. Activated with NEXT_RSPACK=1.

Manifests — JSON files written to .next/ at build time that the runtime reads. The most important are routes-manifest.json, build-manifest.json, app-build-manifest.json, prerender-manifest.json, and react-loadable-manifest.json. Generation lives in packages/next/src/build/manifests/ and packages/next/src/build/generate-routes-manifest.ts.

nft.json (Node File Tracer) — Per-route trace files generated by packages/next/src/build/collect-build-traces.ts. They list the runtime dependencies of each handler and are consumed by hosting platforms.

Build trace — A separate concept from nft.json: next build writes OpenTelemetry-style traces to .next/trace for performance analysis.

Edge and runtimes

Node.js runtime — The default. Full Node API. Server entrypoints at packages/next/src/server/next-server.ts.

Edge runtime — A sandboxed Web Standards subset. Built on @edge-runtime/vm. Sources in packages/next/src/server/web/. Each edge function runs in its own isolated VM context.

NEXT_RUNTIME — An environment variable injected at build time that equals either 'nodejs' or 'edge'. Used to gate Node-only imports.

NEXT_DEV_SERVER (__NEXT_DEV_SERVER) — A build-time flag that distinguishes next dev from next build --debug-prerender (both run with NODE_ENV=development).

Storage and async context

AsyncLocalStorage — Node's async_hooks.AsyncLocalStorage. Next.js uses several:

Storage File Holds
Work async storage packages/next/src/server/app-render/work-async-storage.external.ts Per-request work context (URL, params, etc.)
Work-unit async storage packages/next/src/server/app-render/work-unit-async-storage.external.ts Per-render-unit context (cache scopes)
Action async storage packages/next/src/server/app-render/action-async-storage.external.ts Active server action invocation
Console async storage packages/next/src/server/app-render/console-async-storage.external.ts Console capture for replay
After-task async storage packages/next/src/server/app-render/after-task-async-storage.external.ts Tasks queued via unstable_after
Dynamic-access async storage packages/next/src/server/app-render/dynamic-access-async-storage.external.ts Records dynamic API access for PPR

The .external.ts suffix marks files that must be loaded as singletons across the React Server and Client layers.

Configuration

next.config.js — User-facing config file. Schema in packages/next/src/server/config-schema.ts. Type definitions in packages/next/src/server/config-shared.ts.

define-env.tspackages/next/src/build/define-env.ts. Builds the process.env constants injected into user bundles at build time. New flags consumed in user-bundled code must be added here.

Experimental flags — Named entries under experimental: in next.config.js. The flag plumbing flow is: type in config-shared.ts → schema in config-schema.ts → injected via define-env.ts → optionally branched in next-server.ts or export/worker.ts for runtime internals.

Bundling and routes

Route module — A user route compiled to a self-contained module. The kinds (App Page, App Route, Pages, Pages API) are defined in packages/next/src/server/route-modules/.

Route matcher — The component that decides which route module handles a given URL. Providers under packages/next/src/server/route-matcher-providers/, managers under packages/next/src/server/route-matcher-managers/.

Entry point — The bundled file produced for a route. packages/next/src/build/entries.ts decides what entries get created based on the route inventory.

Loader tree — The data structure that represents the App Router segment hierarchy at build time. Walked by packages/next/src/server/app-render/walk-tree-with-flight-router-state.tsx.

Layers

react-server layer — The bundle layer where React Server Components run. Cannot import client APIs (no useState, no DOM). Imports from react-server-dom-webpack/server are allowed.

client layer — The bundle layer where the browser code runs.

Edge layer — A virtual layer for edge functions. Forces certain feature flags off in define-env.ts so Node-only imports get tree-shaken.

Misc

entry-base.tspackages/next/src/server/app-render/entry-base.ts. The single allowed import site for react-server-dom-webpack/*. All other code accesses these via re-exports from this file.

app-page.ts — A build template compiled by the user's bundler. require() calls in this file are traced by webpack/turbopack at next build time. New helpers must go through entry-base.ts.

Dev indicator — The toast in the bottom-right of dev pages. Implemented in packages/next/src/next-devtools/.

HMR (Hot Module Replacement) — Live module reloading in dev. Three implementations: hot-reloader-webpack.ts, hot-reloader-turbopack.ts, hot-reloader-rspack.ts.

Codemod — A code transformation script for upgrading user code between Next.js versions. Lives in packages/next-codemod/.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Glossary – Next.js wiki | Factory