Serksa
All Concepts
Frontend Architecture

Server-Side Rendering

1

What is it?

<strong>Server-Side Rendering (SSR)</strong> is when the server generates the full HTML for each page before sending it to the browser. This provides faster initial load and better SEO, but requires more server resources.

2

Think of it like...

The Restaurant Meal Analogy

SSR is like restaurant deliveryβ€”the server prepares the full meal (HTML) and delivers it ready to eat. You don't need to cook (render) anything; just consume it immediately.

🍽️

Server (Restaurant)

Prepares everything

🚚

Delivery (HTTP)

Brings ready meal

🏠

Browser (Your Home)

Just eat it

3

Visual Flow

🌐Browser

Requests Page

β†’
βš™οΈServer

Renders HTML

β†’
πŸ“„Browser

Displays Immediately

4

Where you see it

1

Browser requests page

User visits your website

2

Server fetches data

Queries database for content

3

Server renders HTML

React/Vue renders on server, not browser

4

Send complete HTML

Browser receives fully-formed page

5

Hydration

JavaScript makes the page interactive

5

Common Mistake

❌

Wrong

"SSR means no JavaScript in the browser"

βœ…

Correct

SSR <strong>still uses JavaScript for interactivity</strong>. The server renders the initial HTML, then JavaScript 'hydrates' it to make it interactive. Best of both worlds.

πŸ’‘ Real-World Example

Next.js blog with SSR:

1

Server renders blog post HTML with content

2

User sees content immediately (good for SEO)

3

JavaScript loads and makes comments/likes interactive

4

Faster perceived performance than CSR