Rendering strategies: client, server, static
Where a page's HTML is built: in the browser, on the server per request, or once at build time. The choice sets when first content paints, how much JavaScript runs before a tap works, and what can be personalized.
What it is
A rendering strategy answers one question: where does the HTML that the browser paints come from? Client-side rendering builds the page in the browser: the JavaScript downloads, runs and creates the DOM, usually fetching the data it needs along the way, so logic, templating and routing happen on the device. Server-side rendering builds the full HTML on the server for each navigation, so the data fetching and templating happen before the browser gets its response. Static rendering does that work once, at build time, producing an HTML file per URL that can sit on a CDN. Each shifts work between build, server and device, and so changes when the first content appears and when the page can respond to a tap.
Server and static rendering give you HTML, and anything that depends on JavaScript, which in an app is often most of it, still needs its scripts. Hydration is the step where client-side JavaScript runs over the server-built DOM, attaches event handlers and restores application state. It assumes the DOM it finds matches what it would have rendered. To avoid fetching everything again, most frameworks also serialize the data the server used into script tags, so the response carries the UI as HTML, the same data again, and the code that rebuilds the UI. The visible cost is a window in which the page looks finished but its script-driven parts don't respond, because the handlers aren't attached until the bundle has executed. On a weak phone, web.dev reports, that window can stretch to minutes.
Two refinements help. Streaming sends the HTML in chunks that the browser parses and paints as each arrives, so the top of the page shows before the server has finished the bottom; it brings paint forward, not the attaching of handlers. React's renderToPipeableStream() is asynchronous and streams, where the older renderToString() is synchronous and single-threaded. Progressive hydration boots pieces of the page over time instead of the whole app at once, so low-priority parts can be deferred and stop blocking the main thread; that is what shortens the inert window. It can also help with a classic failure: the client's first render needs data that hasn't resolved, so it throws away the server's DOM and rebuilds it.
When to use it
Static fits pages that read the same for everyone and whose URLs you know ahead of time: documentation, marketing pages, articles. It gives a fast first paint and a consistently quick first byte, because nothing is generated at request time, and the files can be pushed to several CDNs for edge caching. Keep the client-side JavaScript small and the interaction metrics stay good too.
Server rendering fits content that is personalized or changes between requests, where you still want the first content in the HTML. It usually produces a fast first contentful paint and lets you ship less JavaScript, which helps the main thread stay free. Where the HTML is cacheable, caching the rendered output cuts the server's render time; where it isn't, stream it so the first chunk reaches the browser while the rest is still being built. Frameworks such as Next.js and Nuxt let you choose static or server rendering page by page.
Client rendering fits what happens after the first load: in-app navigations, filters, anything that changes without a new URL. For a single-page app, an application shell cached by a service worker makes repeat visits feel fast, because the shell and its dependencies come from CacheStorage. With a tight JavaScript budget, few round trips and preload hints for the critical scripts and data, a client-rendered first load can approach server rendering, but it takes that discipline.
Whichever mix you pick, the measure is how soon the main content paints for real users. The target for Largest Contentful Paint, one of the Core Web Vitals, is 2.5 seconds or less at the 75th percentile of page loads, segmented by mobile and desktop. The element that counts is typically an image, a video poster, a background image or a block of text; Chromium-based browsers also skip likely non-content such as placeholders and low-detail images. In the field you read it from the Chrome User Experience Report or the web-vitals library, and in your own code a PerformanceObserver on largest-contentful-paint entries reports each candidate as it paints.
When not to
Skip static rendering when the page is personalized or the set of URLs is unbounded: you'd need to generate an HTML file for each possible address, and you can't predict a feed per user. Skip server rendering for pages whose content is the same for everyone: it adds per-request compute and a slower first byte to produce what a build step could have produced once, and many server renderers also double the payload by inlining state. Skip a client-rendered first load for content-first pages on mobile: the JavaScript needed grows with the app, competes with libraries and third-party code for the CPU, and usually has to finish before anything renders.
Compared
| Strategy | Where HTML is built | Reach for it when | What it costs |
|---|---|---|---|
Static | Once, at build time, one file per URL | Content is the same for everyone and URLs are known | Prebuilt HTML isn't per user; a file per possible URL |
Server-rendered | On the server, per request | Content is personal or live and must be in the first HTML | Server compute and TTFB; script-driven controls wait for hydration |
Streaming server render | On the server, flushed in chunks | The top of the page is ready before the bottom | More moving parts; interactive parts still hydrate |
Client-rendered | In the browser, after the script runs | Navigations after load; repeat visits with a cached shell | Content usually waits on JavaScript; the bundle grows with the app |
Prerendered SPA | Client app captured at build time | You have an SPA and want an earlier first paint | Links work, but scripted controls wait until the app boots; more JavaScript than static |
In a picture
Step 1 of 3
The shell arrives
The browser asks for the page. The server flushes the first chunk right away: the document head and a layout that needs no data. The browser parses and paints it while the server keeps working.