Serksa
All Concepts
Frontend Architecture

Client-Side Rendering

1

What is it?

<strong>Client-Side Rendering (CSR)</strong> is when JavaScript in the browser builds the HTML after the page loads. The server sends a minimal HTML file and JavaScript does all the rendering, making it great for interactive apps but slower initial load.

2

Think of it like...

The IKEA Furniture Analogy

CSR is like IKEA furnitureβ€”the server sends you a flat-pack (minimal HTML + JS), and you assemble it yourself in your browser. It takes time to build, but once done, it's fully interactive.

πŸ“¦

Server (IKEA)

Sends flat-pack

πŸ”§

JavaScript (You)

Assembles furniture

🏠

Browser (Your Home)

Where it's built

3

Visual Flow

🌐Browser

Requests Page

β†’
πŸ“„Server

Sends HTML + JS

β†’
βš™οΈJavaScript

Renders Content

4

Where you see it

1

Browser requests page

User visits your website

2

Server sends minimal HTML

Just a shell with <div id='root'> and JS files

3

Browser downloads JavaScript

React, Vue, or other framework code

4

JavaScript executes

Fetches data from API and builds the UI

5

Page becomes interactive

User can now interact with the app

5

Common Mistake

❌

Wrong

"CSR is always slower than SSR"

βœ…

Correct

CSR has <strong>slower initial load but faster navigation</strong>. After the first load, navigating between pages is instant because everything is already in the browser.

πŸ’‘ Real-World Example

Gmail using CSR:

1

Initial load takes a moment (downloading JS)

2

Once loaded, switching between emails is instant

3

No page refreshes when reading emails

4

Feels like a desktop app, not a website