Skip to content

Instantly share code, notes, and snippets.

@sohamukute
Created March 4, 2026 18:13
Show Gist options
  • Select an option

  • Save sohamukute/39224859e2d9bf4d240c099fe4f6af05 to your computer and use it in GitHub Desktop.

Select an option

Save sohamukute/39224859e2d9bf4d240c099fe4f6af05 to your computer and use it in GitHub Desktop.

Day 1 – How a Web Request Travels From Your Tap to the Server

When you tap a profile on Instagram or send a message on WhatsApp, it feels instant.

Gemini_Generated_Image_pfieb5pfieb5pfie

But behind that tap, a tiny, structured journey begins from your finger, through networks, to servers and databases, and back to your screen.

Today we’ll map that journey in one clear diagram, and sprinkle in enough depth that you can:

  • Understand the big picture like a beginner.
  • Already spot levers you can later tweak for scaling, latency, and reliability.

What really happens when you tap an app

Gemini_Generated_Image

Imagine this:
You’re on your phone, open Instagram, and tap a profile.
Here’s what happens step by step, simplified but technically honest.

1. Your phone makes an HTTP request

Your app (Instagram, WhatsApp, etc.) doesn’t “know” the data locally.
So it sends an HTTP request to the server:

  • Method: GET /users/{id} (or POST /messages for sending).
  • Headers: Metadata like device type, auth token, content type.
  • Body (for POST): The actual data (e.g., message text, image ID).

This request is just a structured text message over the internet.
It’s like writing a small letter saying:

“I’m user X, here’s my token, please give me profile Y.”

2. The request travels through the internet

Your request doesn’t fly directly to the right server.
It goes:

  • From your phone → local Wi‑Fi or mobile data → ISP → routers → possibly a load balancer or CDN (we’ll cover those later).
  • Through multiple network hops, each forwarding it closer to the destination server.

Each hop adds a tiny delay (milliseconds), but thousands of taps add up.

At this level, system design starts asking questions like:

  • What happens if the connection drops in the middle?
  • How long should the client wait before timing out?
  • How do we keep this fast for users in Mumbai, Delhi, and New York?

3. The server receives and processes the request

Finally, the server receives the HTTP request.

At this point, the server can:

  • Check cache first (e.g., Redis)
    • If the profile data is already there, it responds immediately.
  • Query the database (e.g., PostgreSQL / MySQL)
    • Fetch the user row, their posts, and relationships.
  • Enrich data (join, filter, paginate)
    • Decide how many posts to show, which ones are promoted, etc.

The server then:

  • Formats the data into a response (usually JSON).
  • Attaches HTTP status codes:
    • 200 OK = success.
    • 404 Not Found = profile doesn’t exist.
    • 500 Internal Server Error = something broke on the server.

4. The response travels back to your phone

The server sends the response back along the same path:

  • Server → routers → internet → your phone → app.

The app then:

  • Parses the JSON.
  • Renders the UI: profile picture, name, posts, “Follow” button, etc.

The whole thing usually takes hundreds of milliseconds, but that feels like “instant” to you.


What this teaches us (system‑design level)

Even at Day 1, this simple flow already exposes the core levers:

  • Latency = time from tap to display.
    • Affected by network, server processing, DB query speed, cache hits.
  • Reliability = what happens when something fails?
    • Does the user see an error? A retry? A fallback UI?
  • Scalability = what if 10 million users tap at once?
    • You can’t just scale the server; you may need:
      • More servers,
      • Load balancers,
      • Caching,
      • Database optimization.

So system design is not “just high‑level drawings”.
It’s about answering:

“How do we keep this flow fast, safe, and cheap as we grow?”


Takeaway for Day 1

Every tap on an app starts a tiny request‑response chain.
System design is about designing and protecting that chain when 10 million taps happen at once, while keeping it fast, cheap, and reliable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment