LearnAI ToolsCareerPractice BuildsPlayContact
Lesson 2817 min read

Incremental Static Regeneration (ISR)

Get static-level speed with periodically refreshed content, without rebuilding your entire site.

The Problem ISR Solves

Pure SSG is extremely fast but goes stale until the next full build. Pure SSR is always fresh but costs server work on every request. ISR sits between them: pages are served statically, but Next.js automatically regenerates them in the background after a time interval you choose — without needing a full site rebuild.

How ISR Works

Page is built statically once
↓
Visitors get the fast, cached HTML
↓
Interval passes (e.g. 60s)
↓
Next request triggers a background regeneration
↓
New HTML replaces the cache for future visitors
Nobody Waits

The visitor whose request triggers a background regeneration still gets the existing cached page instantly — they never wait on the regeneration; it happens for the benefit of the next visitor.

Setting Up ISR

Add a revalidate option to a fetch call — or export a route segment config — with the number of seconds before that content is eligible for regeneration.

// app/products/[id]/page.tsx
async function getProduct(id) {
const res = await fetch(`https://api.example.com/products/${id}`, {
next: { revalidate: 60 }, // regenerate at most once every 60 seconds
});
return res.json();
}
export default async function ProductPage({ params }) {
const product = await getProduct(params.id);
return <h1>{product.name}</h1>;
}

Alternatively, exporting a revalidate constant from the page file applies the same interval to the whole route segment:

export const revalidate = 60; // seconds

Stale-While-Revalidate Behavior

ISR follows a stale-while-revalidate model: once the interval passes, the currently cached (now "stale") page is still served immediately while a fresh version regenerates in the background for next time. This means visitors never experience the delay of a rebuild.

Time Since Last BuildWhat the Visitor Gets
Within the revalidate windowThe cached static page, instantly
Just past the revalidate windowThe (slightly stale) cached page, instantly — regeneration starts in the background
After regeneration completesThe newly regenerated page, for all subsequent visitors

FAQs

Yes — revalidatePath() and revalidateTag() let you trigger it on demand, covered in the caching and revalidation lessons.

It's fully supported on Vercel; other platforms may support it with varying levels of completeness, so check your specific host's Next.js support.

Summary

ISR combines the speed of static pages with content that refreshes on a schedule, without a full rebuild. With all four rendering strategies covered, the next section turns to data fetching and caching in more depth.

Next Lesson →

Data Fetching in Next.js