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
Popular Next.js guides
Most readNext.js Static Export, Standalone Output, and Docker Deployment
Next.js Parallel Routes and Intercepting Routes: Slot Layouts and Modals
Next.js ISR: Route Revalidate, revalidateTag, and On-Demand Invalidation
Next.js Environment Variables: NEXT_PUBLIC_, Build-Time Inlining, and Runtime Config
Latest Next.js guides
Page 2 of 2Next.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.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.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.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.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.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.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.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.
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.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.