System Status

Demonstrating incremental static regeneration

isr

This page is prerendered and regenerated in the background when stale. The generated_at timestamp freezes at build time.

Page Generated At

2026-04-06 06:56:30 UTC

This timestamp was frozen when the page was prerendered. With ISR, it updates only when the page is regenerated in the background.

Live Clock

06:56:30 UTC

Will update after LiveView connects

How ISR Works on This Page

1

Build time generation

mix phoenix.prerender renders this page and writes it to disk. The "Page Generated At" timestamp is frozen.

2

First request

The plug serves the static file instantly. If the file is older than revalidate seconds, a background regeneration is triggered.

3

Background regeneration

The Regenerator re-renders the page through the endpoint, writes fresh HTML atomically, and updates the ETS page cache. An ETS lock prevents duplicate work.

4

Next request

The fresh page is served. The "Page Generated At" timestamp is now updated. The user who triggered regeneration saw the stale page but got an instant response.

ISR (this page)

  • ✓ Instant response (serves stale)
  • ✓ Background regeneration
  • ✓ No full rebuild needed
  • ✓ Thundering herd prevention

Dynamic (/dashboard)

  • ✓ Always fresh data
  • ✓ User-specific content
  • ✗ Full render on every request
  • ✗ Higher server load

This Route's Configuration

# router.ex — ISR is opt-in per route
      prerender do
live "/status", StatusLive, :index,
metadata: %{prerender: :always, isr: true}
end

# config/prod.exs
config :phoenix_prerender,
enabled: true,
revalidate: 300  # seconds before stale

The <.prerendered> component freezes the "Page Generated At" timestamp via phx-update="ignore".