The Internet, Databases, APIs, and the Cloud: How Modern Systems Are Built
In the foundations chapter you met the machine: how it stores everything as bits, how the CPU follows instructions, how software is just very precise recipes. That gave you one computer doing one job. But the apps you actually use — your bank, a map, a streaming service, the store this very platform runs — are never one computer. They are many computers, often in different countries, talking to each other every second.
This chapter explains how those modern systems are built. We follow the data: from your finger tapping a screen, across the internet, into a database that remembers things, through APIs that let programs cooperate, and onto the cloud where most of it actually runs. By the end you will be able to trace what happens when you press "Enter" in a web browser — step by step — and you will understand the words engineers throw around (server, API, JSON, SQL, container, SaaS) well enough to follow any technical conversation.
23.1 The shape of a modern system
Almost every app you use follows the same basic shape, called the client–server model.
- Client
- The device in front of you — your phone, laptop, or web browser. It requests things.
- Server
- An always-on computer somewhere else that provides things: it does the heavy work, stores the data, and sends answers back.
This split matters because it lets one server quietly handle thousands of clients at once, and lets the client stay simple. Your phone doesn't store every product in an online shop — it just asks the server, "what products do you have?" and shows whatever comes back.
CLIENT SERVER
(your phone) (always-on computer)
| |
| ---- "show me products" --->|
| | (looks in database)
| <--- list of products ------|
| |
shows them waits for
on screen the next request
Now we need to explain how that request actually travels from your phone to a server that might be 8,000 km away — and back — in a fraction of a second. That is the internet.
23.2 How the internet actually works
A network is just computers connected so they can share data. The internet is the global "network of networks" — millions of local networks linked together.
Every device needs an address: the IP address
For data to find the right computer, every device on a network has a unique numeric address called an IP address (Internet Protocol address) — for example 142.250.72.14.
The old format (IPv4) has about 4 billion addresses, and the world ran out of them — so a much larger newer format (IPv6) exists to give every device its own address.
Humans use names, not numbers: DNS
You don't type 142.250.72.14; you type google.com. Something has to translate the human name into the numeric address. That something is DNS (the Domain Name System).
Data travels in packets
When you send something over the internet, it is not sent as one big lump. It is chopped into small labeled chunks called packets. Each packet finds its own way across the network, and they are reassembled in the correct order at the destination.
The rule set: TCP/IP
For all of this to work, every computer must agree on the same rules. That shared rule set is TCP/IP, and it has two main jobs:
- IP handles addressing and routing — getting each packet pointed toward the right destination (like the postal system's addresses and sorting hubs).
- TCP guarantees reliability — it confirms every packet arrived, in the right order, and re-sends any that got lost (like certified mail with delivery confirmation).
There is a faster, looser cousin called UDP that sends packets without tracking or re-sending — like dropping postcards in a mailbox and hoping they arrive. It's used for live video calls and online games, where a single missed frame doesn't matter and waiting for a re-send would cause worse lag.
The web's language: HTTP and HTTPS
HTTP (HyperText Transfer Protocol) is the language browsers and web servers use to ask for and send pages and data. HTTPS is the same thing, but encrypted — the padlock you see in the address bar.
Putting it together: the request lifecycle
This is the single most useful thing to understand in this chapter. Here is exactly what happens when you type a web address and hit Enter:
- You type the URL (e.g.
shop.example.com). - DNS lookup: your browser asks DNS, "what's the IP address for that name?" and gets back a number.
- TCP connection: your browser and the server do a quick "three-way handshake" (a hello, a hello-back, and a confirm) to open a reliable connection.
- HTTPS encryption setup: the two sides agree on a secret key so the conversation is private.
- HTTP request: your browser sends "GET me the home page."
- Server responds with the page's ingredients: HTML (the content), CSS (the styling), and JavaScript (the interactive behavior).
- Browser renders all of that into the page you see.
23.3 Databases: how systems remember
A server can send you a page — but where does it get the data? When a shop "remembers" your past orders, or your bank knows your balance, that information lives in a database.
- Database
- An organized system for storing, retrieving, and updating large amounts of data reliably — and letting many people use it at once without overwriting each other.
Two big families: SQL and NoSQL
| SQL (relational) | NoSQL |
|---|---|
| Data lives in linked tables of rows and columns. | Data lives in flexible documents or key–value pairs. |
| Strict structure: every row has the same columns. | Flexible: each record can hold different fields. |
| Best when data is structured and relationships matter (orders linked to customers). | Best when data is varied or changing shape rapidly. |
| Like: a strict accounting ledger with fixed columns. | Like: a box of index cards, each can say something different. |
"SQL" (Structured Query Language) is also the name of the language you use to talk to relational databases. The whole relational idea comes from Edgar F. Codd, who invented the model in 1970.
Querying
A query is simply a request to the database to fetch or change specific data.
One advanced idea worth naming: in big systems spread across many machines, the CAP theorem says a distributed database can fully guarantee only two of three things at once — Consistency (everyone sees the same data), Availability (it always answers), and Partition-tolerance (it keeps working even if the network between machines breaks). Engineers must choose which to favor. You don't need the math — just know the trade-off exists.
customers, products, and orders. When you place an order, a row is added to orders that links to your row in customers and the product rows you bought. That linking is what "relational" means — and it's how the system later answers "what did this customer buy last month?"23.4 APIs: how programs talk to each other
So far one client talks to one server, and that server reads one database. But modern products are rarely built from scratch. "Log in with Google," an embedded map, a Stripe payment box, live shipping rates — each is another company's software being used through a doorway called an API.
- API (Application Programming Interface)
- A defined, agreed-upon way for one program to request services or data from another.
This is arguably the most important integration concept in modern software. Most apps you use are assemblies of other companies' APIs stitched together.
REST and JSON: the common style and format
Most web APIs follow a style called REST, which uses predictable web addresses for each kind of data (e.g. asking /orders/123 to get order number 123). The data itself is usually sent as JSON — a human-readable text format.
A JSON response for one product:
{
"name": "Business Cards",
"price": 19.99,
"in_stock": true
}
{"price": 6.50, "days": 3}. The store never knows the shipper's internal systems — it just uses the menu. That is how a small team can offer payments, maps, login, email, and shipping without building any of them.23.5 The cloud: renting computers instead of owning them
All these servers and databases run on real, physical machines. Twenty years ago, you bought those machines and kept them in a room with loud fans and cold air. Today most companies rent them over the internet. That is the cloud.
- The cloud
- Renting computing power, storage, and software over the internet from a provider (like Amazon Web Services, Google Cloud, or Microsoft Azure) instead of owning the hardware yourself.
What makes the cloud possible: virtualization and containers
Virtualization uses software to split one powerful physical computer into several independent "virtual" computers (virtual machines), each acting like its own separate machine.
A lighter, more modern version is the container (the best-known tool is Docker). A container packages an app together with everything it needs to run, so it behaves identically on any machine. Managing thousands of containers automatically is done by orchestration (the best-known tool is Kubernetes).
The three service levels: IaaS, PaaS, SaaS
Cloud services differ by how much the provider manages for you. The classic way to teach this is "pizza as a service":
| Level | You manage | Pizza analogy | Example |
|---|---|---|---|
| IaaS (Infrastructure) | The operating system and your apps; they give you raw servers, storage, network. | They give you the kitchen; you make the pizza. | AWS EC2 |
| PaaS (Platform) | Just your app's code; they handle the servers and platform. | They give you the kitchen plus dough and oven; you add toppings. | Heroku, Google App Engine |
| SaaS (Software) | Nothing technical — you just use the finished app in a browser. | Pizza delivered; you just eat. | Gmail, Salesforce |
Serverless: pay only when something runs
A newer model is serverless (also called Functions-as-a-Service, e.g. AWS Lambda). You upload a piece of code; it runs only when something triggers it; the provider handles all the servers and scaling; and you pay per execution — nothing while it sits idle.
Handling lots of users: scaling and load balancing
Scalability is the ability to handle more users by adding capacity. A load balancer spreads incoming traffic across many servers so no single one is overwhelmed. Adding capacity comes in two flavors:
- Vertical scaling — a bigger, more powerful single machine.
- Horizontal scaling — more machines working together (usually preferred at scale).
23.6 A worked end-to-end example
Let's connect everything. You open an online print shop on your phone and view a product. Here is the full journey, top to bottom:
1. You tap the link → DNS turns "shop.com" into an IP address 2. Phone opens a reliable TCP+HTTPS connection to the server 3. Phone sends HTTP request: "GET the product page" 4. Server runs its code (backend logic) 5. Server QUERIES the database: "fetch product #123" 6. Server may call an external API (e.g. shipping price) 7. Server packages it all as JSON / HTML and sends it back 8. Your browser RENDERS the page; you see the product — and the server, database, and APIs all run in the CLOUD
Every layer here is an abstraction hiding the one below: you don't think about packets, the website doesn't think about disk platters, the cloud customer doesn't think about which physical machine they're on. That stacking of hidden complexity is what lets a small team build something enormous.
23.7 Best practices for understanding (and building) modern systems
23.8 Chapter summary
Modern systems are not one clever computer. They are layers of cooperating machines, each hiding complexity from the one above:
- Client–server: your device asks; an always-on server answers.
- The internet: data is addressed (IP), named for humans (DNS), chopped into packets, and delivered reliably (TCP/IP) using the web's language (HTTP/HTTPS).
- Databases are how systems remember — organized, multi-user, reliable stores, queried for exactly what's needed.
- APIs are the menus that let programs use each other's services, usually exchanging plain-text JSON. They run the modern software economy.
- The cloud is renting real computers over the internet — split up by virtualization and containers, offered as IaaS/PaaS/SaaS or serverless, and scaled with load balancers.