Overview
Incremental Static Regeneration (ISR) is stale-while-revalidate for prerendered pages. In the Next.js App Router, set export const revalidate = 3600: after the window, the next request still gets the cached page and triggers a background rebuild, and the request after that gets the fresh one. Pick it for product or article pages that change hourly or daily and see too much traffic to render per request.
Rules
- Prefer a long window (an hour) plus on-demand
revalidatePathorrevalidateTagwhen edits must show at once. Use ssr for per-request or per-user data. - If regeneration fails, the last good page keeps serving and the next request retries.
- Pages not returned by
generateStaticParamsare generated on first request unlessdynamicParamsis changed. - ISR needs the Node.js runtime (self-hosted, Docker) or a platform adapter. It is not supported with
output: "export". - With several instances, the default cache is per instance; share a custom cache handler. With
cacheComponentsenabled, follow the separate “ISR with Cache Components” guide.
// app/blog/[id]/page.tsx
export const revalidate = 3600
export async function generateStaticParams() { return [{ id: "1" }] }Related
- ssg: build-time pages that ISR extends.
- ssr: per-request rendering for data that cannot be stale.
- csr: no server rendering at all.
- nextjs-caching: the cache layers behind ISR.
- nextjs: App Router rendering and caching defaults.