← Lessons

quiz vs the machine

Gold1380

Frontend

The Incremental Static Regeneration

Serve cached static pages but rebuild them in the background on a schedule so they stay fresh.

5 min read · core · beat Gold to climb

Static pages that refresh themselves

Incremental static regeneration keeps the speed of static files while letting them update without a full rebuild. Each page is generated and cached, then rebuilt in the background after a chosen time window or trigger.

  • A page is served instantly from cache, like static generation.
  • After a revalidation interval the next request triggers a background rebuild.
  • The stale page is shown until the fresh one is ready, then it swaps in.

Stale while revalidate behavior

This is a stale while revalidate strategy. Users never wait for a rebuild because they always get the cached copy first.

  • You pick a revalidate time, for example sixty seconds.
  • New pages can also be generated on demand the first time they are requested.
  • Freshness lags by at most one revalidation cycle plus rebuild time.

It fits large catalogs and news style content where you want static speed but cannot rebuild the whole site for every change. The tradeoff is that a user may briefly see slightly stale data while the background rebuild runs.

Key idea

Incremental static regeneration serves cached static pages instantly and rebuilds them in the background on a revalidation interval, blending static speed with bounded freshness so you avoid full rebuilds.

Check yourself

Answer to earn rating on the learn ladder.

1. How does incremental static regeneration keep pages fresh?

2. What does a user see while a background rebuild is running?

3. Which content fits incremental static regeneration best?