Incremental Static Regeneration (ISR)
A hybrid rendering strategy that updates static pages in the background on a schedule or webhook trigger without rebuilding the entire site
Table of Contents
Structure Diagram
What is Incremental Static Regeneration (ISR)?
A hybrid rendering strategy that updates static pages in the background on a schedule or webhook trigger without rebuilding the entire site. It is a core concept in Rendering & Frontend within Web Dev.
Core Principles
Incremental Static Regeneration (ISR) bridges the speed of SSG and the freshness of SSR. Built on the stale-while-revalidate pattern, once a cached page's revalidation window expires, the next visitor still receives the cached HTML instantaneously while the server regenerates a fresh version in the background and atomically swaps it into the cache.
Beyond time-based intervals, On-Demand ISR lets a CMS or backend trigger revalidation for specific routes or cache tags via an authenticated webhook the moment content changes.
Practical Takeaways
- Pair time-based TTL with on-demand webhooks: Use a short TTL (e.g., 60–300s) for feeds where slight staleness is acceptable, and trigger tag-based invalidation from your CMS or inventory service when immediate accuracy matters.
- Built-in resilience on upstream errors: If a background regeneration fails due to an API outage, the last known-good static HTML continues serving instead of returning a 500 error.
- Never cache user-specific state: Because ISR responses are shared across all visitors, keep authentication and personalized data strictly out of the cached HTML output.
Notable Examples
- Large e-commerce catalogs: Pre-render top SKUs at build time, generate long-tail product pages lazily on first visit, and revalidate on price or stock updates.
- Headless CMS newsrooms: Editors publish updates in Sanity or Contentful, firing a webhook that refreshes only the edited article and its category listing.
- Travel and real-estate listings: Preserve CDN-level TTFB for SEO while refreshing availability and daily pricing automatically.