ISR
Incremental Static Regeneration: a Next.js feature that re-generates static pages in the background after a specified time interval, combining SSG speed with fresh data.
What is ISR?
In short
Incremental Static Regeneration (ISR) is a Next.js rendering strategy that serves a pre-built static HTML page instantly, then rebuilds that page in the background on a schedule or on demand so the cached version stays fresh without a full site redeploy. It gives you the speed of static pages with data that updates over time.
What ISR actually is
Static Site Generation (SSG) builds every page once at deploy time. That is fast for visitors because the CDN serves plain HTML, but the page is frozen until the next build. If you have 754 pages and one fact changes, you either rebuild all 754 or live with stale content.
ISR fixes that. You mark a page with a revalidation time, for example one hour. The first visitor after that hour still gets the old cached page immediately, and Next.js quietly regenerates a fresh copy in the background. The next visitor gets the new one. This pattern is called stale-while-revalidate: serve stale, refresh behind the scenes.
The key idea is that no visitor ever waits for a rebuild. Pages are produced lazily, one at a time, instead of all at once during deployment. A page that nobody visits never gets regenerated, which keeps compute cheap.
How it works under the hood
In the Next.js App Router you set export const revalidate = 3600 in a page or route segment, where the number is seconds. The framework caches the rendered output (the HTML plus the React Server Component payload and any fetch results) on the server and at the edge.
When a request arrives after the revalidate window has passed, Next.js returns the cached page and triggers a regeneration job. That job re-runs the server component, re-fetches data, and atomically swaps the cache entry. If regeneration fails, the old page keeps serving, so a broken data source does not take the page down.
Beyond time-based revalidation, Next.js supports on-demand revalidation. You call revalidatePath('/lessons/latency') or revalidateTag('courses') from a server action or webhook, and only the affected pages are invalidated. This is how a CMS publish button or a Stripe webhook can refresh exactly the pages that changed within seconds, with no redeploy.
When to use it and the trade-offs
ISR fits content that is read far more often than it is written and where minutes of staleness are acceptable: documentation, course lessons, product catalogs, blog posts, marketing pages. For a learning platform with hundreds of lesson pages, ISR means each page renders once on first visit and then serves from cache for everyone else.
Avoid ISR for content that must be correct to the millisecond, like a stock trading balance or a live auction price. Those want full server rendering or client fetching. Also avoid it for pages that are unique per user, since a shared cache cannot hold per-user state.
The main trade-offs: a visitor can see data that is up to one revalidation window old, and the first request after a deploy or after a cold page may be slightly slower while the initial render happens. On-demand revalidation removes most of the staleness concern but requires you to wire up the triggers correctly.
A concrete example
Imagine an e-commerce category page listing 200 products with prices. Pure SSG would freeze the prices until the next deploy. Pure SSR would hit the database on every single request, which is slow and expensive under traffic spikes.
With ISR you set revalidate to 60 seconds. A flash sale starts and 50,000 shoppers hit the page in a minute. They all get the same cached HTML from the CDN, so the database sees roughly one regeneration per minute instead of 50,000 queries. Prices are at most 60 seconds stale, which is fine for a catalog.
When an admin changes a price, the system fires revalidateTag('products') from the update handler, and the category page plus the affected product page refresh within a second rather than waiting out the 60 second window.
Where it is used in production
Vercel / Next.js
Vercel created ISR and runs it natively on its edge network; it powers static-plus-fresh pages for sites like the Next.js docs themselves.
Notion (public pages)
Notion-style published sites and many headless-CMS frontends regenerate pages on a revalidation timer so editors do not trigger a full rebuild on every edit.
HashiCorp (developer.hashicorp.com)
Serves large documentation sets as static pages that revalidate, keeping hundreds of docs pages fast without rebuilding the entire site per change.
systemdesign.academy
Renders all 754 lesson pages with ISR, so each lesson is built on first visit, cached at the edge, and refreshed on demand when content is republished.
Frequently asked questions
- What is the difference between ISR and SSG?
- SSG builds every page once at deploy time and the output stays frozen until the next build. ISR also serves pre-built static pages, but it regenerates them in the background after a set interval or on demand, so content stays fresh without a full redeploy.
- Does ISR make the user wait while the page rebuilds?
- No. ISR uses stale-while-revalidate: the visitor that triggers a refresh still gets the existing cached page instantly, and the new version is generated in the background and served to the next visitor.
- What is on-demand revalidation?
- Instead of waiting for a time interval, you call revalidatePath or revalidateTag from a server action or webhook to invalidate specific pages immediately. It is how a CMS publish or a payment webhook refreshes exactly the affected pages in about a second.
- When should I not use ISR?
- Avoid it for data that must be exact in real time, such as account balances or live auction bids, and for pages that are personalized per user, since the cache is shared across all visitors. Use server rendering or client fetching instead.
- How do I enable ISR in the Next.js App Router?
- Add export const revalidate = N to a page or route segment, where N is the number of seconds before the cached page becomes eligible for background regeneration. Setting it to false disables revalidation and keeps the page fully static.
Learn ISR hands-on
This page explains the idea. The full lesson lets you step through the ring as servers join and leave, read the implementation, and check yourself with a quiz. It is one of 760+ lessons in the System Design Masterclass, from your first API call to distributed consensus. Eleven Foundation lessons are free, no signup. Lifetime access is ₹499 in India or $7.99 worldwide, one payment, no subscription.
Related lessons
Lessons that touch on ISR as part of a larger topic.
Static Site Generation (SSG)
Pre-building HTML pages at build time, the fastest possible delivery for content that does not change per request
intermediate · web content delivery
Business Continuity Planning
Keep the business running during disruptions, beyond IT into organizational resilience
advanced · reliability resilience
See also
Related glossary terms you might want to look up next.
Static Site Generation (SSG)
Pre-rendering pages to static HTML at build time. The fastest possible page loads because there's no server-side computation on each request.
SSR
Server-Side Rendering: generating HTML on the server for each request. Slower than SSG but always returns fresh data. Good for personalized or frequently changing pages.
CDN
A network of servers distributed globally that caches content close to users. Netflix uses CDNs to stream video from servers near you, not from one central location.
Content Delivery
The process of distributing and serving content to users from locations geographically close to them for faster load times.
Edge Computing
Running computation at the network edge, close to the user, instead of in a central data center. Reduces latency for real-time applications like IoT and streaming.
HTTP Caching
Browser and proxy caching controlled by HTTP headers like Cache-Control, ETag, and Last-Modified. Eliminates redundant network requests for unchanged resources.