Incremental static regeneration

Also known as: ISR

On this page 7

Incremental static regeneration (ISR) is a rendering strategy for web applications in which prebuilt static pages are regenerated individually after deployment, either on a timer or on demand, without rebuilding the whole site. It combines the speed and cacheability of static site generation with the freshness that server-side rendering normally provides.

The technique was popularized by Next.js and has since been adopted, under various names, by other frameworks and hosting platforms. ISR treats every page as a cached artifact with an expiry policy: visitors receive the stored HTML immediately, while the server refreshes outdated copies in the background.

How incremental static regeneration serves and refreshes pages

ISR follows the stale-while-revalidate pattern known from HTTP caching. Each generated page carries a revalidation interval, for example 60 seconds. Requests inside that window receive the cached page. The first request after the window expires still receives the cached, now stale, page, but it also triggers a background regeneration. Once the new version is generated successfully, it replaces the old one for all subsequent visitors.

Pages that were not generated at build time can be created on first request. The framework renders the page on the server, stores the result, and serves it statically from then on. This lets a catalog with millions of URLs deploy with only its most popular pages prebuilt.

The lifecycle of a single page under ISR can be summarized in the following stages.

StageWhat the visitor receivesWhat the server does
Build timeNothing yetPrerenders selected pages to HTML and data files
Fresh windowCached page, instantlyNothing
First request after expiryStale cached pageStarts background regeneration
Regeneration succeedsNew page on next requestReplaces cache entry
Regeneration failsLast good pageKeeps old entry, retries later
Unbuilt path requestedRendered page or fallbackRenders, then caches the result
Lifecycle of a page under ISR

A crucial property is graceful failure. If the data source is unreachable during regeneration, the previously generated page remains in service, so a database outage degrades freshness rather than availability.

Time-based and on-demand revalidation

ISR offers two ways to decide when a page is outdated. Time-based revalidation relies on a fixed interval; on-demand revalidation lets an external event, such as a content management system webhook, invalidate a specific path or a cache tag immediately. Most production systems combine both.

ModeTriggerFreshnessTypical use
Time-basedInterval elapses, then a request arrivesBounded by interval plus one requestNews lists, prices updated hourly
On-demand by pathAPI call or webhook naming a URLSeconds after the changeEdited article or product page
On-demand by tagWebhook naming a data tagSeconds, across many pagesShared navigation or category data
CombinedWebhook plus fallback intervalFast, with a safety netMost content-driven sites
Revalidation modes compared

Time-based revalidation is lazy by design: a page that nobody visits is never regenerated, which saves compute but means a rarely visited page can be much older than its interval when the next visitor arrives. That visitor still sees the stale version once. On-demand revalidation removes this delay for content whose changes are known, which is why editorial teams usually prefer it.

ISR compared with SSG, SSR and client-side rendering

ISR occupies the middle ground between SSG and SSR. It inherits the delivery model of static generation and borrows the per-request data access of server rendering, but only for regeneration rather than for every visit. The table contrasts the main rendering strategies used in web applications.

StrategyWhen HTML is producedData freshnessServer cost per visitTTFB
SSGOnly at build timeUntil next full buildNoneVery low
ISRBuild time and in backgroundWithin interval or on demandNear zeroVery low
SSROn every requestReal timeHighDepends on data latency
Client-side renderingIn the browserReal timeLow for HTML, API calls remainLow, but late content
Rendering strategies at a glance

Pages produced by ISR still go through hydration in the browser when they contain interactive components, exactly as SSG pages do. ISR therefore does not reduce JavaScript cost; it addresses server response time and data freshness, not client execution.

When to choose incremental static regeneration

ISR fits content that is read far more often than it changes and that is identical for every visitor. It is a poor fit for personalized or per-user content, because a cached page is shared by everyone who requests that URL.

SituationRecommended approachReason
Large product catalog, prices change hourlyISR with tags and intervalFast pages, controlled staleness
Editorial site with a headless CMSISR with on-demand webhooksEdits appear within seconds
Account dashboard or shopping cartSSR or client-side renderingContent is per user
Stock tickers or live scoresSSR or streaming updatesSeconds of staleness unacceptable
Documentation updated per releasePlain SSGFull rebuild is cheap and predictable
Decision guide for ISR

A practical pattern is to mix strategies per route: the catalog uses ISR, the checkout uses SSR, and personalized widgets on otherwise static pages load on the client. Choosing the interval is a business decision, so teams should ask how stale a page may be before it causes harm, then set the interval and webhook coverage accordingly.

Limitations and operational pitfalls

ISR depends on a runtime that can store and replace cached pages, so it does not work on purely static file hosting. Its behavior also differs between hosting platforms, especially regarding where the cache lives and how it propagates across regions. Common problems include the following:

  • Inconsistent caches across regions, where one edge location serves a newer page than another for a short period.
  • Cascading staleness, when a listing page and its detail pages revalidate on different schedules and show conflicting data.
  • Accidental personalization, where cookies or headers read during regeneration leak one visitor’s data into a shared page.
  • Webhook gaps, when a content change has no matching invalidation call and the page waits for its interval.
  • Underestimated regeneration load, when a short interval on thousands of busy pages turns ISR back into near-continuous server rendering.

Monitoring should therefore track regeneration errors, cache hit ratio and content age, not only response time, because a fast page that silently stopped refreshing is a correctness failure.

A plain-language summary

Imagine a bakery that bakes a batch of bread every morning and sells loaves straight from the shelf, so nobody waits. Every so often, or whenever the recipe changes, the baker quietly bakes a fresh batch and swaps it onto the shelf. Customers always get bread immediately, and the bread is never more than a little old.

Incremental static regeneration does the same with web pages. The site keeps ready-made copies so pages open instantly, and it refreshes each copy in the background when it is due or when an editor changes something, instead of rebuilding the entire website.

An example from practice

An online furniture store has 180,000 product pages. A full static build takes almost two hours, which made same-day price corrections impossible, while server rendering every page pushed TTFB above 900 milliseconds during sales because each request queried the inventory service.

The team moves product pages to ISR. Only the 5,000 best-selling products are prebuilt; the rest are generated on first request. Each page carries a revalidation interval of 15 minutes, and the inventory system sends an on-demand revalidation webhook whenever a price or stock level changes.

After the change, median TTFB falls to roughly 80 milliseconds because nearly every request is a cache hit, deployments finish in about ten minutes, and corrected prices appear on the live page within seconds of being saved.