type: architecture
status: active
timestamp: 2026-06-20
tags: [architecture, hono, rpc, type-safety]
status: active
timestamp: 2026-06-20
tags: [architecture, hono, rpc, type-safety]
Hono RPC type-sharing — `hc<typeof app>` client across sites
API consumers get full type inference from Hono Worker via rpc client. See the decision file for why.
Hono RPC type-sharing
Shape
apps/api/src/index.ts ends with export type AppType = typeof app. The workspace package packages/api-client/ re-exports hc<AppType> configured against https://api.oriz.in. Every site and extension imports it:
import { client } from '@chirag127/api-client'
await client.routes.contact.$post({ json: { ... } })
Calls have full IntelliSense on payload + response shape.
Build flow
The Worker’s AppType flows through the workspace boundary like any other type — no codegen, no .d.ts emit, no OpenAPI spec. Master matrix deploy publishes the Worker and @chirag127/api-client in lockstep so consumers never see type drift. A route signature change on the Worker breaks tsc in every consumer at the next CI run.
Cross-refs
- Why ? [[decisions/compute/hono-rpc-for-type-sharing]]
- API umbrella ? [[architecture/api-umbrella-hono-worker]]