Skip to content

Hono Integration

Hono is a high-performance web framework built on top of Fetch API. For additional context, refer to the Fetch Server Integration guide.

Basic

ts
import { Hono } from 'hono'
import { createMiddleware, RPCHandler } from '@orpc/server/hono'

const app = new Hono()

const handler = new RPCHandler(router)

app.use('/rpc/*', createMiddleware(handler, {
  prefix: '/rpc',
  context: async (c) => {
    return {} // Provide initial context if needed
  }
}))

export default app

INFO

The handler can be any supported oRPC handler, such as RPCHandler, OpenAPIHandler, or another custom handler.

Released under the MIT License.