PerformanceArchitecture
CRP
Browser Rendering
Generated: Calculating...

Browser Rendering Pipeline

Understanding how a request transforms from a string of bytes into a fully interactive user interface. This is the 'Secret Sauce' of high-performance web engineering.

Environment
Vercel Serverless
Verification Lab

Time is frozen at Build Time. No matter how many times you refresh, this HTML is static.

Strategy

The Critical Rendering Path (CRP) is the sequence of steps the browser goes through to convert HTML, CSS, and JS into pixels on the screen.

Hydration

Server sends finished HTML. Browser 'hydrates' it for interactivity.

Inspect Network

Open DevTools > Network. Look forCache-Controlheader. For CRP, you will sees-maxage=31536000

1,200+
DOM Nodes
~14ms
Layout Time
Instant
Hydration
HTTP/3
Network

The Network Phase

Before the browser can parse code, it must first navigate the wires. Here is the journey of a request.

Phase 0: Pre-Parsing

Network & Navigation

What happens before the browser sees a single character of code.

Step 1

DNS Lookup

Step 2

TCP Handshake

Step 3

TLS Negotiation

Step 4

HTTP Request

Step 5

TTFB / Stream

Protocol Detail: DNS Lookup

Hostname to IP Resolution

The browser resolves the human-readable domain (lab.badrigaire.com.np) to an IP address. It checks local cache, ISP resolvers, and root nameservers to find the A/AAAA records.

Browser CacheMISS
OS ResolverSEARCHING...
76.76.21.21(Vercel Edge)

The Visual Journey

Click through the stages of the Critical Rendering Path to see how the browser builds this very page.

Critical Rendering Path

How the browser turns pixels into code.

Step 1

DOM Creation

Step 2

CSSOM

Step 3

Render Tree

Step 4

Layout (Reflow)

Step 5

Paint

Step 6

Composite

Deep Dive: DOM Creation

Browser parses HTML tokens into a tree of objects.

The Document Object Model (DOM) is a programming interface for web documents. It represents the page so that programs can change the document structure, style, and content.

<html>
  <body>
    <h1>Hello World</h1>
    <p>Parsing HTML...</p>
  </body>
</html>

The Ownership Matrix

Modern web apps are a symphony between the Browser Engine (Native C++) and the Frontend Framework (JavaScript/React).

Browser Engine

Blink (Chrome/Edge)WebKit (Safari)Gecko (Firefox)

Native code (C++) optimized for hardware performance.

Network Fetching

Fetching HTML/CSS/JS over HTTP/2 or 3.

HTML Parsing

Native DOM tree construction (C++ level).

CSSOM & Styling

Calculating CSS inheritance and specificity.

Layout Engine

Blink/WebKit calculating geometry.

Painting & GPU

Rasterizing pixels and GPU compositing.

Framework Layer

React (Next.js)Vue (Nuxt)Svelte (SvelteKit)

High-level JavaScript abstraction for Developer Experience.

Virtual DOM

In-memory representation of UI for diffing.

Reconciliation

Deciding exactly what changed in the state.

Hydration

Attaching JS event listeners to static HTML.

State Logic

Managing app data and side effects (Hooks).

Client Routing

Intercepting links to prevent full reloads.

The Bridge: Hydration

Hydration is the critical moment where the Framework takes over the Browser's static DOM. It doesn't recreate the DOM from scratch—it walks the existing DOM and "attaches" event listeners, making the page interactive without a re-paint.

Static Native DOM
Hydrated Interactive UI

SPA vs MPA: The Lifecycle

Understanding what happens to your Navbar and CSS when you click a link.

Classic

Multi-Page App (MPA)

Browser requests a new page, server sends full HTML. Browser trashes everything and starts the pipeline from scratch.

Nav Lifecycle
REQ
HTML
DOM
CSSOM
PAINT
Pros: Zero JS required
Cons: White screen flash
Client-Rich

Single-Page App (SPA)

Initial load is slow, but navigations are instant. Browser handles everything via JavaScript without full reload.

Nav Lifecycle
REQ
JS
JSON
DOM
PAINT
Pros: No fresh reload
Cons: Slow initial paint
Modern

Next.js Hybrid (RSC)

Initial load is SSR (fast). Navigations are client-side updates that preserve Layout/Navbar state.

Nav Lifecycle
REQ
SSR
HYDRATE
RSC-UP
Pros: Fastest TTFB
Cons: Complex logic
Navbar Persists!

Deep Technical Details

Parsing strategies and memory management for modern applications.

CSS Pipeline Impact

How the browser handles styles during the critical path.

Inline Styles

Blocking

Increases HTML size, no reusability, but zero network fetch.

Internal (Style Tag)

Blocking

Browser must parse full block before painting.

External (Link Tag)

Render Blocking

Standard fetch behavior. The browser halts painting until the file is fully downloaded.

The Caching Hierarchy

Who remembers your code? Server, CDN, or Browser?

HTTP Cache
Browser Memory

Browsers store External CSS and JS bundles locally. Next.js uses hashes (e.g. main-x123.css) to ensure users always have the latest code while maximizing cache hits.

Hydration Cache
React State

React keeps the DOM structure in memory. When navigating between pages in Next.js, the Navbar is never unmounted, so it doesn't re-calculate layout.

BFCache
Back/Forward

The Back/Forward Cache saves a snapshot of the entire page (including JS state) for instant navigation.