The Spectrum of Modern Web Rendering
One of the most consequential decisions when designing a web platform is deciding where and when your HTML is generated. Choose incorrectly, and you either overwhelm your databases with unnecessary queries or deliver stale, outdated data to your visitors.
Modern full-stack frameworks provide multiple rendering strategies:
Understanding the latency, cost, and freshness tradeoffs of each model is essential for any high-scale digital product.
Strategy Comparison Matrix
| Strategy | When HTML is Built | TTFB (Time to First Byte) | Database Load | Content Freshness |
|---|---|---|---|---|
| SSG | Build time | Instant (~20ms from CDN Edge) | Zero runtime queries | Requires build to update |
| ISR | Build time + Background revalidation | Instant (~20ms from CDN Edge) | Minimal background queries | Eventually consistent |
| SSR | On every user request | 150ms – 400ms (Origin dependent) | High (query per request) | Real-time immediate |
| CSR | In the user's browser | Fast shell, slow interactive paint | Distributed API calls | Dependent on client network |
1. Static Site Generation (SSG)
SSG compiles HTML, CSS, and data payloads ahead of time during the deployment build process. The resulting static files are distributed globally across Content Delivery Network (CDN) edge nodes.
Best Used For:
// Next.js static generation with automated prerendering
export default async function TermsPage() {
const content = await loadTermsDocument();
return <article dangerouslySetInnerHTML={{ __html: content }} />;
}2. Server-Side Rendering (SSR)
SSR compiles HTML dynamically on an edge worker or Node.js server for every single incoming HTTP request. This ensures that the generated document reflects the exact millisecond-level state of user permissions, inventory, or cart data.
Best Used For:
export async function generateMetadata({ searchParams }: Props) {
const query = (await searchParams).q;
return { title: `Search results for "${query}" | Platform` };
}3. Incremental Static Regeneration (ISR)
ISR combines the speed of global CDN edge caching with the freshness of server rendering. Pages are served statically from edge cache; after a defined cache expiration window (e.g., 60 seconds), the next request triggers a background revalidation that generates updated HTML without blocking the user.
// Revalidate this article page at most once every hour
export const revalidate = 3600;
export default async function BlogPostPage({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params;
const post = await fetchPostFromDatabase(slug);
return <ArticleLayout post={post} />;
}Architectural Decision Framework
To select the right rendering strategy for each route:
👉 Use SSG.
👉 Use ISR.
👉 Use SSR.
By mixing these strategies on a per-route basis, you achieve optimum speed, rock-bottom infrastructure costs, and pristine user experience.