JamesReviewsMusic
JRM-28Replace the frontend fetch wrapper with the Hono RPC client
Description
The frontend talks to the API through a hand-rolled fetch wrapper (frontend/src/lib/api.ts) where every call site declares what it expects back via a generic. Nothing checks those types are true, which is how a request to a non-existent route sat unnoticed in a hook. Hono can export the type of the whole API and the client infers every path, param, body and response from it.
- Export AppType from the backend
- Use hc() in the frontend with the API base URL from env
- Migrate all call sites (routes, hooks, mutations) off lib/api.ts, then delete it
- Renaming a backend route or changing a response shape should now be a frontend compile error
Sub-tickets
0No sub-tickets yet.
Links
No links.
Comments
0No comments yet.