Framework Adapters

Hono

Hono adapter for edge runtimes

Hono#

Surf provides a Hono sub-app and a standalone middleware handler for Cloudflare Workers and edge runtimes.

typescript
import { Hono } from 'hono'
import { createSurf } from '@surfjs/core'
import { honoApp } from '@surfjs/core/hono'
ย 
const surf = await createSurf({
name: 'Hono App',
commands: { /* ... */ },
})
ย 
// Mount as sub-app
const app = new Hono()
app.route('/', honoApp(surf))
ย 
export default app
ย 
// Or use as a Cloudflare Worker / standalone
import { honoMiddleware } from '@surfjs/core/hono'
export default { fetch: honoMiddleware(surf) }

The Hono adapter uses Web Streams API for SSE, making it compatible with Cloudflare Workers, Deno, and Bun.