The SSR Request-Response Cycle
You'll learn: How a browser request travels through server-side rendering to deliver fully-formed HTML back to the user.
How SSR Handles a Request
When a user visits an SSR website, the journey is fundamentally different from CSR. Instead of sending a skeleton HTML file with JavaScript that builds the page, the server does the heavy lifting upfront.
Here's the step-by-step flow:
1. Browser Sends Request
The user types a URL or clicks a link. The browser sends an HTTP request to the server, just like any web request.
2. Server Executes Application Code
Here's where SSR differs: the server runs your JavaScript framework code (React, Vue, etc.) on the server itself. It fetches data from databases or APIs, processes logic, and generates the complete HTML for that specific page.
3. Server Responds with Full HTML
The server sends back a fully-rendered HTML document with all content visible. The browser can immediately display this to the user—no JavaScript execution needed yet.
4. HTML Displays Instantly
The user sees meaningful content right away. Search engine crawlers also see this content, which is why SSR is excellent for SEO.
5. Hydration Phase
After the HTML displays, the browser downloads and executes JavaScript that "hydrates" the page—attaching event listeners and making it interactive. The static HTML becomes a dynamic application.
The Key Difference
Think of SSR like ordering a fully-assembled bookshelf delivered to your door (ready to use immediately), versus CSR which delivers flat-pack furniture you must assemble yourself before use.
The trade-off: the server does more work per request, but users see content faster, especially on slower devices or connections.
Key Takeaway: The SSR request-response cycle moves rendering work from the client to the server, delivering complete HTML immediately, followed by a hydration step that makes the page interactive.