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 a picture frame splitting into resolution variants and a font card with a swap arrow
Next.js

Next.js Image and Font Optimization: priority, sizes, and remotePatterns

Why an image without sizes downloads 1600 pixels on a phone, what priority is for, the positioned parent that fill requires, and how next/font removes font shift.

Next.jsPerformanceImagesFonts
3D illustration of a page card emitting a social preview image and a structured sitemap tree
Next.js

Next.js Metadata API: generateMetadata, Open Graph, sitemap.ts, and robots.ts

metadataBase decides whether share previews work at all. Title templates, dynamic metadata with cached loaders, and sitemap generation that stays fresh.

Next.jsSEOMetadataSitemap
3D illustration of a page frame streaming content chunks with skeleton placeholders and an error shield
Next.js

Next.js loading, error, and not-found: Streaming and Suspense Boundaries

Three files, three React primitives. What each catches, why a layout's own error escapes its error.tsx, and the errors a boundary never sees.

Next.jsApp RouterStreamingError Handling
3D illustration of request arrows passing a filter gate that branches into pass, rewrite and redirect paths
Next.js

Next.js Middleware: Matchers, Redirects, Rewrites, and Why It Is Not an Auth Guard

One function before routing, on the edge runtime. Matcher grammar, redirect versus rewrite, and the bypass that makes in-page authorization mandatory.

Next.jsMiddlewareRoutingSecurity
3D illustration of HTTP request blocks hitting a handler gate that answers with JSON and a chunked stream
Next.js

Next.js Route Handlers: Methods, Cookies, and Streaming Responses

route.ts is plain HTTP inside the App Router. Reading the body once, setting cookies two ways, opting into caching in v15, and streaming with a ReadableStream.

Next.jsRoute HandlersAPIStreaming
3D illustration of a form panel sending data through a function pipe into a server cube with validation checkmarks
Next.js

Next.js Server Actions: Forms, Validation, and useActionState

Actions are POST endpoints the app can call. Schema validation on the server, serializable state for field errors, progressive enhancement, and why redirect() must not sit in a try block.

Next.jsServer ActionsFormsReact 19
3D illustration of stacked cache slabs invalidated by tag chips beside a revalidate clock dial
Next.js

Next.js Data Fetching: Caching, revalidate, and Tag-Based Invalidation

Next.js 15 stopped caching fetch by default. How request memoization, the data cache, and the route cache interact, and when to invalidate by tag instead of by clock.

Next.jsCachingData FetchingApp Router
3D illustration of URL path segments with a bracket slot receiving parameter tiles and prerendered pages
Next.js

Next.js Dynamic Routes: Catch-All Segments and generateStaticParams

params is a Promise in Next.js 15+, catch-all arrays index differently at the root, and dynamicParams decides whether an unknown slug is prerendered or 404s.

Next.jsApp RouterRoutingSSG
3D illustration of a server rack with async components beside a browser window with client components and a boundary line
Next.js

Server Components vs Client Components: Where the use client Boundary Actually Lands

The directive marks a module graph, not a component. Serializable props, the children pattern, context providers, and the hydration mismatches that follow.

Next.jsReactServer ComponentsClient Components
3D illustration of an App Router folder tree with page and layout file cards nesting around each other
Next.js

Next.js App Router File Conventions: page, layout, template, and the Rest

Layouts persist and templates remount; only page.tsx and route.ts make a segment routable. Route groups, private folders, and the boundaries that catch what.

Next.jsApp RouterRoutingReact