The Generated API Client
Everything under frontend/src/client/ is generated code — it doesn’t get hand-written, and it shouldn’t get hand-edited either. It’s produced from the backend’s own OpenAPI schema, so the frontend’s types always match what the backend actually returns.
Regenerating it
Section titled “Regenerating it”From the repo root:
bun run generate-clientThis exports the backend’s live OpenAPI schema, regenerates src/client/, and runs the linter over the result. Run it every time you change a backend route or model — new field, new endpoint, changed response shape, all of it. Skipping this is the #1 cause of “the frontend type doesn’t match what the backend actually sends.”
How it’s used
Section titled “How it’s used”src/main.tsx configures the client once — base URL and how to attach the auth token (read from localStorage) — and every component after that just calls into it through TanStack Query:
useQuery({ queryKey: ["items"], queryFn: () => ItemsService.readItems(),})You never write the fetch/axios call yourself — you call the generated *Service function, and TanStack Query handles caching and re-fetching around it.