Skip to content

API & data design · 1 of 4

One screen, many calls

Step 1 · The pattern

One endpoint per box on the diagram

The API mirrors the diagram: /user, /orders, /offers. The home screen calls three of them. Each call costs about 250 ms of server time, most of it the same per-request work (TLS, sign-in check, routing, logging) before any data is read. (All numbers are illustrative.)

  • a call
  • served

In short

One screen, many calls: how it works and how it breaks

The first API most teams draw has one endpoint per box or table: /user, /orders, /offers. To draw the home screen, the app calls them all, often one after another. Every request pays a fixed cost before any data is read: a round trip over a phone network, TLS, authentication, routing, logging. Twelve small calls cost far more than one call returning the same data, on the phone and on the server. And the app decides the count, not the backend: one release that adds calls to a popular screen multiplies traffic as users upgrade. The usual fix is an endpoint shaped for the screen (a backend-for-frontend): one request from the phone, the parts fetched together inside the data centre and cached where they can be. Track calls per screen, and review it with each release.

What this simulation simplifies

  • Calls are sent all at once; real apps often send them one after another, which is slower still.
  • The screen endpoint's work is a single fixed time; in practice it calls the parts in parallel.

How this comes up in interviews

"Design the API for a food app's home screen. One endpoint or many?"

Then they ask

  1. What about the web app?
  2. How do you cache the parts?
  3. How do you stop it growing again?

A strong answer covers

  • Count calls per screen; each pays a round trip and the per-request overhead.
  • A screen-shaped endpoint (BFF) composes the parts server-side.
  • Cache parts separately (menus long, offers short), not the whole screen.
  • Version the screen endpoint with the app; keep it free of business logic.
  • Monitor calls per screen per app version.

Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.

On one page: the track cheat sheet.

Last reviewed: Official documentation

Diagrams are our own simulations: the timings, rates and counts in them are illustrative, not measurements. Captions are original wording.