← Lessons

quiz vs the machine

Silver1100

Frontend

The Static Site Generation

Render pages once at build time into plain HTML files served straight from a CDN.

4 min read · intro · beat Silver to climb

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.

Check yourself

Answer to earn rating on the learn ladder.

1. When does static site generation render pages?

2. What is the main limitation of pure static generation?