Rendering strategies
A web page’s HTML has to be produced somewhere: in the user’s browser, on a server for each request, or once at build time and served from a CDN. Where it happens is one of the most important frontend architecture decisions. It affects how fast the page appears, how fresh its data is, how well search engines see it, how much the hosting costs and how complex the system becomes.
Modern frameworks such as Next.js, Nuxt, SvelteKit, Remix and Astro let you choose per page, so the real skill is matching each page to the right strategy.
Diagram
Section titled “Diagram”- The browser asks the CDN; static and cached pages return immediately.
- Pages that must be fresh or personal are rendered on a server, close to the data, and can be streamed.
- JavaScript then makes the interactive parts work, ideally only those parts.
The strategies
Section titled “The strategies”| Strategy | HTML made | Best for | Trade-off |
|---|---|---|---|
| Static site generation (SSG) | Once, at build time | Marketing pages, docs, blogs | Content is only as fresh as the last build |
| Incremental or on-demand regeneration | At build, then refreshed in the background or when content changes | Large catalogs, content sites | Brief staleness; framework- and host-specific |
| Server-side rendering (SSR) | On every request | Personalized or fast-changing pages, SEO-critical dynamic content | Server cost; time to first byte depends on data |
| Streaming SSR | On request, sent in chunks as data arrives | Pages with some slow data | More complex error handling |
| Client-side rendering (CSR) | In the browser, from JavaScript | Highly interactive apps behind a login | Slow first load on weak devices; weaker SEO |
| Islands / partial hydration | Mostly static or server HTML, with small interactive “islands” | Content-heavy pages with a few interactive widgets | Shared state between islands needs care |
| React Server Components | Components run on the server; only interactive ones ship JavaScript | Large React apps wanting less client JavaScript | New mental model; framework support varies |
How it works
Section titled “How it works”- Decide per route, not per app. A retail site might use static pages for marketing, regenerated pages for product listings, server rendering for the cart and client rendering inside the account dashboard.
- Measure with Core Web Vitals. Largest Contentful Paint (loading), Interaction to Next Paint (responsiveness) and Cumulative Layout Shift (visual stability) are Google’s user-centric metrics. Pick the strategy that moves them for each page type.
- Ship less JavaScript. Hydration cost grows with the amount of JavaScript. Islands and server components reduce it by sending code only for interactive parts.
- Cache deliberately. Use CDN caching rules, cache keys and invalidation for each route. A server-rendered page can often be cached for seconds or minutes.
- Render near the data. Server rendering at the edge is fast only if the data is also nearby; otherwise render in the region where the database lives.
- Static and cached pages are fast, cheap and resilient.
- Server rendering gives fresh, personalized pages that search engines can index.
- Hybrid approaches let each page get what it needs.
- Hybrid apps are more complex to reason about, cache and debug.
- Server rendering costs compute on every uncached request.
- Client rendering pushes work to users’ devices, which are often slower than yours.
When to use it
Section titled “When to use it”Make this decision early for every user-facing web application, and revisit it when performance, SEO or hosting costs become a problem.
When to avoid it
Section titled “When to avoid it”Don’t adopt a complex hybrid framework for an internal tool used by a few people on fast laptops. A simple client-rendered app or server-rendered pages may be all you need.
Common pitfalls
Section titled “Common pitfalls”- A client-rendered app for public content, then fighting SEO and slow first loads.
- Server rendering everything without caching, and paying for it on every request.
- Hydrating the whole page when only a search box is interactive.
- Edge rendering far from the database, making every request slower.
Related patterns
Section titled “Related patterns”Further reading
Section titled “Further reading”- web.dev, Rendering on the web (opens in a new tab)
- web.dev, Core Web Vitals (opens in a new tab)
- patterns.dev, Rendering patterns (opens in a new tab)
- Astro, Islands architecture (opens in a new tab)
Written and edited by Abhinav Taduka, enterprise software architect.
New pages are added regularly. Follow Abhinav on LinkedIn to see them first.