• your AI CTOTHE PLAYBOOK
Playbook
  • Build path
  • Choose your tier
  • Modules
    14
  • Launch gates
    3
Research
  • Chat playground
TIER 1 · MVP3/7
x

steps done — next: scaffold the boilerplate

  1. Playbook
  2. Modules
Ask the playbook
All modules

MODULE 05 · HOW FRONTEND TALKS TO BACKEND

API layer

The card that makes tier moves cheap.

One typed client, one response shape — { data } on success, { error } on failure — from day one. Follow this card at Tier 1 and moving to a separate backend later is days, not months: the frontend just points at a new URL.

WHEN YOU NEED IT

Tier 1 and up. It matters most before you think you need it.

THE CHOICE, PER TIER

  • T1Next.js Route Handlers, enveloped responses
  • T2Separate Express service, same envelopes
  • T3+ versioning, rate limits, request logging

SAY THIS TO YOUR AGENT

"Create a typed API client in one file. Every endpoint returns { data } or { error } with the same shape. All fetches go through the client — no raw fetch calls inside components."

DONE WHEN

  • One file lists every endpoint the app calls
  • Errors show a helpful message, never a blank screen
  • Validation happens on the server, not just in forms
04 Auth06 File storage