What is Static Site Generation (SSG)?
You'll learn: How SSG pre-builds pages at build time and serves them as static files for blazing-fast performance.
The Core Concept
Static Site Generation (SSG) is a rendering approach where your web pages are pre-rendered into static HTML files during the build process, before any user requests them. Think of it like preparing meals in advance and freezing them—when someone's hungry (requests a page), you just heat it up (serve the file) rather than cooking from scratch each time.
Unlike SSR where pages are rendered on-the-fly for each request, or CSR where rendering happens in the browser, SSG generates all possible HTML pages once during deployment. These static files are then stored on a CDN and served instantly to users.
How It Works
When you build your site with SSG:
- Build time: The framework fetches data, runs your components, and generates complete HTML files for every route
- Deploy: These pre-built HTML, CSS, and JavaScript files are uploaded to a hosting service or CDN
- Request time: When a user visits, they receive the ready-made HTML file immediately—no server processing needed
The Performance Advantage
SSG delivers the fastest possible page loads because:
- No server computation on each request
- Files can be cached globally on CDNs
- The HTML is ready before the user even asks for it
- First meaningful paint happens almost instantly
This approach is ideal for content that doesn't change often—blogs, documentation, marketing sites, and portfolios. The trade-off? You need to rebuild and redeploy whenever content changes, making it less suitable for highly dynamic, user-specific content.
Key Takeaway: Static Site Generation pre-renders pages at build time into static HTML files, delivering unmatched performance for content that doesn't change frequently.