Pages

Topics

Tools

↑↓navigate↵openescclose

Next.js guides

Every published Next.js guide, newest first, with practical examples you can copy into your own project.

3,815 guides across 14 topics

Topics

Latest Next.js guides

3D illustration of request arrows hitting a config panel that splits into redirect, rewrite and header routes
Next.js

Next.js Redirects, Rewrites, and Headers in next.config.ts

Redirect changes the URL, rewrite masks it, headers ride on the response — all evaluated in a fixed order before routing. Permanent means cached in browsers, not just in Google.

Next.jsConfigurationRoutingSEO
3D illustration of static HTML cards beside a shipping container with a package cube inside
Next.js

Next.js Static Export, Standalone Output, and Docker Deployment

Export has no server, standalone has a pruned one, and the default expects a full install. The three COPY lines that decide whether a container renders CSS.

Next.jsDeploymentDockerBuild
3D illustration of a split platform with globe edge nodes on one side and a server rack on the other
Next.js

Next.js Edge Runtime vs Node.js Runtime: Limits, Latency, and Use Cases

Edge gives near-zero cold starts and Web APIs only; Node gives sockets, files, and a fixed region. Why database work belongs on Node, and what fails at build time.

Next.jsEdge RuntimeDeploymentPerformance
3D illustration of a URL bar wired to navigation hooks as modules feeding page cards
Next.js

Next.js Link and Router: useRouter, usePathname, and useSearchParams

Client navigation goes through Link and the router hooks, the server uses redirect(). The Suspense requirement, prefetch cost, and query string handling that breaks first.

Next.jsNavigationApp RouterReact
3D illustration of a test pyramid with a browser window running an end-to-end test
Next.js

Testing Next.js: Vitest for Server Components and Playwright for the Rest

Async Server Components cannot render in jsdom, so awaiting the component is the unit test and a real browser is the integration test. What each layer actually proves.

Next.jsTestingVitestPlaywright
3D illustration of key-value chips split into a browser lane and a sealed server cube
Next.js

Next.js Environment Variables: NEXT_PUBLIC_, Build-Time Inlining, and Runtime Config

The prefix decides whether a value is compiled into the browser bundle or stays on the server. One image, two environments, and the choice that follows from it.

Next.jsConfigurationDeploymentSecurity
3D illustration of a shield gate before server components with an HttpOnly cookie token passing through
Next.js

Next.js Authentication: Sessions, Cookies, and Server-Side Protection

HttpOnly cookies set only in actions, an async cookies() API, and one data-access layer. Middleware is an optimistic gate; the page that reads data is the only real check.

Next.jsAuthenticationSecurityCookies
3D illustration of a globe with locale URL segments branching into dictionary folders
Next.js

Next.js i18n: Locale Routing, Middleware Negotiation, and Dictionaries

A [lang] segment gives every page a static, cacheable URL per language and middleware negotiates once. Where static rendering silently becomes dynamic, and how hreflang stays honest.

Next.jsi18nRoutingSEO
3D illustration of cached page slabs with a countdown dial refreshing one and a webhook invalidating another
Next.js

Next.js ISR: Route Revalidate, revalidateTag, and On-Demand Invalidation

Two clocks and one trigger: route revalidate seconds, fetch-level tags, and a webhook that calls revalidateTag. A timer is a ceiling on freshness, never a guarantee.

Next.jsISRCachingPerformance
3D illustration of parallel route slots rendering beside a page with a modal card sliding over it
Next.js

Next.js Parallel Routes and Intercepting Routes: Slot Layouts and Modals

Named slots render several pages in one layout, and (.) interception makes a click open over the page while a direct link renders the full route. Why every slot needs default.tsx.

Next.jsApp RouterRoutingReact