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
It is easy and good
“It is really nice and good Please join the course”
In 2012, Twitter rebuilt their web app as a pure CSR single-page application. The result: users stared at a blank screen for 5+ seconds on every page load while the JavaScript bundle downloaded and executed. Engagement dropped. Time-to-first-tweet (their key metric) degraded badly.
Twitter reversed course and moved back to server-side rendering. The server now renders the initial HTML with the first batch of tweets already embedded. Users see content within 1 second. The JavaScript still loads in the background to add interactivity, but the critical first impression happens immediately.
Server-side rendering means the server generates the complete HTML for every request. The browser receives a fully rendered page, paints it immediately, and then "hydrates" it with JavaScript for interactivity. You get the fast first paint of a static page and the dynamic behavior of a SPA.
Here is what happens when a user visits an SSR page:
getServerSideProps. The server queries the database, calls APIs, assembles the data.renderToString() or renderToPipeableStream() in React.The key insight: steps 4 and 5 happen in parallel. The user sees content at step 4, and the JS loads concurrently. With CSR, the user sees nothing until step 5 completes.
Time to First Byte (TTFB) with SSR is higher than CSR because the server has to do work (data fetching + rendering) before responding. A typical SSR TTFB is 200-800ms depending on database queries. CSR TTFB is near-instant because the server just returns a static HTML shell. But the user-visible content appears faster with SSR despite the higher TTFB.