Design API contracts from the consumer's side: validate responses at the boundary, return errors the UI can act on, paginate with cursors, make retries safe with idempotency keys, and evolve without breaking old clients.
Every frontend architecture decision eventually meets the API: how many requests a page needs, what a loading state looks like, which errors the user sees, and whether an old mobile app breaks after a deploy. Frontend architects should help design the contract, not just consume it.
A good contract for UI consumers has five properties, and each gets a step in this tutorial:
undefined is not a function deep in a component.For choosing between REST, GraphQL, and a backend-for-frontend, and for avoiding request waterfalls, see the APIs, Data Models, and Scaling tutorial. This one focuses on the contract details that decide whether the UI is robust.