← knowledge.oriz.in

Hono RPC for type-safe API client

decision apihonotypestypescriptrpc

Hono RPC for type-safe API client

Decision

Sites and extensions call the umbrella Hono Worker via Hono's RPC client hc<AppType>. The Worker exports type AppType = typeof app, which flows to every consumer through the workspace package @chirag127/api-client. No codegen step, no separate schema file, no OpenAPI emit.

Why

Hono's hc gives end-to-end type-safety for free as long as the backend and frontend are in the same TypeScript project. Treating the master oriz repo as a workspace + publishing @chirag127/api-client as a thin re-export of the Worker's AppType lets every site and extension import a fully-typed client without an intermediate spec file. Eliminates the codegen drift problem entirely.

Implications

Cross-refs