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
- User gets cached version.
- After
revalidate, Next.js regenerates in background. - New version replaces old.
Static fetch
fetch()withcache: "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