In plain words
With server-side rendering, a page's HTML is produced on the server at the moment a request arrives. MDN contrasts this with client-side rendering, "where the client generates the HTML content using JavaScript". Frameworks name the modes by that timing. Angular's RenderMode.Server renders "for each request", RenderMode.Prerender renders "at build time", and RenderMode.Client leaves rendering to the browser. Next.js also calls SSR "Dynamic Rendering".
In a modern framework, SSR reuses your frontend components on the server. Vue's guide describes rendering "the same components into HTML strings on the server", sending them to the browser, and then making that markup interactive on the client. Because most of the code runs in both places, Vue also calls such an app "isomorphic" or "universal". That final client-side step is hydration, a separate step that happens after SSR and on a different machine.
How it works
- A request reaches the server. Any data the page needs is fetched there first. In the Next.js Pages Router, that is
getServerSideProps, which Next.js says is "called by the server on every request". - The framework runs the component tree and turns it into HTML:
renderToStringin React and Vue, or a streaming variant such as React'srenderToPipeableStream. - In the browser, the HTML is parsed and painted. The page is visible, but nothing responds to a click yet.
- Once the JavaScript bundle loads, it hydrates the existing markup, attaching event listeners and state.
Vue's own minimal example shows step 2 with nothing else in the way. We ran it unchanged on Node 24.22.1 with vue 3.5.45:
// this runs in Node.js on the server.
import { createSSRApp } from 'vue'
// Vue's server-rendering API is exposed under `vue/server-renderer`.
import { renderToString } from 'vue/server-renderer'
const app = createSSRApp({
data: () => ({ count: 1 }),
template: `<button @click="count++">{{ count }}</button>`
})
renderToString(app).then((html) => {
console.log(html)
})It printed <button>1</button>, exactly as the guide says. The @click handler is gone from the output. The server sends markup with the count already rendered into it, and the click behavior only arrives when hydration runs in the browser.
Streaming SSR
React's docs warn that renderToString "does not support streaming or waiting for data". The recommended APIs are renderToPipeableStream on Node.js and renderToReadableStream for Deno or an edge runtime with Web Streams. They send the part of the page outside any <Suspense> boundary (React calls it the shell) right away, then stream the rest as its data arrives.
We rendered a page whose post list waits on a 500 ms promise inside a <Suspense> boundary, using renderToReadableStream on Bun 1.4.0 with React 19.3.1, and logged when each chunk left the server:
[2 ms] <main><h1>Profile</h1><!--$?--><template id="B:0"></template><p>Loading posts...</p><!--/$--></main>...
[501 ms] <div hidden id="S:0"><ul><li>First post</li></ul></div><script>$RB=[];...The heading and the fallback arrived after 2 ms; the list followed at 501 ms with an inline script that swaps it in. The same page through renderToString sent only the fallback, with React's explanation embedded in the HTML, HTML-escaped exactly as it came out: Switched to client rendering because the server rendering aborted due to: The server used "renderToString" which does not support Suspense.
Why it matters
SSR exists to get content on screen sooner. web.dev's Rendering on the Web says it "generally produces a fast FCP" (First Contentful Paint), and Vue notes that server-rendered markup "doesn't need to wait until all JavaScript has been downloaded and executed to be displayed". The initial data fetch also happens on the server, which, in Vue's words, "likely has a faster connection to your database than the client".
Search and link previews are the second reason. Google's JavaScript SEO guide describes a crawl, render and index pipeline that does run JavaScript, yet still calls server-side or pre-rendering "a great idea" because not all bots can run it. MDN is blunter about one group: social media crawlers "usually cannot" execute JavaScript, so they only see what the server sent.
The costs land on the server and on your code. web.dev warns that rendering per request "can increase your page's TTFB" (Time to First Byte). Vue lists three trade-offs: browser-only code is limited to certain lifecycle hooks, deployment needs an environment where a Node.js server can run, and rendering is "more CPU-intensive than just serving static files", so caching becomes part of the design.
SSR still ships JavaScript. With hydration, web.dev calls the result "one app for the price of two": the server returns the UI's HTML, "the source data used to compose that UI" and "a complete copy of the UI's implementation", and the UI "doesn't become interactive until after bundle.js has finished loading and executing". Islands architecture and resumability keep server rendering and cut down that second half. Astro says it "helped pioneer and popularize" islands, Qwik is built on resumability, and Qwik vs Astro weighs the two.
Browser-only code on the server
The code constraint shows up as a runtime error. A component that reads window.innerWidth during render works in the browser and fails on the server; on React 19.3.1 under Bun 1.4.0, our server render threw ReferenceError: window is not defined. Vue's guide states the rule: browser-only globals "will throw errors when executed in Node.js", so read them inside hooks that only run on the client. That means onMounted in Vue and useEffect in React, whose docs say Effects "don't run during server rendering".
To see how the JavaScript that follows server HTML affects responsiveness, read the INP optimization guide.
Common confusions
| Term | What it is | How it differs from SSR |
|---|---|---|
| Client-side rendering (CSR) | The browser builds the HTML with JavaScript. Angular's RenderMode.Client is its default. | Nothing renders on the server. MDN notes the two are not mutually exclusive and can be used in the same application. |
| Static site generation (SSG), prerendering | The same rendering, run once at build time, producing static HTML files. Angular calls it RenderMode.Prerender. | SSR renders on every request; SSG renders before any request and needs a new build when data changes. MDN loosely counts static sites as a kind of SSR, but Angular, Vue and Next.js treat them as separate modes. |
| Hydration | The client step that attaches event listeners and state to server-rendered HTML. | SSR produces the HTML; hydration makes it interactive. They run on different machines at different times. |
| Streaming SSR | SSR that sends HTML in chunks the browser renders as they arrive. | A form of SSR, not an alternative to it. React's docs say it lets the user "start seeing the content even before all the data has loaded on the server". |
| React Server Components (RSC) | Components that, per React's docs, render "ahead of time, before bundling, in an environment separate from your client app or SSR server". | SSR turns a component tree into HTML for a request. React says Server Component output can "optionally" be server-side rendered afterwards, so the two can be used together or apart. |