Skip to content
Lesson 1

What happens when you open a website

Follow one click from your screen to a server and back: six steps, what each one costs, and how each one breaks.

The lesson in text

Click a paragraph to hear it.

01One click

You type stayhub.com into your browser and press Enter. Less than a second later, a hotel page is on your screen. It feels like nothing happened. In fact, your request just travelled to a computer that may be thousands of kilometres away, and came back, several times.

In this lesson we follow that one click, step by step. There are six steps. By the end, you'll be able to name each one, say roughly how long it takes, and know which one has broken when a website doesn't work.

Why does this matter if Claude Code writes the code for you? Because when something goes wrong, the agent will propose a fix. Your job is to know which step is actually broken, so you can tell a real fix from a guess.

02Two computers talking

First, the big picture. Every website is a conversation between two computers. Your browser, on your phone or your laptop, is the client: it asks. Somewhere else, a computer called a server answers.

A server is not a magic box. It's a computer like yours, but it stays switched on day and night, it lives in a data centre, and it has one job: wait for questions and send back answers.

The question is called a request. The answer is called a response. Everything you do on the web, opening a page, tapping a button, sending a message, is one or more requests and responses.

To remember the six steps, think of a phone call. You look up the number. You dial and wait for the other side to pick up. You ask your question. They look up the answer. They reply. And you write it down. Opening a website works exactly like that.

The six steps, as a phone call
  1. 1Find
    📞 Look up the number
    DNS turns stayhub.com into an IP address
  2. 2Connect
    📞 Dial, wait for “hello”
    TCP handshake, then TLS encrypts the line
  3. 3Ask
    📞 Ask your question
    The browser sends an HTTP request
  4. 4Work
    📞 They look up the answer
    Backend code runs and asks the database
  5. 5Answer
    📞 They reply
    A response: status code + HTML
  6. 6Build
    📞 You write it down
    The browser fetches CSS, JS, images and draws
Every web page you open goes through these six steps, in this order.

03Step 1 · Find the address

Step one: find the address. Computers don't find each other by names like stayhub.com. They use numbers called IP addresses, a bit like phone numbers. For example: 203.0.113.42.

Names are for humans, numbers are for machines, so something has to translate one into the other. That something is DNS, the Domain Name System. Think of it as the internet's contacts list.

Your browser asks a DNS server: what's the number for stayhub.com? The answer comes back: 203.0.113.42. Your device remembers it for a while, so next time it doesn't need to ask again.

Step 1 · Finding the address
Your browser
DNS server
StayHub server
What's the number for stayhub.com?
203.0.113.42
Now connect to 203.0.113.42 (step 2)
The number is remembered for a while, so the next visit skips the question. 203.0.113.42 is an example address, reserved for teaching.

When the answer is already remembered, this step takes almost no time. When it isn't, it usually takes a few tens of milliseconds. A millisecond is a thousandth of a second, and as you'll see, milliseconds add up.

When DNS goes wrong, the browser simply can't find the site. You see an error like "This site can't be reached", even though the server itself may be perfectly fine. Nobody can call a number they don't have.

04Step 2 · Open a safe line

Step two: dial, and wait for the other side to pick up. Your browser opens a connection to the server. The two computers exchange a short hello: are you there? Yes, I'm here. This is called a handshake, and the rules it follows are called TCP.

Then they agree on a secret code, so that nobody in between, on the café Wi-Fi or anywhere along the way, can read or change what you send. This is TLS. It's what the S in https stands for, and what the padlock next to the address means.

Here's the important part. Each of these exchanges is a round trip: a message goes there, and an answer comes back. Before your browser has asked for anything at all, it has already made about two round trips.

And every round trip takes time, because of distance. Signals in a fibre-optic cable travel at about two hundred thousand kilometres per second. That's fast, but cables don't run in straight lines, and every machine along the way adds a little delay.

From Paris to a server in Frankfurt, a round trip takes about 15 milliseconds. From Tokyo to the same server, about 230 milliseconds. Same server, same code. Only the distance is different.

Step 2 · One round trip, from two cities
Your browser
Server
TCP: are you there?
Yes, I'm here
TLS: let's agree on a secret code
Agreed. The line is encrypted 🔒
Paris ↔ Frankfurt15 ms per round trip
Tokyo ↔ Frankfurt230 ms per round trip
Same server in Frankfurt, same code. Before the browser can ask anything, it pays about two round trips: about 30 ms from Paris, about 460 ms from Tokyo.

05Step 3 · Ask

Step three: ask your question. Now that the line is open, the browser sends the request. It's written in a simple language called HTTP, and it's just a few lines of text.

The first line says what you want: GET, which means "give me", and then the page, /hotels/42. The next lines add details called headers: which browser you use, which languages you read, and a small note called a cookie that reminds the server who you are.

Step 3 and step 5 · A request and its response
The request (step 3)
GET /hotels/42 HTTP/2give me the page /hotels/42
Host: stayhub.comon this site
User-Agent: Chromewhich browser
Accept-Language: en, frwhich languages you read
Cookie: session=7f3a…who you are
The response (step 5)
HTTP/2 200 OKstatus code: it worked
Content-Type: text/htmlwhat's inside: a web page
<h1>Hotel Lumière</h1> …the HTML itself
Both are plain text. The first line matters most: what you want, then how it went.

GET is for reading. When you send something, like booking a room or submitting a form, the browser uses POST instead. A huge part of the web is built from just those two words.

06Step 4 · The server works

Step four: the server does the work. The request arrives, and a program on the server runs. This is the backend: code you never see, which decides what to send back.

To answer, it usually needs facts: the hotel's name, its photos, tonight's price, how many rooms are left. Those facts live in a database, a program built to keep information safe and find it fast.

So the server asks the database, gets the facts back, and uses them to build the page. On StayHub this takes about a tenth of a second. But one slow question to the database can turn it into whole seconds.

07Step 5 · The answer

Step five: the answer comes back. The response starts with a status code, a three-digit number that says how it went.

200 means OK: here's your page. 404 means not found: that page doesn't exist. 500 means server error: the code on the server crashed while it was trying to answer. Remember these three. You'll see them all the time.

A useful trick: codes starting with a 4 mean the request had a problem, like a wrong address. Codes starting with a 5 mean the server had a problem. When an app breaks, the first digit already tells you where to look.

Step 5 · The three status codes to know
200
OK
Here's your page.
404
Not found
That address leads nowhere.
500
Server error
The server's code crashed.
4xx → the request had a problem (wrong address, not allowed…)
5xx → the server had a problem: look at its logs

After the status code comes the content itself. For a web page, that's HTML: plain text that describes what's on the page. A title here, a paragraph there, a button, a photo.

08Step 6 · Build the page

Step six: the browser builds the page. HTML is the skeleton of the page, and also a list of everything else it needs. So the browser reads it, and goes to fetch the rest.

CSS files say how things look: colours, fonts, layout. JavaScript files say how things behave: what happens when you tap a button. Then come the images, the fonts, and more. A typical page today asks for dozens of files, often more than fifty.

Each of those files is another request and another response. The browser keeps the line open and asks for several at once, but it only discovers some files after others arrive. So it pays the round trip again, and again.

Step 6 · One page, request by request
page.html
style.css
app.js
font.woff2
room-1.jpg
room-2.jpg
map.js
reviews.json
trip 1trip 2trip 3trip 4
Files are found in waves: the HTML names the CSS and scripts, which name fonts and photos, and so on. Each wave waits a full round trip.

As the pieces arrive, the browser draws the page: first the text and the layout, then the photos, and finally the JavaScript makes everything work. Only now can you tap Book.

09Where the time goes

Let's put it together. Find the address. Open a safe line. Ask. The server works. The answer comes back. The browser builds the page. Six steps, and most of the time it all happens in under a second.

But not everywhere. Picture a guest in Tokyo opening a StayHub hotel page, served from Frankfurt. About 30 milliseconds to find the address. Nearly half a second for the handshakes. A third of a second for the page itself. And more than two seconds for the photos, styles and scripts, trip after trip. Total: 3.1 seconds.

Where 3.1 seconds go, for a guest in Tokyo
  • Find the address30 ms
  • Handshakes (2 round trips)460 ms
  • The page itself (1 round trip + 120 ms of server work)350 ms
  • Photos, styles, scripts (~9 round trips)2,260 ms
  • Total3,100 ms
The server's own work is 120 ms of 3,100. Doubling the server's speed would save about 60 ms. Removing round trips saves seconds.

Now the surprise: the server's own work is only about a tenth of a second of that. The page isn't slow because the code is slow. It's slow because of round trips multiplied by distance. A faster server would barely help. Fewer trips, or copies of the files closer to Tokyo, would.

That's the habit to keep as a leader: before you accept a fix for a slow page, ask which step is slow, and ask for the measurement.

10When it breaks

The six steps also tell you where to look when a website breaks. "This site can't be reached"? Usually step one, the address. "Your connection is not private"? Step two, the safe line. A 404? The request asked for something that doesn't exist. A 500? The server's code crashed. Slow? Measure each step, and fix the biggest one.

When it breaks: where to look, and what to ask your AI coder
You seeLook atAsk Claude Code
“This site can't be reached”1 · Find (DNS)Do the domain's DNS records point at our server?
“Your connection is not private”2 · Connect (TLS)Is the security certificate valid for this exact domain?
404 Not found3 · Ask: wrong addressWhich URL was requested, and should it exist?
500 Server error4 · Work: code crashedWhat does the server log say at that moment?
SlowMeasure every stepWhich step takes the longest, in milliseconds?

So the next time Claude Code tells you "I fixed it", you can ask the right questions: which step was broken, and how do we know it works now?

Here's the whole journey one last time: find, connect, ask, work, answer, build. Below the video you'll find everything I said, with diagrams for the tricky parts, and a few questions to check that it stuck. See you in the next lesson.

Check yourself

0/10 answered
  1. 1In the conversation that opens a website, which one is the client?

  2. 2What does DNS do?

  3. 3You moved your app to a new domain an hour ago. Visitors see "This site can't be reached", and the server's logs show no new visits at all. Which step do you check first?

  4. 4What does the padlock next to an https address tell you?

  5. 5A guest tries to book a room and gets a 500 error. Where is the problem?

  6. 6Which status code means "that page doesn't exist"?

  7. 7Booking a room sends the guest's details to the server. Which kind of request does the browser use?

  8. 8Why does opening one page make the browser send dozens of requests?

  9. 9The same StayHub page takes 0.4 s in Paris and 3.1 s in Tokyo, from one server in Frankfurt. What explains most of the difference?

  10. 10The Tokyo page takes 3.1 s. Claude Code proposes: "Move to a server twice as powerful. That should halve the load time." What do you answer?