Rendering Strategies (SSR / CSR / Static / Streaming)
Overview
Where and when you render HTML — on the server, in the browser, at build time, or progressively streamed — affects first paint, interactivity, and the amount of JavaScript shipped. There is no single best choice; each strategy trades time-to-first-byte, first contentful paint, and interactivity differently. Read this when picking a rendering approach for a page or framework, or diagnosing slow loads.
Official sources
Core concepts
- Server-side rendering (SSR). Render the app on the server and send HTML; this gives fast first contentful paint and ships less JavaScript, but server work can delay time-to-first-byte (web.dev/articles/rendering-on-the-web).
- Client-side rendering (CSR). Render in the browser with JavaScript modifying the DOM; large bundles can hurt interactivity (INP) (web.dev/articles/rendering-on-the-web).
- Static rendering (SSG). Generate HTML at build time, one file per URL, for fast FCP and low blocking time; struggles when URLs are unpredictable (web.dev/articles/rendering-on-the-web).
- Hydration / rehydration. Run client scripts to attach state and interactivity to server-rendered HTML; done poorly, a page can look interactive before it actually is (web.dev/articles/rendering-on-the-web).
- Streaming SSR. Send HTML in chunks the browser renders progressively, improving perceived load (web.dev/articles/rendering-on-the-web).
- Server vs Client Components (Next.js). Components default to the server for data fetching and smaller bundles; mark interactive ones with
'use client', and stream server-rendered chunks to the client (nextjs.org server-and-client-components).
Best practices
- Measure where the bottleneck is (TTFB, FCP, INP) before choosing a strategy; the right answer depends on your content and audience (web.dev/articles/rendering-on-the-web).
- Prefer server rendering for data-fetching and secret access, keeping API keys off the client and reducing shipped JavaScript (nextjs.org server-and-client-components).
- Add
'use client' to the smallest interactive components rather than large subtrees, so static parts stay server-rendered and bundles stay small (nextjs.org server-and-client-components).
- Use streaming with
<Suspense> boundaries so a fast shell renders while slower, dynamic content streams in (nextjs.org server-and-client-components).
Common pitfalls
- Shipping a large CSR bundle for content that could be static or server-rendered → use SSR/SSG to cut JavaScript and improve FCP (web.dev/articles/rendering-on-the-web).
- Marking large subtrees
'use client' → every import in that file joins the client bundle; scope the directive to the interactive leaf (nextjs.org server-and-client-components).
Examples
// Next.js App Router: Server Component fetches data; only the leaf is a Client Component.
import LikeButton from './like-button'; // 'use client' lives in this file
export default async function Page({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
const post = await getPost(id); // runs on the server
return <article><h1>{post.title}</h1><LikeButton likes={post.likes} /></article>;
}
Further reading
Related skills
- ../frontend-architecture — code-splitting and component boundaries
- ../state-management — hydrating and managing state across the server/client boundary
1---2name: rendering-strategies-ssr-csr3description: Trade-offs between SSR, CSR, static rendering, and streaming for web apps; consult when choosing where and when UI is rendered.4domain: engineering5category: frontend6tags: [ssr, csr, ssg, streaming, hydration, rendering, nextjs]7official_sources:8 - https://web.dev/articles/rendering-on-the-web9 - https://nextjs.org/docs/app/getting-started/server-and-client-components10 - https://github.com/vercel/next.js11verified: 2026-06-1612metadata:13 source: https://skillmd.com/skills/gabriel7silva/rendering-strategies-ssr-csr14---1516# Rendering Strategies (SSR / CSR / Static / Streaming)1718## Overview19Where and when you render HTML — on the server, in the browser, at build time, or progressively streamed — affects first paint, interactivity, and the amount of JavaScript shipped. There is no single best choice; each strategy trades time-to-first-byte, first contentful paint, and interactivity differently. Read this when picking a rendering approach for a page or framework, or diagnosing slow loads.2021## Official sources22- Google web.dev — Rendering on the Web: https://web.dev/articles/rendering-on-the-web23- Next.js — Server and Client Components: https://nextjs.org/docs/app/getting-started/server-and-client-components24- Repo (Next.js): https://github.com/vercel/next.js2526## Core concepts27- **Server-side rendering (SSR).** Render the app on the server and send HTML; this gives fast first contentful paint and ships less JavaScript, but server work can delay time-to-first-byte (web.dev/articles/rendering-on-the-web).28- **Client-side rendering (CSR).** Render in the browser with JavaScript modifying the DOM; large bundles can hurt interactivity (INP) (web.dev/articles/rendering-on-the-web).29- **Static rendering (SSG).** Generate HTML at build time, one file per URL, for fast FCP and low blocking time; struggles when URLs are unpredictable (web.dev/articles/rendering-on-the-web).30- **Hydration / rehydration.** Run client scripts to attach state and interactivity to server-rendered HTML; done poorly, a page can look interactive before it actually is (web.dev/articles/rendering-on-the-web).31- **Streaming SSR.** Send HTML in chunks the browser renders progressively, improving perceived load (web.dev/articles/rendering-on-the-web).32- **Server vs Client Components (Next.js).** Components default to the server for data fetching and smaller bundles; mark interactive ones with `'use client'`, and stream server-rendered chunks to the client (nextjs.org server-and-client-components).3334## Best practices35- Measure where the bottleneck is (TTFB, FCP, INP) before choosing a strategy; the right answer depends on your content and audience (web.dev/articles/rendering-on-the-web).36- Prefer server rendering for data-fetching and secret access, keeping API keys off the client and reducing shipped JavaScript (nextjs.org server-and-client-components).37- Add `'use client'` to the smallest interactive components rather than large subtrees, so static parts stay server-rendered and bundles stay small (nextjs.org server-and-client-components).38- Use streaming with `<Suspense>` boundaries so a fast shell renders while slower, dynamic content streams in (nextjs.org server-and-client-components).3940## Common pitfalls41- Shipping a large CSR bundle for content that could be static or server-rendered → use SSR/SSG to cut JavaScript and improve FCP (web.dev/articles/rendering-on-the-web).42- Marking large subtrees `'use client'` → every import in that file joins the client bundle; scope the directive to the interactive leaf (nextjs.org server-and-client-components).4344## Examples45```tsx46// Next.js App Router: Server Component fetches data; only the leaf is a Client Component.47import LikeButton from './like-button'; // 'use client' lives in this file4849export default async function Page({ params }: { params: Promise<{ id: string }> }) {50 const { id } = await params;51 const post = await getPost(id); // runs on the server52 return <article><h1>{post.title}</h1><LikeButton likes={post.likes} /></article>;53}54```5556## Further reading57- https://web.dev/articles/rendering-on-the-web — full SSR/CSR/static/streaming trade-off guide58- https://nextjs.org/docs/app/getting-started — Next.js App Router fundamentals5960## Related skills61- ../frontend-architecture — code-splitting and component boundaries62- ../state-management — hydrating and managing state across the server/client boundary