Larger applications — RPC · Hono

Keep the RPC types when the API is split into one Hono per resource: chain each sub-app's routes, chain the route() calls that mount them, export the type of the chain's result, and compute the client's type once for every caller.

What you will learn

Read the theory for Larger applications

All RPC lessons

All Hono courses

loading types…

What you'll learn

  • Chain a sub-app's routes so it contributes them to the type of the app that mounts it
  • Chain route() calls and export typeof the chain's result, with basePath() in the type too
  • Compute ReturnType<typeof hc<AppType>> once in a client module, the guide's compile-before-use pattern