How programs exchange data without ever meeting in person.
Fundamentals 14 min Beginner April 13, 2026
Every time you open a website, your computer sends a precisely formatted letter to another computer that might be sitting in a data center thousands of kilometers away — and gets a reply in under a second. How does your browser know where to send that letter? And how does the response find its way back?
The answer lies in three ideas that power every app, every cloud service, and every AI chatbot. By the end of this article, you will understand what happens between pressing Enter and seeing a web page — and why the exact same mechanism also powers AI services.
Client and Server: The Restaurant Model
Client, Server, and HTTP
AnalogyDefinition
Imagine a restaurant: you (the client) order from the menu, the waiter (the network) carries the order to the kitchen (the server), and the kitchen prepares a dish and sends it back via the waiter. Client and server are not specific devices — they are roles. Your smartphone is a client when it loads a web page, but it could also act as a server.
Analogy:
Imagine a restaurant: you (the client) order from the menu, the waiter (the network) carries the order to the kitchen (the server), and the kitchen prepares a dish and sends it back via the waiter. Client and server are not specific devices — they are roles. Your smartphone is a client when it loads a web page, but it could also act as a server.
Definition:
In the client-server model, the client initiates a request, and the server processes it and sends back a response. The web uses HTTP (Hypertext Transfer Protocol) as its communication protocol. An HTTP request contains a method (GET, POST, etc.), a URL, and optionally data. The response contains a status code (200, 404, 500) and the requested data.
Where the restaurant analogy breaks: a web server handles thousands of clients simultaneously — no physical restaurant can do that. A server can itself become a client when it fetches data from other servers (microservices). And the network is unreliable: data packets can be lost, delayed, or arrive out of order — a human waiter rarely drops the plate.
What happens when you type google.com?
1
DNS resolution: your browser asks for the IP address of google.com (~50 ms)
2
TCP connection: browser and server establish a reliable connection (~30 ms handshake)
3
HTTP request: the browser sends a GET request to the server
4
Server processing: Google's server generates the response page (~200 ms)
5
HTTP response: the server sends back HTML, CSS, and JavaScript
6
Rendering: the browser assembles the page and displays it — all in under 500 ms
Common Misconception: Internet = Web
The internet and the web are not the same thing. The internet is the global network infrastructure — cables, routers, protocols. The web (World Wide Web) is just one of many applications running on the internet, alongside email, file transfer (FTP), streaming, and much more.
Addresses: IP and DNS
IP Address, DNS, and Port
AnalogyDefinition
DNS works like a chain of phone books. Instead of one giant directory, there is a tree: the root directory knows which regional directory to ask (.com, .de), the regional directory points to the company directory (google.com), and the company directory has the actual extension number (IP address).
Analogy:
DNS works like a chain of phone books. Instead of one giant directory, there is a tree: the root directory knows which regional directory to ask (.com, .de), the regional directory points to the company directory (google.com), and the company directory has the actual extension number (IP address).
Definition:
Every internet-connected device has a numeric IP address. IPv4 uses 32-bit addresses (about 4.3 billion total, written as four numbers like 192.168.0.1). IPv6 extends this to 128 bits for a practically unlimited supply. DNS (Domain Name System) is a distributed, hierarchical system that translates human-readable domain names into IP addresses. Ports (0-65535) identify specific services on a single device.
4.3 B
IPv4 Addresses Sounds like a lot — but not enough for every device on Earth
~50 ms
DNS Lookup Time for a full name resolution without cache
443
HTTPS Port The standard port for encrypted websites
Think of DNS as a phone book chain: your browser first checks its local cache, then asks your internet provider, which asks a root server, which points to the .com server, which knows the IP address of google.com. The result is cached so the next lookup is faster.
Where the analogy breaks: real phone books are static publications updated yearly. DNS records can change within minutes (controlled via Time-to-Live, or TTL). Also, DNS queries are active network requests to live servers — not passive lookups in a printed book.
DNS Resolution: Step by Step
1
Browser checks the local DNS cache — maybe this site was visited before
2
If not cached: request goes to the ISP's recursive resolver
3
The resolver asks a root server: who handles .com?
4
The .com TLD server responds: Google uses these nameservers
5
Google's authoritative nameserver returns the IP address (e.g., 142.250.x.x)
6
The resolver caches the result with TTL and forwards it to the browser
Ports are like extension numbers in a phone system: the IP address is the building's main number, the port is the extension to the right desk. Port 80 is HTTP, port 443 is HTTPS (encrypted), port 22 is SSH (secure remote access). A server can offer many services simultaneously — each listens on a different port.
Common Misconception: My IP address identifies me personally
Most home internet connections have a dynamic IP address that changes regularly. Additionally, many devices often share a single public IP address (via NAT). Your IP address is neither permanent nor personally identifiable — it is more like the current phone number of a hotel room.
APIs: The Menu for Machines
API, REST, and JSON
AnalogyDefinition
An API is like a standardized menu at a restaurant counter. The menu lists exactly what you can order (endpoints), what options are available (parameters), and what you will receive (response format). As long as you follow the ordering protocol, you get your result — regardless of whether you are a web app, a mobile app, or a server process.
Analogy:
An API is like a standardized menu at a restaurant counter. The menu lists exactly what you can order (endpoints), what options are available (parameters), and what you will receive (response format). As long as you follow the ordering protocol, you get your result — regardless of whether you are a web app, a mobile app, or a server process.
Definition:
An API (Application Programming Interface) is a defined interface that lets one program use functions of another program without knowing its internal implementation. Web APIs (especially REST APIs) use HTTP as transport and JSON as data format. Unlike websites that return HTML for browsers to render, APIs return structured data (JSON) for programs to process.
Where the menu analogy breaks: API responses can be deeply nested data structures with hundreds of fields — far more complex than a single dish. APIs often require authentication (API keys, tokens) — no restaurant demands an ID check before ordering. And APIs enforce rate limits (e.g., 100 requests per minute) — a concept with no dining equivalent.
Website (Browser)
The server delivers HTML code with colors, images, and layout. The browser renders the visible page. Optimized for human eyes.
API (Program)
The server delivers structured JSON data: {"temp": 18, "condition": "cloudy"}. A program processes the data further. Optimized for machines.
A concrete example: a weather API call looks like this: GET https://api.example-weather.com/current?city=Berlin with an API key in the header. The response comes as JSON: {"temp": 18, "unit": "celsius", "condition": "cloudy"}. No colors, no images — just the raw data that any program can process.
Here is the exciting part: an AI API call follows the exact same pattern. Instead of a city, you send a prompt: POST https://api.example-ai.com/chat with {"prompt": "What is DNS?"} — and the response comes as {"response": "DNS stands for..."}. Same HTTP, same JSON, different kitchen: instead of a database, a neural network processes the request.
Common Misconception: APIs are only for programmers
Every app on your smartphone uses APIs behind the scenes, even if you never see them. The weather widget calls a weather API, the transit app queries a transportation API, and chat notifications arrive via a messaging API. APIs are the invisible infrastructure on which most digital services are built.
HTTP Methods and Status Codes
HTTP speaks a small vocabulary: GET means 'read something', POST means 'send/create something', PUT means 'replace something', DELETE means 'remove something'. These four cover the fundamental operations (read, create, update, delete).
Status codes are the server's short answers: 2xx means success (200 OK = all good), 4xx means 'you made a mistake' (404 Not Found = page does not exist, 403 Forbidden = no access), 5xx means 'the server has a problem' (500 Internal Server Error). Next time you see '404', you will know exactly what that number means.
From Weather APIs to AI APIs: Same Pattern, Different Kitchen
A weather API works like this: the client sends a city name, the server queries its database, and returns the temperature as JSON. An AI API works identically: the client sends a prompt text, the server runs a neural network, and returns the generated text as JSON.
The HTTP layer is identical in both cases — only the server-side processing differs. Whether it is a database query or a neural network: to your code, it looks the same. You will encounter this pattern again and again in later articles when you fetch models from Hugging Face or use AI tools via their APIs.
Interactive: The Journey of an HTTP Request
HTTP Request: From Browser to Server
Click "Play" and follow step by step what happens when your browser calls an API — from entering the URL to receiving the JSON response.
Step 0 of 6
Start animation
Click "Play" to see the RAG pipeline step by step.
Why does this matter?
Every website, every app, and every AI application uses HTTP requests in the background. Once you understand how a request is structured and what steps it goes through, you can use APIs deliberately, find errors more quickly, and understand how modern software communicates.
Key Takeaways
The internet follows a simple pattern: a client sends a request, a server sends back a response — this is true for websites, weather apps, and AI chatbots alike.
DNS is the internet's phone book: it translates human-readable names like google.com into numeric IP addresses that routers use to deliver data packets.
An API is a standardized interface that lets programs talk to other programs. Every app on your phone uses APIs behind the scenes.
JSON is the universal packaging format for API data: structured, human-readable, and understood by every programming language.
The cloud is not a mystical place — it is data centers full of servers that expose APIs, following the same client-server principles as any website.
Quiz: Internet & APIs
Question 1 / 4
Not completed
What is the role of DNS on the internet?
1. What is the role of DNS on the internet?
☐ A) DNS encrypts data while browsing
☐ B) DNS translates domain names into IP addresses
☐ C) DNS stores websites on the server
☐ D) DNS protects against viruses
2. You type google.com in the browser but get the error message "DNS resolution failed." What does this mean?
☐ A) Google's server has crashed
☐ B) Your browser could not translate google.com into an IP address
☐ C) The website has been deleted
☐ D) Your internet speed is too slow
3. A weather app shows the current temperature for Berlin. What is most likely happening behind the scenes?
☐ A) The app has all weather data stored locally
☐ B) The app opens google.com and reads the temperature
☐ C) The app sends an API request and receives JSON data with the temperature
☐ D) The app takes a screenshot of a weather website
4. Both websites and APIs use HTTP. What is the key difference?
☐ A) APIs are faster than websites
☐ B) Websites use GET, APIs use POST
☐ C) Websites return HTML for browsers, APIs return structured JSON data for programs
☐ D) APIs can only be accessed by smartphones
Answer Key: 1) B · 2) B · 3) C · 4) C
Comprehension Check
You type google.com, but the page does not load. A friend asks: "What does the browser actually do before it can show the page?" Explain the steps.
Someone says: "DNS is like a phone book." Explain why this analogy works in principle — and where it breaks down.
Your weather widget shows the temperature for Berlin. A friend asks: "Where does the app get the data?" Explain the difference compared to a regular website.