0
0
Angularframework~10 mins

SSR vs CSR mental model in Angular - Visual Side-by-Side Comparison

Choose your learning style9 modes available
Concept Flow - SSR vs CSR mental model
User requests page
Server builds HTML
Send HTML to client
Browser displays page
User interacts
Server handles requests
Shows how a page request flows differently in SSR and CSR: SSR builds HTML on server, CSR builds DOM in browser.
Execution Sample
Angular
app.get('/', (req, res) => {
  const html = renderAppToString();
  res.send(html);
});

// vs client-side
bootstrapApplication(AppComponent);
Shows server rendering HTML string sent to client vs client bootstrapping Angular app in browser.
Execution Table
StepActionSSR BehaviorCSR BehaviorResult
1User requests pageServer receives requestBrowser sends requestRequest initiated
2Render pageServer runs Angular, creates HTML stringBrowser loads JS bundlePage content prepared
3Send responseServer sends full HTML to browserServer sends minimal HTML + JSBrowser receives response
4Display pageBrowser renders received HTML immediatelyBrowser runs JS, builds DOM dynamicallyPage visible to user
5User interactionBrowser sends requests to server for dataBrowser handles interactions and updates UIUI responds to user
6Further updatesServer re-renders pages on requestsClient updates UI without full reloadSmooth user experience
7ExitRequest fully handledApp fully bootstrappedPage ready and interactive
💡 Process ends when page is fully rendered and interactive in both SSR and CSR.
Variable Tracker
VariableStartAfter Step 2After Step 4Final
HTML contentemptyfull HTML string (SSR) / minimal HTML (CSR)rendered HTML visible (SSR) / DOM built (CSR)page displayed
JS bundlenot loadednot loaded (SSR) / loaded (CSR)not executed (SSR) / executed (CSR)app interactive (CSR)
User interactionnonenonepossiblehandled by server (SSR) or client (CSR)
Key Moments - 3 Insights
Why does SSR show content faster initially than CSR?
Because SSR sends fully rendered HTML from the server (see execution_table step 4), so the browser can display content immediately without waiting for JavaScript to run.
How does CSR handle user interactions differently from SSR?
CSR runs JavaScript in the browser to update the UI instantly without contacting the server for every change (execution_table step 5), while SSR relies on server requests to update pages.
What happens if JavaScript is disabled in the browser for CSR?
CSR will not render the page content because it depends on JavaScript to build the DOM (execution_table step 4), so the user may see a blank page.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step does the browser first display the full page content in SSR?
AStep 2
BStep 5
CStep 4
DStep 3
💡 Hint
Check the 'Result' column for SSR behavior at each step.
According to the variable tracker, what is the state of the JS bundle after Step 2 in SSR?
ALoaded and executed
BNot loaded
CPartially loaded
DLoaded but not executed
💡 Hint
Look at the 'JS bundle' row in variable_tracker after Step 2.
If the server sends only minimal HTML and no JS, what will happen in CSR according to the execution table?
APage remains blank
BPage displays immediately
CServer renders full page
DUser interaction handled by client
💡 Hint
Refer to execution_table step 4 CSR behavior about JS running to build DOM.
Concept Snapshot
SSR (Server Side Rendering) builds full HTML on the server and sends it to the browser.
CSR (Client Side Rendering) sends minimal HTML and runs JavaScript in the browser to build the page.
SSR shows content faster initially; CSR enables richer interactivity without full reloads.
SSR depends on server for updates; CSR handles UI updates in the browser.
Both approaches have trade-offs in speed, interactivity, and SEO.
Full Transcript
This visual execution compares Server Side Rendering (SSR) and Client Side Rendering (CSR) in Angular. When a user requests a page, SSR runs Angular on the server to create a full HTML string and sends it to the browser, which displays the page immediately. CSR sends minimal HTML and a JavaScript bundle to the browser, which then runs the JS to build the page dynamically. SSR shows content faster initially because the HTML is ready, while CSR requires JS execution before showing content. User interactions in SSR often require server requests to update the page, whereas CSR handles interactions directly in the browser for smoother updates. The variable tracker shows how HTML content and JS bundle states differ between SSR and CSR during the process. Key moments clarify why SSR is faster initially, how CSR manages interactions, and the importance of JavaScript for CSR. The quizzes test understanding of when content appears, JS loading states, and consequences of missing JS in CSR.