Javascript
Hands-on JavaScript projects and guides for building interactive websites.
If you are learning web development, you will often hear three terms:
SSR (Server-Side Rendering)
CSR (Client-Side Rendering)
SSG (Static Site Generation)
They may sound technical, but the idea behind them is very simple.
At the core, all three answer one question:
Where and when is your webpage HTML created?
Let’s understand this step-by-step in the simplest possible way.
When you open a website:
You type a URL.
The browser sends a request to a server.
The server sends back HTML.
The browser shows the page.
Now the difference between SSR, CSR, and SSG is:
👉 Who creates that HTML?
👉 When is it created?
Popular in:
React
Vue.js
In CSR, the browser builds the webpage using JavaScript.
The server sends a very basic HTML file, and JavaScript fills in everything after the page loads.
Imagine ordering furniture online.
Instead of sending you a ready-made chair, the company sends:
Wood pieces
Screws
Tools
And says: “Assemble it yourself.”
That’s CSR.
Browser requests page.
Server sends minimal HTML.
JavaScript loads.
JavaScript builds the UI in the browser.
Example:
<div id="root"></div>
<script src="app.js"></script>
The <div> is empty. JavaScript fills it.
Very interactive
Great for dashboards and web apps
Smooth navigation after first load
First load can feel slow
SEO can be weaker
User may see blank screen briefly
Admin panels
SaaS applications
Apps where SEO is not important
Common in:
Next.js
Nuxt.js
In SSR, the server builds the full HTML page before sending it to the browser.
The browser receives a fully ready webpage.
You order food.
The kitchen cooks everything.
You receive a fully prepared dish.
That’s SSR.
User requests page.
Server runs code.
Server generates complete HTML.
Browser shows content immediately.
Example (simplified):
res.render("blog", { posts: data });
The server builds the page and sends it ready.
Faster first load
Excellent SEO
Search engines easily read content
More server work
Higher hosting cost
Slightly slower navigation between pages
Blogs
E-commerce websites
News sites
SEO-focused websites
Used in:
Next.js
Gatsby
In SSG, pages are created before users even visit the website.
All pages are generated at build time and saved as static HTML files.
Instead of cooking when someone orders,
you cook 500 meals in advance and keep them ready.
When someone arrives, you serve instantly.
That’s SSG.
During deployment (build time),
All pages are generated.
Stored as static files.
When user visits → instant response.
If you have 100 blog posts, 100 HTML files are created beforehand.
Extremely fast
Cheap hosting
Excellent SEO
Highly scalable
Not good for frequently changing data
Need rebuild when content updates
Blogs
Documentation sites
Portfolio websites
Marketing pages
Feature | CSR | SSR | SSG |
|---|---|---|---|
HTML Created Where? | Browser | Server | Build time |
First Load Speed | Medium/Slow | Fast | Very Fast |
SEO | Moderate | Excellent | Excellent |
Server Load | Low | High | Very Low |
Best For | Apps | Dynamic content | Static content |
Let’s say you build three projects:
Users log in and manage data.
👉 Use CSR
Products change often. SEO important.
👉 Use SSR
Content updates once a week.
👉 Use SSG
Modern frameworks like Next.js allow mixing:
Homepage → SSG
Product page → SSR
Dashboard → CSR
This hybrid model is common in modern web development.
CSR → Browser builds the page
SSR → Server builds the page
SSG → Page is built before users visit
There is no “best” rendering method.
The right choice depends on:
Do you need SEO?
How often does content change?
Is it an application or a content website?
What is your hosting budget?
Understanding these three concepts helps you design faster, smarter, and more scalable web applications.
Once you grasp where and when HTML is generated, SSR, CSR, and SSG become very easy to understand.
Comments