This post describes Next.js 16.4.6 and the App Router. It replaces an older summary of Static Generation and Server-side Rendering from the Pages Router tutorial. Those terms still apply to the Pages Router, which keeps getStaticProps and getServerSideProps.
In the App Router, Next.js decides how to render each route by looking at what your components do during the build. The APIs you call and a few config exports steer that decision.
Next.js 16 ships two rendering models side by side, and one config flag, cacheComponents, picks between them. The docs call the model without it the "previous rendering model". This site still runs on that model, so I'll start with the real next build output for this portfolio and then cover what changes when the flag is on.
Reading the build output
The quickest way to see how Next.js classified your routes is the table next build prints at the end. This is the output for this site, abridged:
Route (app)
┌ ○ /
├ ○ /_not-found
├ ○ /about
├ ƒ /api/[...catchall]
├ ƒ /api/og
├ ƒ /api/openapi.json
├ ƒ /api/v1/contact
├ ƒ /api/v1/posts
├ ƒ /api/v1/profile
├ ƒ /api/v1/projects
├ ○ /blog
├ /blog/[...slug]
│ ├ ● /blog/debugging-react-performance-hydration-with-ai
│ ├ ● /blog/essential-vscode-extensions
│ ├ ● /blog/gta-vi-delays-software-estimates
│ └ ● [+9 more paths]
├ ○ /case-studies
├ ○ /sitemap.xml
├ ○ /tags
├ /tags/[tag]
│ ├ ● /tags/react
│ ├ ● /tags/nextjs
│ ├ ● /tags/performance
│ └ ● [+21 more paths]
└ ○ /versions
ƒ Proxy (Middleware)
○ (Static) prerendered as static content
● (SSG) prerendered as static HTML (uses generateStaticParams)
ƒ (Dynamic) server-rendered on demandWithout Cache Components the table uses three symbols. A ○ route is prerendered as HTML at build time. A ● route is a dynamic segment whose paths come from generateStaticParams, each prerendered as HTML. A ƒ route renders on demand for every request.
Most of this site is ○. Pages like /about and /blog render from local modules: the blog index reads posts that Velite compiles from MDX into #site/content, a step next.config.mjs runs before Next starts compiling. Nothing there reads the request, so Next.js renders each page once and serves the HTML as a file.
The two ● routes are the blog posts and the tag pages. Both are dynamic segments and both export generateStaticParams:
import { posts } from "#site/content";
export async function generateStaticParams(): Promise<{ slug: string[] }[]> {
return posts.map((post) => ({ slug: post.slugAsParams.split("/") }));
}The page still awaits params, but every valid slug is known at build time, so each post ends up as a static HTML file.
Every API route is ƒ, including /api/v1/profile, which returns a hard-coded object and never looks at the request. In this model Route Handlers are not cached by default. A GET handler is only prerendered if you opt in, for example with export const dynamic = 'force-static'.
The ƒ Proxy (Middleware) line is proxy.ts, which replaced middleware.ts in Next.js 16. Here it returns Markdown instead of HTML for a few pages, such as /, /about and /blog, when a request sends Accept: text/markdown. Proxy runs before filesystem routes are matched, so every request its matcher lets through, prerendered pages included, goes through it first.
What makes a route dynamic
In the previous model a route stays static until something forces it to render per request. The common triggers are:
- a Request-time API:
cookies(),headers(),searchParamsordraftMode() await connection(), which tells Next.js to wait for a real request before continuing- a
fetchwithcache: 'no-store'ornext: { revalidate: 0 } - route segment config such as
export const dynamic = 'force-dynamic'orexport const revalidate = 0
A fetch with no cache option is fetched once during next build if it runs before any Request-time API, because the route is prerendered up to that point. A page that fetches a price without options can keep showing the build-time price until the next deploy. If the data has to be fresh, say so with no-store or a revalidate value.
Dynamic segments add one more case. Paths you did not return from generateStaticParams are rendered on demand, because dynamicParams defaults to true. On this site a request for a mistyped post slug renders the page, finds no post and calls notFound(). If every valid path is known at build time, export const dynamicParams = false makes unlisted paths return a 404 instead.
Revalidation and ISR
Static HTML goes stale when the data behind it changes. Incremental Static Regeneration updates it without a full rebuild. In the previous model you put a revalidate time on the route segment:
export const revalidate = 3600;
export async function generateStaticParams() {
const posts = await getAllPosts();
return posts.map((post) => ({ slug: post.slug }));
}
export default async function Page({ params }: PageProps<"/blog/[slug]">) {
const { slug } = await params;
const post = await fetch(`https://cms.example.com/posts/${slug}`, {
next: { tags: [`post:${slug}`] },
}).then((res) => res.json());
return <Article post={post} />;
}Per the ISR guide, once the window has passed the next request still gets the cached page while Next.js regenerates it in the background, and later requests get the new version. The docs recommend a long window, an hour rather than a second, plus on-demand revalidation when you need precision.
On-demand revalidation means calling revalidatePath or revalidateTag from a Server Action or a Route Handler. Here a CMS webhook calls a Route Handler:
import { revalidateTag } from "next/cache";
export async function POST(request: Request) {
if (request.headers.get("x-revalidate-secret") !== process.env.REVALIDATE_SECRET) {
return Response.json({ error: "Unauthorized" }, { status: 401 });
}
const { slug } = await request.json();
revalidateTag(`post:${slug}`, "max");
return Response.json({ revalidated: true });
}In Next.js 16 revalidateTag takes a second argument. With "max" you get stale-while-revalidate behavior. The single-argument form is deprecated and behaves like an immediate expiry. When a user has to see their own change right away, call updateTag instead, which only works in Server Actions.
This site uses none of this. The content lives in the repository, so a new post means a commit and a deploy, and the deploy rebuilds every page anyway. I'd reach for ISR when content changes outside git: a headless CMS, a product catalog, anything edited by people who don't open pull requests.
Streaming with Suspense
A dynamic route doesn't have to wait for its slowest query before sending HTML. React's server renderer produces chunks aligned with <Suspense> boundaries, and the App Router streams them. A loading.tsx file wraps the whole page in a Suspense boundary with your component as the fallback, while explicit <Suspense> boundaries put the fallback around just the part that needs data. The streaming guide prefers the second, placed close to the data access, so more real content ships in the first chunk.
The guide's Web Vitals section explains the trade-off. With streaming, time to first byte drops to the time it takes to render layouts and fallbacks, instead of matching the slowest query. LCP can get worse, though. If the LCP element sits inside a boundary, it can't paint until that boundary's content is swapped in, so keep hero images and main headings outside Suspense.
Once streaming starts, the response has already gone out with a 200 status. A notFound() inside a Suspense boundary then adds a noindex robots meta tag instead of producing a 404, and a redirect() becomes a client-side redirect. Without Cache Components you can still return a real 404 by checking before the first boundary. With Cache Components the shell goes out first, and the docs point to Proxy for a request-time 404. Details are in the HTTP contract section.
Cache Components and Partial Prerendering
The cacheComponents flag was stabilized in 16.0.0, and the Next.js 16 release post from October 21, 2025 describes caching under the new model as "entirely opt-in". Data access is dynamic unless you cache it, and the line between static and dynamic moves from the route to the component.
You enable it in the config along with Partial Prefetching (added in 16.3.0), which the docs ask you to set explicitly:
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
cacheComponents: true,
partialPrefetching: true,
};
export default nextConfig;New apps created with the recommended create-next-app defaults already have both enabled. The flag makes Partial Prerendering the default for the App Router, and the old experimental.ppr option is gone.
With the flag on, Next.js prerenders a static shell for every page it can. Module imports, synchronous reads and pure computation finish during the build and go into the shell. Async work marked with "use cache" is prerendered too and cached with the lifetime you set. Uncached data and Request-time APIs have to sit inside a <Suspense> boundary, whose fallback becomes part of the shell. Otherwise the build fails with an error naming the route, unless you opt the segment out with export const instant = false. Calls like new Date() and Math.random() need an explicit decision too, and that opt-out doesn't cover them.
A blog index with a shared post list and one per-visitor section looks like this:
import { Suspense } from "react";
import { cookies } from "next/headers";
import { cacheLife, cacheTag } from "next/cache";
import { getPosts } from "@/lib/cms";
export default function BlogIndex() {
return (
<main>
<h1>Blog</h1>
<PostList />
<Suspense fallback={<p>Loading your saved posts...</p>}>
<SavedPosts />
</Suspense>
</main>
);
}
async function PostList() {
"use cache";
cacheLife("hours");
cacheTag("posts");
const posts = await getPosts();
return (
<ul>
{posts.map((post) => (
<li key={post.slug}>{post.title}</li>
))}
</ul>
);
}
async function SavedPosts() {
const saved = (await cookies()).get("saved")?.value ?? "";
const slugs = saved.split(",").filter(Boolean);
return <p>You have {slugs.length} saved posts.</p>;
}The heading, the cached post list and the fallback paragraph all end up in the prerendered shell. SavedPosts reads a cookie, so it streams in at request time. In the previous model that single cookies() call would make the entire route dynamic. With Cache Components, only the part inside the boundary waits for the request. When the CMS publishes, revalidateTag("posts", "max") refreshes the list.
cacheLife accepts a profile name or an object. The built-in profiles, from the revalidating docs:
| Profile | stale | revalidate | expire |
|---|---|---|---|
default | 5m | 15m | never |
seconds | 30s | 1s | 60s |
minutes | 5m | 1m | 1h |
hours | 5m | 1h | 1d |
days | 5m | 1d | 1w |
weeks | 5m | 1w | 30d |
max | 5m | 30d | 1y |
The seconds profile is short enough to be left out of prerenders and becomes a dynamic hole. A use cache scope can't call cookies() or headers(), so read them outside and pass the values in as arguments, which become part of the cache key. On serverless hosts, entries the default in-memory handler creates at runtime typically don't survive between requests, while build-time entries work normally.
Route Handlers follow the same rules once the flag is on. A GET handler that doesn't touch the request or uncached data is prerendered at build time, like a page.
Turning it on for this site
Building a copy of this repository with both flags enabled shows what the migration would involve. The first failure is a compile error in the Open Graph image route:
./app/api/og/route.tsx:6:14
Error: Route segment config "runtime" is not compatible with `nextConfig.cacheComponents`. Please remove it.That route exports runtime = "nodejs". Node.js is already the default, but Cache Components rejects any runtime export, so the line has to go.
The second failure comes from prerendering. The site's pages render a footer that prints the copyright year, and the build stops at the first route that hits it:
Error: Route "/tags/[tag]": Next.js encountered the unstable value `new Date()` while prerendering.The footer is a Server Component that renders new Date().getFullYear(). In the previous model that call runs once during the build and the year is baked into the HTML, which a comment in the footer already notes. With Cache Components the build stops until you choose: await connection() to compute it per request, "use cache" to cache it, or a Client Component. For a year, caching is the sensible choice:
import { cacheLife } from "next/cache";
async function CopyrightYear() {
"use cache";
cacheLife("days");
return <>{new Date().getFullYear()}</>;
}The older footer used by /v1 and /v2 needs the same change. After that the build passes, again abridged:
Route (app) Revalidate Expire
┌ ○ / 1d 1w
├ ○ /about 1d 1w
├ ƒ /api/og
├ ○ /api/openapi.json
├ ƒ /api/v1/contact
├ ƒ /api/v1/posts
├ ○ /api/v1/profile
├ ○ /api/v1/projects
├ ○ /blog 1d 1w
├ /blog/[...slug] 1d 1w
│ ├ ◐ /blog/[...slug] 1d 1w
│ ├ ○ /blog/debugging-react-performance-hydration-with-ai 1d 1w
│ ├ ○ /blog/essential-vscode-extensions 1d 1w
│ └ …
├ ƒ /sitemap.xml
└ ○ /versions 1d 1w
ƒ Proxy (Middleware)
○ (Static) prerendered as static content
◐ (Partial Prerender) prerendered as static HTML with dynamic server-streamed content
ƒ (Dynamic) server-rendered on demandComparing it with the first table:
- Pages are still
○, but each now shows a revalidate time of one day and an expiry of one week. Those are the numbers of thedaysprofile on the footer, which these pages render through their layouts. /api/v1/profile,/api/v1/projectsand/api/openapi.jsonbecame○because none of them reads the request./api/v1/postsand/api/ogstayƒbecause they read query parameters./sitemap.xmlwent from○toƒ. It setslastModified: new Date()for the main pages and tag pages, so it now renders per request instead of shipping the build date. With a fixed date in place ofnew Date(), the same build lists it as○again. I'd rather derivelastModifiedfrom the content and keep the sitemap static.- The dynamic routes gained a
◐row for the pattern itself, which covers slugs not returned bygenerateStaticParams.dynamicParamsis not supported with Cache Components, so those paths are always handled at request time.
A copyright year that can lag by about a day in January is fine for a portfolio. If it had to flip at midnight, connection() inside a Suspense boundary would do it, at the cost of rendering that piece on every request.
Which model I'd use
For this site the previous model is enough. Every page that matters for performance is ○ or ●, content only changes on deploy, and the trial migration only turned up two small fixes.
Cache Components earns its place when one page mixes shared and per-user data: a product page with a cart count, or a dashboard with a cached report next to live notifications. The previous model would render that whole route per request. With Cache Components the static shell can be served from a CDN and only the personal parts wait for the request.
For a new project I'd keep the create-next-app defaults and learn Cache Components from the start, since the cacheComponents docs say both flags will be enabled everywhere in the next major release. For an existing app, the migration guide maps each old segment config to its replacement, and the build errors name the failing route. For the footer here, the error also pointed at the exact line.