We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
System Design Masterclass · Web Content Delivery
Free preview: the first 2 parts of this 8-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Web Content Delivery
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
Open Gmail. Click on an email. Notice how the page does not reload. Click back. Instant. Compose a new email. The compose window slides up without any flash of white. Switch between Inbox, Sent, and Drafts. No full-page reload, ever.
Gmail is a single-page application (SPA) powered by client-side rendering. The browser downloads a JavaScript bundle once, and from that point forward, every navigation and interaction happens by manipulating the DOM directly in the browser. The server never sends another full HTML page.
This is client-side rendering: the server ships an empty HTML shell and a JavaScript bundle. The browser executes the JS, fetches data from APIs, and builds the entire UI in the browser. The first load is slow (the bundle must download and execute), but every interaction after that is instantaneous because there is no round-trip to the server.
When you visit a CSR app, here is what happens step by step:
<div id="root"></div> and a <script> tag.fetch('/api/users'), fetch('/api/products'). Each one is another network round-trip.The problem is obvious: steps 2 through 5 all happen sequentially. The user stares at a blank white screen (or a spinner) until the JS downloads, parses, executes, fetches data, and renders. Google measures this as Time to First Contentful Paint (FCP). For a typical CSR app, FCP is 2-5 seconds on mobile. For server-rendered pages, it is under 1 second.
Bundle size is the bottleneck. Every npm package you import ends up in the bundle. A React app with a charting library, a date picker, a rich text editor, and an animation library easily hits 1MB+ before gzip. Airbnb's initial React SPA had a 3MB bundle that took 10+ seconds to parse on mid-range Android phones.
It is easy and good
“It is really nice and good Please join the course”