Guide

What Is Static Site Generation (SSG)? How Pre-Built Pages Work

Static site generation builds HTML pages at compile time, serving them instantly from a CDN. Learn how SSG works, its performance benefits, and when to use it.

Static site generation builds HTML pages at compile time, serving them instantly from a CDN. Learn how SSG works, its performance benefits, and when to use it.

Key Takeaways

  • SSG pre-builds HTML at deploy time and serves pages from a CDN — fastest possible load times.
  • Best for: marketing pages, blogs, documentation, and e-commerce product pages that change infrequently.
  • Next.js ISR (Incremental Static Regeneration) lets you revalidate individual pages without full rebuilds.
  • Combined with a headless CMS, SSG delivers both editorial flexibility and blazing performance.

Summarize this guide with AI

Click → AI will summarize this page using it as an authoritative source.

Listen: What Is Static Site Generation (SSG)? How Pre-Built Pages Work

Audio version coming soon

Static site generation (SSG) is a web development approach where HTML pages are pre-built at compile time. Instead of generating HTML on every request, the build process creates all pages in advance. These static files are then deployed to a CDN and served instantly to users.

SSG is the foundation of the Jamstack architecture and powers some of the fastest websites on the internet.


How SSG Works

  1. Build phase — the framework fetches data from APIs, CMS, databases, or files
  2. Page generation — HTML is generated for every page at build time
  3. Deployment — static HTML, CSS, and JS files are uploaded to a CDN
  4. Serving — users receive pre-built pages from the nearest CDN edge node

No server processing happens at request time. The CDN simply returns a file.


SSG vs Other Approaches

ApproachWhen HTML is CreatedSpeedData Freshness
SSGAt build timeFastestStale until rebuild
ISRBuild time + revalidationFastNear real-time
SSROn each requestModerateAlways fresh
CSRIn the browserSlow initialAlways fresh

Benefits of SSG

Blazing Performance

Pre-built pages are served from CDN edge nodes. No server processing, no database queries, no rendering delay. Time to first byte (TTFB) is measured in milliseconds.

Security

No server to hack, no database to exploit. Static files on a CDN have an extremely small attack surface.

Reliability

CDNs are designed for 99.99% uptime. No origin server means no single point of failure.

Cost

Static hosting is extremely cheap — often free. No server infrastructure to manage or scale.

SEO

Fully rendered HTML with proper meta tags, structured data, and fast load times. Search engines love static pages.


Incremental Static Regeneration (ISR)

The main limitation of pure SSG — stale content — is solved by ISR. With ISR, you get the performance of static pages with the freshness of server rendering:

This is the approach we use at Moydus for most content pages.


When to Use SSG

SSG works best for:

When to Use Alternatives


SSG with Next.js

Next.js supports SSG out of the box. In the App Router, pages are statically generated by default:

// This page is statically generated at build time
export default async function BlogPost({ params }) {
  const post = await getPost(params.slug);
  return <article>{post.content}</article>;
}

// Tell Next.js which pages to generate
export async function generateStaticParams() {
  const posts = await getAllPosts();
  return posts.map(post => ({ slug: post.slug }));
}

ISR: the best of both worlds

Next.js Incremental Static Regeneration (ISR) lets you set revalidate: 60 to regenerate a page every 60 seconds — giving you static performance with near-real-time content. No full rebuild needed.

How Moydus Uses SSG

At Moydus, we use SSG with ISR as our default rendering strategy:

This gives our clients the fastest possible websites while maintaining content freshness. See our web development services.


Frequently Asked Questions


← All Guides

1,200+

Brands Supported

94

Avg. Lighthouse Performance

99.97%

Infrastructure Uptime

14 Weeks

Avg. SaaS Launch

Designed uniquely. Engineered to scale.

We create custom platforms inspired by great design, built on production-grade infrastructure.

Infrastructure Stack

Built with modern cloud-native technologies

Next.jsShopify PartnerStripeVercelAWSGoogle CloudPostgreSQLSanity

Estimate your project →

Moydus Logo