vercel/next.js
Reference
Concrete look-up material that doesn't fit into a feature narrative.
- Configuration —
next.config.jsschema, env-var conventions - Data models — the most-traveled types in the codebase
- Dependencies — root devDependencies, vendored packages, runtime deps
Where things live (root of the repo)
| Path | What |
|---|---|
packages/next/ |
The framework runtime + dev/build/start CLIs |
packages/ |
All the other npm packages (16 sub-packages) |
crates/ |
Next.js-specific Rust crates |
turbopack/ |
The Turbopack subtree (54 crates + xtask) |
rspack/ |
rspack integration crate |
test/ |
All non-unit tests (e2e, integration, production, development) |
examples/ |
229 example apps demonstrating features |
docs/ |
User-facing documentation source |
errors/ |
Error code registry (errors/index.json) |
scripts/ |
Repo automation (build-native, sync-react, install-native, etc.) |
bench/ |
Benchmarks |
.github/ |
CI workflows + automation |
eslint.cli.config.mjs |
Repo's ESLint config |
Cargo.toml |
Rust workspace |
pnpm-workspace.yaml |
pnpm workspace |
package.json |
Root npm package + scripts |
tsconfig.json |
Root TS config |
rust-toolchain.toml |
nightly-2026-04-02 |
AGENTS.md |
Top-level guidance for AI agents working on the repo |
contributing.md |
Contributor guide |
Top-level scripts you'll actually run
| Script | What it does |
|---|---|
pnpm build |
Build all JS packages via Turbo |
pnpm build-all |
Build JS + Rust native binaries |
pnpm swc-build-native |
Build the napi binding only |
pnpm dev |
Watch-mode for all packages |
pnpm next ... |
Run the local next CLI against any project |
pnpm test-unit |
Run Jest unit tests |
pnpm test-dev / test-start / test-deploy |
Run e2e tests in dev / start / deploy mode + headless |
pnpm testonly-dev <test-file> |
Single-test run, headed (browser visible) |
pnpm test-types |
TypeScript-only check |
pnpm lint |
Run all linters in parallel |
pnpm lint-fix |
Format + fix auto-fixable lint issues |
pnpm new-error |
Scaffold a new framework error |
pnpm new-test |
Scaffold a new test |
pnpm sync-react |
Update bundled React versions |
Bundlers
The framework supports three. Pick via env var or flag:
| Bundler | How to select | Default since |
|---|---|---|
| Turbopack | default (no flag) | 2025 |
| webpack | --webpack or IS_WEBPACK_TEST=1 |
— |
| rspack | NEXT_RSPACK=1 (or pnpm with-rspack <cmd>) |
— |
Runtimes
Code can run in three runtimes:
| Runtime | Where |
|---|---|
| Node | the default server, build orchestration |
| Edge | middleware.ts, runtime: 'edge' route handlers |
| Browser | client components and pages |
The framework distinguishes between layers (server, client, react-server, route handler, edge). A given runtime can host multiple layers — e.g., the Node server hosts the server, client (when SSRing), and react-server layers.
Common environment variables
| Variable | What |
|---|---|
NEXT_TELEMETRY_DISABLED=1 |
Opt out of telemetry |
NEXT_PRIVATE_LOCAL_DEV=1 |
Tell next it's running from this repo |
IS_TURBOPACK_TEST=1 / IS_WEBPACK_TEST=1 |
Force a bundler in test runs |
NEXT_TEST_USE_RSPACK=1 / NEXT_RSPACK=1 |
Use rspack in tests / production |
NEXT_RSC_NO_FAILSAFE=1 |
Disable RSC failsafe in tests |
__NEXT_CACHE_COMPONENTS=true |
Enable cache components umbrella flag |
NEXT_TURBOPACK_TRACING=* |
Turbopack tracing preset |
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY |
Override action encryption key |
__NEXT_SHOW_IGNORE_LISTED=true |
Show framework-internal frames in dev errors |
NEXT_DISABLE_DEV_INDICATOR=1 |
Hide the dev mode badge |
NEXT_DEBUG_BUILD |
Verbose build diagnostics |
Useful commit ranges
| Range / commit | What |
|---|---|
2016-10-05 first commit |
Initial cut |
| Aug 2024 subtree merge | Turbopack consolidation |
4ba05cc300cd... |
This wiki captured at canary |
Run git log --oneline --grep="<topic>" to find feature work; the repo's commit messages are good.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.