Rendering ahead of time
Static site generation renders pages once, at build time, producing plain HTML files. Those files are deployed to a CDN and served to every visitor without running any server logic per request.
- All work happens before any user arrives.
- Each request just returns a prebuilt file from a nearby edge node.
- Response times are very fast and very cheap.
Strengths and limits
Static generation is ideal for content that rarely changes, like docs, marketing sites, and blog posts.
- Pros are the fastest possible serving, low cost, and excellent SEO.
- Cons are that content is frozen until the next build, and large sites can have slow builds.
- A site with thousands of pages may take many minutes to rebuild.
Because output is just files, there is almost nothing to attack or scale on the server. The catch is freshness, if data changes you must rebuild and redeploy, which is why pure static generation suits content that updates on a slow cadence.
Key idea
Static site generation renders every page once at build time into CDN served files, giving the fastest cheapest delivery in exchange for content that stays frozen until the next rebuild.