In the ssr vs csr debate, the difference is where the HTML is produced. With server-side rendering (SSR) the server builds the HTML for a page and sends it ready to display. With client-side rendering (CSR) the server sends a nearly empty HTML shell plus JavaScript, and the browser builds the page after the script runs.
Neither is better everywhere. SSR gives a faster first paint and content that crawlers can read immediately, while CSR gives fast navigation inside an app once it has loaded. Modern frameworks such as Next.js let you mix both per route.
In a classic single-page app, the response for every URL is the same small document:
The browser downloads app.js, runs it, fetches data from an API and then inserts the elements into #root. Until all of that finishes, the user sees a blank page or a spinner.
Costs and benefits of CSR:
With SSR the server runs your component code for each request, fetches the data it needs, and returns finished HTML:
The last step is hydration: the browser JavaScript walks the existing HTML and connects it to the component tree so buttons and forms become interactive. Until hydration completes, the page looks ready but may not respond to clicks.
| Aspect | Client-side rendering | Server-side rendering |
|---|---|---|
| HTML in first response | Empty shell | Complete content |
| First contentful paint | Slower on weak devices | Faster, depends on server speed |
| Time to interactive | After bundle runs | After hydration |
| SEO and link previews | Weaker unless crawler runs JS | Strong |
| Server load | Very low | Higher, work per request |
| Hosting | Any static host | Needs a server or edge runtime |
| Navigation after load | Very fast | Fast if the framework does client routing |
SSR and CSR are two points on a wider scale. Frameworks offer more options:
Next.js with the App Router renders components on the server by default (React Server Components) and lets you opt into the browser with "use client". Dynamic behaviour depends on whether a route reads request data such as cookies or uses uncached fetches.
The product text arrives as HTML from the server, while only the small button ships interactive JavaScript. Check the version of Next.js you use, because caching defaults for fetch have changed between major releases.
Date.now() or reading window), React warns and may re-render. Keep render output deterministic.window or localStorage during server render throws an error. Use them inside effects or client components.Not always. Googlebot can run JavaScript, but rendering is queued and less reliable for other crawlers and social previews. SSR or static HTML removes that risk, which is why content sites favour it.
No. Dashboards behind a login, editors and highly interactive tools gain little from SSR and are simpler to build and host as CSR apps.
SSR renders on every request, SSG renders once at build time. SSG is faster and cheaper when the content is the same for everyone.
It usually improves first paint, but a slow database call on the server can make it slower. Caching and streaming decide the real result.
Client-side rendering builds the page in the browser from JavaScript, and server-side rendering sends finished HTML. SSR helps first paint and SEO at the cost of server work, while CSR suits app-like screens and static hosting. In practice you pick per route, using static generation for stable content, SSR for personalised or fresh pages and client components only where interactivity is needed.