What is Server-Side Rendering (SSR)?
You'll learn: How SSR delivers fully-formed HTML pages from the server, contrasting with client-side rendering approaches.
The Core Idea
Server-Side Rendering (SSR) is an approach where your web server generates the complete HTML content of a page before sending it to the browser. Instead of shipping a minimal HTML shell and letting JavaScript build the page (like CSR), the server does the heavy lifting upfront.
Think of it like ordering a meal: with CSR, you receive ingredients and a recipe to cook at home. With SSR, you receive a fully-prepared dish ready to eat immediately.
How SSR Works
When a user requests a page:
- The server receives the request
- The server executes your application code (often JavaScript/Node.js)
- The server generates complete HTML with all content populated
- The server sends this full HTML document to the browser
- The browser displays the page immediately
- JavaScript downloads and "hydrates" the page, making it interactive
The browser receives meaningful HTML right away—not just a <div id="root"></div> waiting for JavaScript to render content.
Why SSR Matters
SSR addresses some key CSR challenges:
- Faster initial content display: Users see content before JavaScript executes
- Better SEO: Search engines receive fully-formed HTML to index
- Improved perceived performance: Content appears faster, even if full interactivity takes time
- Works without JavaScript: Basic content displays even if JavaScript fails
The tradeoff is server complexity—your server must run application logic for every request, rather than serving static files.
Key Takeaway: SSR generates complete HTML pages on the server before sending them to browsers, providing faster initial content display and better SEO compared to client-side rendering approaches.