Dmytro Morar
Next.js

Static Generation

App Router decides whether a page is static, dynamic, or revalidatable based on cache rules.

Static rendering (SSG)

  • Automatic when no dynamic params, no no-store, no cookies/headers.
  • HTML + RSC payload generated at build time.

ISR

  • Background revalidation after a time window.
export const revalidate = 60;
fetch(url, { next: { revalidate: 120 } });

How ISR works

  1. User gets cached version.
  2. After revalidate, Next.js regenerates in background.
  3. New version replaces old.

Static fetch

  • fetch() with cache: "force-cache" keeps data static.
  • Caches: Data Cache, RSC Cache, Full-Route Cache.

What makes a route dynamic

  • cache: "no-store"
  • cookies/headers
  • dynamic = "force-dynamic"
  • dynamic params without pre-generation

Summary

  • revalidate = N → ISR
  • no dynamics → SSG
  • no-store → SSR

On this page