Prod Squad

How the web works: client, server, DNS, HTTP

What really happens when someone types a URL or taps a button, explained so you can follow (and lead) technical conversations.

6 min readAll levels#web basics#client server#dns#http
Ask about this lesson
On this page

"What happens when you type a URL into a browser?" is a classic technical question, and even when it isn't asked directly, the mental model behind it shows up everywhere: in bug triage, latency discussions and system design rounds. You don't need to know packet formats. You need a clear picture of the moving parts and where things can go slow or wrong.

Why interviewers ask this

Interviewers use this question to check whether you can work credibly with engineers. Can you describe a system in layers? Do you know where latency comes from? Can you explain it simply to a non-technical stakeholder? Technical PM and big-tech loops often use it as a warm-up before a system design question, and the clarity of your explanation matters as much as the facts.

The framework

Think of every web interaction as a short story with five characters: the client (browser or app), DNS, the network, the server, and the data behind it.

sequenceDiagram
    participant U as User's browser
    participant D as DNS
    participant C as CDN
    participant S as App server
    participant DB as Database
    U->>D: Where is shop.example.com?
    D-->>U: It's at 203.0.113.10
    U->>C: GET the page over HTTPS
    C-->>U: Cached images, CSS, JS
    U->>S: GET /api/products
    S->>DB: Query products
    DB-->>S: Rows
    S-->>U: 200 OK with JSON
    U->>U: Render the page
  1. The URL. https://shop.example.com/products has a protocol (HTTPS), a domain name, and a path.
  2. DNS lookup. Computers talk in IP addresses, so the browser asks DNS, the internet's phone book, to translate the name. Results are cached, so repeat visits skip this step.
  3. Connection. The browser opens a secure connection (TLS) to that address, so the traffic is encrypted.
  4. HTTP request. The browser sends a request: a method (GET to read, POST to create), the path, headers (like cookies that identify the user), and sometimes a body.
  5. Server work. A load balancer passes the request to one of many servers. The server runs application code, checks who the user is, reads or writes data in a database, maybe calls other services, and builds a response.
  6. HTTP response. A status code (200 OK, 404 Not Found, 500 Server Error), headers, and a body: HTML, or JSON data for an app.
  7. Rendering. The browser builds the page, downloads images, CSS and JavaScript (often from a CDN close to the user), and runs scripts that may make more API calls.

Where time goes: DNS (milliseconds, usually cached), distance to the server (physics: India to the US is roughly 200ms round trip), server processing and database queries, payload size, and work done in the browser.

Worked example

Question: "Explain what happens when a user taps 'Place Order' in a food delivery app."

Sample answer:

"I'll go from the tap to the confirmation screen, then mention what happens afterwards.

On the phone: the app collects the cart, address and payment method, and sends a POST request to an endpoint like /orders, with a token that proves who the user is.

Getting there: the request travels over HTTPS to the company's servers. A load balancer picks a healthy server to handle it.

On the server: the order service checks the user is logged in, validates the cart (are the items still available, has the price changed?), and calls the payments service, which talks to a payment gateway. This should be idempotent, so if the user's network drops and the app retries, they aren't charged twice. If payment succeeds, the order is saved to the database.

The response: the server replies with a 201 Created and the order ID. The app shows the confirmation screen. The user's part is done in roughly a second.

Afterwards, asynchronously: the server publishes an 'order placed' event. Other services pick it up: the restaurant gets notified, a delivery partner is assigned, and the user gets push notifications as status changes. These happen in the background so the user isn't kept waiting.

What could go wrong: payment timeouts, the restaurant closing, or the app retrying. Good design handles each, like showing 'We're confirming your payment' instead of an error."

Common mistakes

  • Going too deep on networking (TCP handshakes) and never reaching the product-relevant parts.
  • Skipping the server entirely, as if the app talks straight to the database.
  • Ignoring what happens asynchronously after the response.
  • Jargon without explanation when the interviewer asked for a simple version.
  • Forgetting failure cases, where product decisions matter most.

Interviewer tips

What "great" sounds like:

  • "Let me walk through it in layers: client, network, server, data."
  • "This part is synchronous because the user is waiting; the rest happens in the background."
  • "The biggest latency contributors here are distance and the database query."
  • "If the network drops and the app retries, we need to make sure the user isn't charged twice."
  • Checking the level: "Want me to go deeper on any layer, or keep it high level?"

Practice questions

Answer one in a mock interview and get graded instantly.

  1. 1.Explain what happens when a user taps "Place Order" in a food delivery app.

    Practice this →
  2. 2.What happens when you type a URL into your browser and press Enter?

    Practice this →
  3. 3.Our website loads slowly for users in Australia but fine in India. What might be going on?

    Practice this →

Finished reading?