You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi!
At work, I’ve been building a full-stack application using React, Hono, and Turborepo with a monorepo setup (server, client, shared).
Until about a month ago, I was defining all my types in the shared package and manually keeping them in sync with the API. Since the app was still very much in a proof-of-concept phase, the types changed frequently, which meant I constantly had to update them in multiple places.
I recently discovered Hono’s RPC feature and decided to refactor the app around it. I now generate a proper AppType, and on the frontend I use a hono RPC client (hc) inside my TanStack Query queries and mutations.
This works flawlessly, and I honestly love it.
However, as the application has grown, I now have many endpoints with more complex, specialized return types (for example, ORM relations like posts with comments).
Because of this, I’m struggling to properly type my client-side child components. I usually end up defining local TypeScript types, which works, but feels fragile — and it’s exactly the problem I was trying to solve by switching to RPC in the first place: having reliable, automatically generated types.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
At work, I’ve been building a full-stack application using
React,Hono, andTurborepowith a monorepo setup (server,client,shared).Until about a month ago, I was defining all my types in the
sharedpackage and manually keeping them in sync with the API. Since the app was still very much in a proof-of-concept phase, the types changed frequently, which meant I constantly had to update them in multiple places.I recently discovered Hono’s RPC feature and decided to refactor the app around it. I now generate a proper
AppType, and on the frontend I use ahonoRPC client (hc) inside my TanStack Query queries and mutations.This works flawlessly, and I honestly love it.
However, as the application has grown, I now have many endpoints with more complex, specialized return types (for example, ORM relations like posts with comments).
Because of this, I’m struggling to properly type my client-side child components. I usually end up defining local TypeScript types, which works, but feels fragile — and it’s exactly the problem I was trying to solve by switching to RPC in the first place: having reliable, automatically generated types.
Beta Was this translation helpful? Give feedback.
All reactions