Feature Request
Summary
I'd love to see a first-party typed RPC client for Hono that works seamlessly in edge environments like Cloudflare Workers and Deno Deploy, without requiring Node.js-specific adapters.
Motivation
Currently, when building a full-stack app with Hono on Cloudflare Workers (using Wrangler + Vite), sharing the router type between server and client requires a custom setup. The hono/client package is great, but there are a few rough edges when targeting edge runtimes specifically:
- The client currently relies on
fetch from the global scope — explicit environment-aware fetch injection would improve Workers compatibility (especially in test environments using Miniflare)
- No built-in support for streaming RPC responses (SSE / ReadableStream) in the typed client
- Error handling types are not propagated —
HTTPException subtypes are lost on the client side
Proposed API
// server: app.ts
const app = new Hono()
.get('/user/:id', async (c) => {
return c.json({ id: c.req.param('id'), name: 'F. B. Weber' })
})
export type AppType = typeof app
// client: anywhere (edge, browser, Node)
import { hc } from 'hono/client'
import type { AppType } from './app'
const client = hc<AppType>('https://api.example.com', {
fetch: env.SERVICE_BINDING.fetch.bind(env.SERVICE_BINDING), // service binding support
})
const res = await client.user[':id'].$get({ param: { id: '42' } })
const data = await res.json() // fully typed
Additional Context
- Cloudflare Workers Service Bindings expose a
fetch-compatible interface — supporting this would enable zero-latency internal RPC without HTTP overhead
- This would make Hono a natural fit for microservice architectures on Cloudflare (similar to what tRPC does for Next.js)
- Related: Cloudflare Service Bindings docs
Would love to discuss the design. Happy to submit a PR if the direction is agreed upon!
Feature Request
Summary
I'd love to see a first-party typed RPC client for Hono that works seamlessly in edge environments like Cloudflare Workers and Deno Deploy, without requiring Node.js-specific adapters.
Motivation
Currently, when building a full-stack app with Hono on Cloudflare Workers (using Wrangler + Vite), sharing the router type between server and client requires a custom setup. The
hono/clientpackage is great, but there are a few rough edges when targeting edge runtimes specifically:fetchfrom the global scope — explicit environment-awarefetchinjection would improve Workers compatibility (especially in test environments using Miniflare)HTTPExceptionsubtypes are lost on the client sideProposed API
Additional Context
fetch-compatible interface — supporting this would enable zero-latency internal RPC without HTTP overheadWould love to discuss the design. Happy to submit a PR if the direction is agreed upon!