Layer 5 — Clients (v1.0.0)
The web app is the only client in v1.0.0. It becomes a thin client — local logic (aggregations, derived state, N+1 fetches) moves into the backend behind L4 endpoints. No new client surfaces (mobile, desktop, CLI, AI agents, partner integrations) in this stage.
API consumption
| Concern | Pick |
|---|---|
| Data-fetching layer | TanStack Query |
| Typed client + hooks | Generated by orval from the openapi.json emitted by the backend |
| Runtime response validation | Generated Zod validators (orval option), enabled on every endpoint |
| Error handling | The typed envelope ({ error: { code, message, details? } }) is parsed at the client boundary; downstream code receives a typed ApiError and never a raw fetch failure |
One hook per endpoint, fully typed. Generator config lives in the frontend workspace; the regenerated client + hooks are committed so CI is deterministic and reviewers can see API surface changes in PR diffs. The end-to-end chain is Zod schemas in @pharus/api-contracts → emitted openapi.json → orval-generated TanStack Query hooks. See the L4 Toolchain section for the source-of-truth direction and tooling rationale.
Frontend logic-migration notes per page land here as v1.0.0's frontend tasks progress.