Serksa
All Concepts
Frontend Architecture

Static Site Generation

1

What is it?

<strong>Static Site Generation (SSG)</strong> is when you build all your HTML pages at build time, not at request time. The result is pre-rendered HTML files that load instantly and can be served from a CDN.

2

Think of it like...

The Newspaper Analogy

SSG is like printing newspapersโ€”you create all copies in advance (build time) and distribute them. Readers get instant access without waiting for printing (rendering).

๐Ÿญ

Printing Press (Build Time)

Print all copies

๐Ÿ“ฐ

Newspapers (Static HTML)

Pre-made, ready to read

๐Ÿ“ฌ

Delivery (CDN)

Distribute everywhere

3

Visual Flow

โš™๏ธBuild Time

Generate All Pages

โ†’
๐Ÿ“„Static HTML

Pre-rendered Files

โ†’
๐ŸŒUser Request

Instant Load

4

Where you see it

1

Fetch data at build

Query CMS, database, APIs during build

2

Generate HTML pages

Create static HTML for every page/route

3

Deploy to CDN

Upload static files to Vercel, Netlify, etc.

4

User requests page

Served instantly from CDN, no server processing

5

Rebuild on changes

Trigger new build when content updates

5

Common Mistake

โŒ

Wrong

"Static sites can't be dynamic or interactive"

โœ…

Correct

SSG sites can be <strong>highly interactive with JavaScript</strong>. The initial HTML is static, but client-side JS adds interactivity, real-time features, etc.

๐Ÿ’ก Real-World Example

Documentation site with SSG:

1

Build generates HTML for all 1000 doc pages

2

Deployed to CDN (Vercel, Netlify)

3

Users get instant page loads (no server rendering)

4

Perfect for blogs, docs, marketing sites