Full answer
CSR (client-side rendering). The server returns a small HTML file with a script. The browser downloads and runs the script, which fetches data and builds the DOM. Before that, the user sees a blank page or a spinner. After the first load, navigation can be fast because the app is already in memory. Hosting is cheap, since the server only returns static files and an API. Search engines can run JavaScript, but indexing is slower and less certain than for HTML that is already complete.
SSR (server-side rendering). For each request the server fetches data, builds the HTML and sends it. The browser can paint real content when the HTML arrives, even before the JavaScript has loaded. The page is then hydrated: the script attaches event handlers to the existing HTML. SSR costs CPU on every request, and the time to first byte depends on how fast the data is available. A page can look ready but not respond until hydration is done.
How to choose:
- Public pages that need search traffic and a fast first view, such as a course page or an article: SSR or static generation.
- Private screens such as a dashboard, where no crawler is involved and data is per user: CSR is often enough.
- Mixed sites: use a framework that mixes both per route.
Neither is faster in every case. Say which metric you mean. SSR often wins on LCP and loses on server cost and sometimes on TTFB. CSR can win on later navigations.
The Node script serves the same list in both ways: /ssr includes the items in the HTML, /csr fills them in with fetch after load. The test loads both pages with JavaScript disabled and then enabled. With scripts off, only the SSR page shows the items.
import http from 'node:http';
const courses = ['Algebra', 'Geometry'];
const list = (items) => `<ul id="list">${items.map((c) => `<li>${c}</li>`).join('')}</ul>`;
http.createServer((req, res) => {
if (req.url === '/api/courses') {
res.setHeader('content-type', 'application/json');
return res.end(JSON.stringify(courses));
}
res.setHeader('content-type', 'text/html');
if (req.url === '/ssr') {
return res.end(`<!doctype html><title>SSR</title><h1>Courses</h1>${list(courses)}`);
}
if (req.url === '/csr') {
return res.end(`<!doctype html><title>CSR</title><h1>Courses</h1><div id="root"></div>
<script>
fetch('/api/courses').then((r) => r.json()).then((items) => {
document.getElementById('root').innerHTML = '<ul id="list">' + items.map((c) => '<li>' + c + '</li>').join('') + '</ul>';
});
</script>`);
}
res.statusCode = 404;
res.end('not found');
}).listen(process.env.PORT, () => console.log('listening'));Run in headless Chrome 156 through Playwright. Two full runs gave the same results. Run with a Node server and headless Chrome. With JavaScript turned off, only the SSR page showed the items. With it on, both pages did. Server timing, hydration and search behaviour were not measured.
Key points
- SSR sends complete HTML. CSR sends a shell and builds the page in the browser.
- SSR helps first paint and indexing. It costs server CPU and needs hydration.
- CSR is cheaper to host and fits logged-in, app-like screens.
- Compare by metric: LCP, TTFB, interactivity and server cost.
- Frameworks let each route pick its own strategy.
Common mistakes
- Claiming SSR is always faster.
- Forgetting that SSR pages still need JavaScript to become interactive.
- Saying search engines cannot run JavaScript at all.
- Choosing SSR for a private dashboard where it adds cost and no benefit.
Follow-ups
- What is hydration and what can go wrong?
- How does SSR change TTFB?
- How would you serve a mostly static page that has one personalised part?
Tips
- Say the metric when you say faster.
- Give one page type for each strategy.