Introduction: The Architecture Behind the Screen
Every single day, billions of people around the globe pick up smartphones, open laptops, click links, watch videos, buy products, and search for information online. To most users, this process feels instantaneous and magical: you tap a link, and a rich interactive interface appears out of thin air.
However, behind that clean screen lies one of the most astonishing engineering achievements in human history: a distributed worldwide network of computers communicating through standardized protocols, undersea fiber-optic cables, cryptographic handshakes, and browser rendering engines.
1. What Is the Web?
The Web (short for the World Wide Web or WWW) is a global collection of digital documents, multimedia files, and web applications that are interconnected by hyperlinks and identified by URLs (Uniform Resource Locators).
Invented in 1989 by Sir Tim Berners-Lee at CERN, the Web was designed to allow scientists across universities to share research papers easily. Today, it has evolved into the primary medium for human knowledge, commerce, entertainment, and social connection.
HTML Pages
Text, headings, articles, and formatted structure that browsers read and display.
Hyperlinks
Clickable references that allow users to jump instantly from one document to another anywhere in the world.
Web Apps
Interactive software (like Figma, Gmail, Pathubs, Netflix) running directly inside browser tabs.
2. Internet vs World Wide Web
One of the most common beginner confusions is using the words "Internet" and "Web" interchangeably. They are not the same thing:
The Internet (The Roads)
The massive global network of physical hardware — undersea cables, routers, satellites, fiber optics, and data centers connecting billions of computing devices together.
The Web (The Cars & Cargo)
A software application/service that runs on top of the Internet infrastructure to serve web pages using HTTP/HTTPS.
3. How Do Websites Actually Work?
At its core, every single website on earth operates on a fundamental architecture called the Client-Server Model:
- 1. The Client (You): Makes a request for a web page by typing a URL or clicking a link.
- 2. The Network: Transmits your request across the Internet to the correct destination machine.
- 3. The Server (Host): Receives your request, finds or generates the files, and sends a response back.
- 4. The Browser: Interprets the returned response and renders it into a visual, clickable page.
4. What Happens When You Enter a URL?
When you type an address like https://pathubs.com into your browser and press Enter, your computer executes a synchronized sequence of 5 high-level milestones:
Step 1: Address Resolution
The browser finds the server's physical IP address via DNS lookup.
Step 2: Secure Connection
Browser establishes a TCP handshake and negotiates TLS encryption keys.
Step 3: Sending Request
Browser transmits an HTTP GET request asking for the webpage document.
Step 4: Server Processing & Response
Server prepares HTML, CSS, JavaScript files and streams them back.
5. Understanding the Client and Server
The web divides computing duties between two distinct roles:
📱 The Client
The end-user device and software. It is responsible for accepting user input, sending requests, and displaying graphical results. Examples: Google Chrome, iPhone Safari, Spotify desktop app.
🖥️ The Server
A powerful computer located in a secure data center that stays powered on 24 hours a day, 7 days a week. It runs specialized server software that listens for incoming client requests and serves responses.
6. What Is a Web Browser?
A Web Browser is a specialized software application that knows how to fetch web resources from the Internet, interpret code (HTML, CSS, JavaScript), and draw interactive pixels on your monitor or phone screen.
Under the hood, every modern browser contains three critical engines:
1. Rendering Engine
Parses HTML and CSS to build the visual page layout (e.g. Blink in Chrome/Edge, Gecko in Firefox, WebKit in Safari).
2. JavaScript Engine
Executes JavaScript code at blazing speeds using Just-In-Time (JIT) compilation (e.g. V8 in Chrome, SpiderMonkey in Firefox).
3. Networking Layer
Handles DNS resolution, HTTP/HTTPS requests, caching, SSL security, and data streaming.
7. What Is a Web Server?
The term Web Server refers to two related concepts:
- Hardware: A physical computer with high-performance CPU, massive RAM, and ultra-fast network connections sitting in a data center.
- Software: A background program (such as Nginx, Apache, Node.js, or Caddy) that actively listens on network ports (port 80 for HTTP, port 443 for HTTPS) for incoming client requests.
8. What Is a Website?
A Website is a collection of publicly accessible, interlinked web pages and multimedia assets (images, videos, stylesheets, scripts) that share a single domain name (e.g., pathubs.com).
9. What Is a Web Page?
A Web Page is a single document within a website, uniquely identified by a specific URL path (e.g., pathubs.com/about or pathubs.com/explore).
When you navigate from the homepage to an article, you are loading a different web page belonging to the same parent website.
10. Understanding URLs (Uniform Resource Locators)
A URL is the address used to pinpoint any unique resource across the entire World Wide Web. Just like your postal mailing address contains a country, city, street, and house number, a URL has a strict anatomy:
| URL Component | Example in URL | Purpose & Explanation |
|---|---|---|
Protocol (Scheme) | https:// | Defines the communication rule. HTTPS ensures encrypted communication. |
Subdomain | www. or api. | An optional prefix used to organize separate sub-sections of a website. |
Domain Name | pathubs | The unique registered brand or project name. |
Top-Level Domain (TLD) | .com or .org | The domain category suffix (.com, .io, .dev, .in, .edu). |
Port | :443 | The specific virtual gate on the server. (Default: 80 for HTTP, 443 for HTTPS). |
Path | /courses/web-dev | The exact file or resource route on the web server. |
Query Parameters | ?ref=google&sort=popular | Key-value data passed to the server for search, sorting, or analytics. |
Anchor / Hash | #curriculum | Jumps directly to an element with that ID on the page (handled client-side). |
11. Domain Names and IP Addresses
Computers do not understand human words like "Pathubs" or "Google" when routing network packets. They use numerical IP (Internet Protocol) Addresses:
IPv4 (32-bit standard)
Four numbers separated by dots (e.g. 142.250.190.46). Provides ~4.3 billion unique addresses.
IPv6 (128-bit modern standard)
Eight hexadecimal groups separated by colons (e.g. 2607:f8b0:4005:805::200e). Provides 340 undecillion addresses.
Because humans cannot easily remember 32-digit strings for every website, we use human-friendly Domain Names (like pathubs.com) as aliases.
12. DNS: How Domain Names Find Servers
The Domain Name System (DNS) is the worldwide distributed directory that translates human domain names into numerical IP addresses:
13. HTTP and HTTPS: The Language of the Web
HTTP (HyperText Transfer Protocol) is the communication protocol governing how messages are formatted and transmitted across the web.
HTTP (Plain Text)
Sends data in unencrypted text. Anyone snooping on your public Wi-Fi router can see your passwords, credit card numbers, and visited pages.
HTTPS (Encrypted with TLS/SSL)
Encrypts all communication end-to-end. Even if an attacker intercepts the data packets, they only see scrambled, unreadable cryptographic noise.
14. How a Browser Requests a Web Page
Once the IP address is known, the browser initiates a TCP 3-Way Handshake to ensure a reliable two-way connection:
- SYN (Synchronize): Browser sends: "Hello server, I want to connect."
- SYN-ACK: Server replies: "Hello client, I hear you! Let's connect."
- ACK (Acknowledge): Browser confirms: "Awesome, connection established!"
Immediately after TCP, the TLS Handshake runs to negotiate cryptographic encryption keys.
15. How a Server Responds
Upon receiving the HTTP request, the web server reads the headers, validates authentication cookies, runs application business logic, and prepares an HTTP Response.
The server packages the requested HTML content into data packets and transmits them back across the network to your IP address.
16. HTTP Request and Response Anatomy
Both HTTP Requests and HTTP Responses have a clear, standardized text structure:
📤 HTTP Request (From Client)
Host: pathubs.com
User-Agent: Chrome/122.0
Accept: text/html
Authorization: Bearer token123
📥 HTTP Response (From Server)
Content-Type: text/html
Cache-Control: max-age=3600
<!DOCTYPE html><html>...</html>
17. Understanding HTTP Methods (Verbs)
HTTP methods tell the server what action you want to perform:
| Method | Action Type | Safe & Idempotent? | Real-World Example |
|---|---|---|---|
GET | Read / Retrieve data | ✅ Safe (Read-only) | Viewing a blog post or opening a profile page. |
POST | Create new data | ❌ Not Idempotent | Submitting a registration form, placing an e-commerce order. |
PUT | Replace existing data completely | ✅ Idempotent | Uploading a brand-new avatar to overwrite the old one. |
PATCH | Partially update data | ❌ Modifies fields | Changing just your username without re-submitting your entire profile. |
DELETE | Remove data | ✅ Idempotent | Deleting a comment or removing an item from your cart. |
18. HTTP Status Codes
The server responds with a 3-digit status code that informs the browser of the result:
200 OK / 201 Created
The request succeeded! The requested page or data is included in the response body.
301 Moved / 304 Not Modified
The page has moved to a new URL, or the cached copy in your browser is still fresh.
400 Bad Request / 401 Unauthorized / 404 Not Found
The problem was on the client side (e.g. wrong URL, missing password, forbidden access).
500 Internal Error / 502 Bad Gateway / 503 Unavailable
The server crashed, encountered a bug, or is overloaded with too much traffic.
The 10-Step Journey of a Web Request
Click any step below or press Auto-Play Journey to trace how your computer fetches, decrypts, processes, and renders a web page in milliseconds.
⌨️1. User Enters URL
Client StageYou type "https://pathubs.com/explore" into your browser address bar and hit Enter.
The browser first breaks down the URL string into its core components: protocol (https), domain name (pathubs.com), and resource path (/explore). It checks its own internal browser cache to see if you have visited this page recently.
INPUT: "https://pathubs.com/explore" PROTOCOL: HTTPS (Port 443) TARGET HOST: pathubs.com PATH: /explore
19. What Happens Inside the Browser? The Critical Rendering Path
Once HTML bytes arrive in the browser, the Critical Rendering Path (CRP) begins:
- 1. DOM Construction: HTML tokens are converted into Document Object Model nodes.
- 2. CSSOM Construction: CSS stylesheets are parsed into the CSS Object Model.
- 3. Render Tree: DOM and CSSOM combine to identify only the visible elements.
- 4. Layout (Reflow): The browser computes exact pixel geometry (width, height, coordinates).
- 5. Paint (Rasterization): Pixels are filled with actual text, colors, shadows, and images.
- 6. Compositing: Layers are drawn onto the screen via GPU hardware acceleration.
20. HTML, CSS and JavaScript: The Holy Trinity
HTML
Provides raw structure, content, headings, paragraphs, forms, and semantic meaning.
CSS
Controls typography, vibrant colors, flexbox/grid layouts, dark mode, and smooth animations.
JavaScript
Adds logic, handles button clicks, fetches API data in real-time, and makes pages alive.
21. How HTML Becomes a Web Page
HTML (HyperText Markup Language) uses nested tags to create a hierarchy of elements. When the browser parses:
<h1>Welcome to Pathubs</h1>
<p>Learn tech roadmaps for free.</p>
</div>
It turns every tag into a node in the DOM Tree. Parent nodes contain child nodes, forming an organized in-memory model that browsers render and scripts manipulate.
22. How CSS Styles a Web Page
CSS (Cascading Style Sheets) attaches visual rules to HTML elements using selectors, properties, and values:
background: #1e1b2e;
border-radius: 16px;
color: #ffffff;
}
CSS also uses Media Queries (e.g. @media (max-width: 768px)) to reshape the layout seamlessly between desktop monitors, tablets, and smartphones.
23. How JavaScript Makes a Web Page Interactive
Without JavaScript, a webpage is a static document. JavaScript listens for user events (clicks, keypresses, scroll position) and dynamically alters the DOM:
- Opening dropdown menus and modal windows without refreshing the page.
- Validating form fields (e.g. checking if an email is valid) before submitting.
- Fetching fresh data from APIs in the background using
fetch().
24. Static vs Dynamic Websites
Static Websites
Pre-built HTML, CSS, and image files stored on a server. Every visitor receives the exact same file. Super fast, simple, and cheap to host. Examples: Documentation sites, landing pages, personal portfolios.
Dynamic Websites
Pages built on-the-fly when requested. The server executes backend code, verifies user authentication, queries databases, and customizes content for that specific user. Examples: Instagram, YouTube, Netflix.
25. Frontend vs Backend
Web development is divided into two primary disciplines:
🎨 Frontend (Client-Side)
Everything that runs inside the user's browser. Focuses on UI/UX, responsiveness, layout, animations, accessibility, and state management. Technologies: HTML, CSS, JavaScript, React, Vue, Tailwind.
⚙️ Backend (Server-Side)
Everything that runs on the web server. Handles database operations, authentication, payments, data encryption, and business logic. Technologies: Node.js, Python, Java, Go, PostgreSQL, Redis.
26. APIs and How Websites Communicate
An API (Application Programming Interface) is a standardized contract that allows two software systems to communicate. In modern web development, the frontend talks to the backend by exchanging structured JSON (JavaScript Object Notation) data:
{
"id": 42,
"name": "Sandeep",
"completedRoadmaps": ["frontend-dev", "data-analytics"],
"streakDays": 14
}
27. What Is a Database?
A Database is a specialized software system engineered to securely store, search, update, and manage persistent data (such as user passwords, orders, comments, and analytics).
28. The Complete Journey of a Web Request
Let's tie every single piece together into the ultimate 10-phase sequence:
- 1. Enter URL: User types
https://pathubs.cominto browser. - 2. DNS Lookup: Browser resolves
pathubs.cominto IP address104.21.45.12. - 3. TCP & TLS Handshake: Secure encrypted socket connection is established.
- 4. HTTP GET Request: Browser transmits request headers asking for the HTML file.
- 5. Server Processing: Backend executes business logic and queries database.
- 6. HTTP 200 Response: Server streams back HTTP response with HTML body.
- 7. Subresource Fetching: Browser parses HTML and fetches linked CSS, JS, and image assets.
- 8. DOM & CSSOM Construction: Browser builds the Document and CSS Object Models.
- 9. Layout & Paint: Browser computes geometric coordinates and draws pixels to the screen.
- 10. JavaScript Execution: Event listeners are bound and the web page becomes interactive!
29. A Real-World Example: Opening a Website
Imagine you are on a 5G smartphone in Mumbai opening Pathubs. In less than 380 milliseconds:
- 0ms – 40ms: DNS resolver in Mumbai returns Cloudflare Edge IP.
- 40ms – 110ms: TLS 1.3 handshake completes over encrypted cellular antenna.
- 110ms – 180ms: HTTP/2 GET request reaches Edge server; server returns cached HTML.
- 180ms – 290ms: Browser streams CSS bundle and fonts; renders initial page skeleton.
- 290ms – 380ms: JavaScript hydrates, button clicks activate, and you start learning!
30. Common Beginner Misconceptions
❌ "Websites are stored in the sky (the Cloud)."
Reality:The "Cloud" is just someone else's physical computer sitting in a climate-controlled data center with backup generators and fiber connections.
❌ "HTML and CSS are programming languages."
Reality: HTML is a markup language for content structure; CSS is a style sheet language for design. JavaScript is the programming language with loops, variables, and logic.
❌ "Once loaded, the website uses constant internet."
Reality: HTTP is stateless. After files are downloaded into browser memory, the connection closes until another link or API request is triggered.
❌ "Webpages are just large image files."
Reality:Webpages are live, selectable text documents and code scripts assembled in real-time by your device's GPU and CPU.
31. Key Concepts to Remember
| Term | One-Sentence Definition |
|---|---|
Client | Your device/browser requesting and rendering web resources. |
Server | A remote computer hosting website files and processing backend requests 24/7. |
IP Address | The numerical identification number of a computer on the Internet. |
DNS | The internet directory that translates domain names into numerical IP addresses. |
HTTP / HTTPS | The communication protocol of the web; HTTPS provides TLS encryption. |
DOM | The in-memory tree representation of HTML elements parsed by the browser. |
API | A communication channel allowing frontend and backend to exchange structured data. |
Database | A persistent storage engine for records, user accounts, and application data. |
How the Web Works Mastery Quiz
Test your understanding of DNS, Client-Server architecture, HTTP status codes, and browser rendering.
🌐 What is the fundamental difference between the Internet and the World Wide Web?
Conclusion & Next Steps
Congratulations! You now understand the complete anatomy of the modern web — from physical Internet cables and DNS lookups to HTTP handshakes, server processing, critical rendering paths, and database queries.
With this rock-solid mental foundation in place, you are ready to begin writing actual code! The next step in your developer journey is mastering HTML to structure your very own web pages.