Chapter 08 · Edge

The Client — Where Every Story Begins

Follow one request through the system — each component exists because the previous layer hit a limit.

Chapter 08Edge Layer

The Client — Where Every Story Begins

Picture Priya in Mumbai opening your app at 9 PM. She doesn't care about servers or shards — she just wants her feed to load. But her tap is where your entire system design starts.

Client
Response

The client is anything on the user's side: a web browser, iOS app, Android app, or even a smart TV. It renders UI, captures input, and makes HTTP requests on behalf of the user. It does not run your business logic — it asks someone else to.

⚠️ What the Client Cannot Do
  • 1. Store secrets safely — Anything in a mobile app can be reverse-engineered. Never trust the client for auth decisions.
  • 2. Handle scale — A million users means a million clients — you can't coordinate them from one place.
  • 3. Guarantee consistency — Networks drop. Apps get killed. The client might retry, duplicate, or lose requests.
What the Client Actually Sends

When Priya taps "Buy", her app sends an HTTP request: a method (POST), a URL (/api/v1/orders), headers (auth token, content-type), and a body (product ID, quantity). That's it. The client's job is to format this correctly and render whatever comes back — JSON, HTML, or an error message.

Web Browser

Runs JavaScript, renders HTML/CSS. Makes requests via fetch() or XHR. Caches static assets locally. Single origin policy limits which APIs it can call unless CORS is configured.

Mobile App

Native or React Native/Flutter. Talks to your API over HTTPS. Can store tokens in secure keychain. Often batches requests and handles offline mode — which means retries and duplicate submissions become your problem on the server.
~50msTypical mobile RTT
3–5Requests per screen
0Business logic on client
Key Insight
Interview tip: When someone says "the frontend calls the API," they're describing the client tier. Your design should assume clients are unreliable, untrusted, and numerous.
Priya's request leaves her phone — but example.com isn't an IP address her phone understands. Something has to translate human-readable names into machine addresses. That's where DNS enters the story.
1 / 9