Skip to content

Hono backend

Hono is a runtime-agnostic HTTP framework — the same code runs on Bun, Node, Deno, Cloudflare Workers, AWS Lambda, Vercel, etc. HonoBackend wraps it for actor-ts.

import { ActorSystem, HttpExtensionId } from 'actor-ts';
import { HonoBackend } from 'actor-ts/http';
const http = system.extension(HttpExtensionId);
await http.newServerAt('0.0.0.0', 8080)
.useBackend(new HonoBackend())
.bind(routes);

Hono is the right pick when:

  • Edge / serverless — Cloudflare Workers, Vercel Edge, Deno Deploy. Hono is one of the few HTTP frameworks that works in those environments.
  • Cross-runtime portability — same code on Bun + Node + Edge.
  • Minimal overhead — Hono is lighter than Fastify, faster than Express.

For a typical long-running production server, Fastify is usually preferable — bigger plugin ecosystem, more production hours. Hono shines when “runs in many places” is a hard requirement.

// On a long-running VM: this works
await http.newServerAt('0.0.0.0', 8080)
.useBackend(new HonoBackend())
.bind(routes);
// On Cloudflare Workers: there's no "newServerAt(host, port)"
// The runtime invokes a handler per request.

HonoBackend exposes its underlying Hono instance:

const backend = new HonoBackend();
const honoApp = backend.app; // ← export to the edge runtime

In Cloudflare Workers:

worker.ts
export default { fetch: honoApp.fetch };

The framework’s actor-ts side then runs in-memory inside the isolate — short-lived, no clustering, no persistence. Useful for stateless request-handling logic that benefits from actor patterns (state machines, validation pipelines).

For long-running actor systems with cluster + persistence, don’t run on edge runtimes — they’re isolate-per-request, not long-lived processes.

new HonoBackend({
// Hono itself has minimal config; most settings come via routes / middleware
});
import { logger, cors, secureHeaders } from 'hono/middleware';
const backend = new HonoBackend();
await http.newServerAt('0.0.0.0', 8080)
.useBackend(backend)
.bind(routes);
backend.app.use('*', logger());
backend.app.use('/api/*', cors());
backend.app.use('*', secureHeaders());

Hono’s middleware ecosystem is smaller than Express’s but covers the common cases — CORS, security headers, JWT auth, basic auth, compression.

Terminal window
npm install hono
# or: bun add hono

Rough numbers:

  • 100K-150K req/sec on Bun for trivial routes.
  • Slightly slower than Fastify on Node.
  • Edge runtime numbers depend on the platform (Cloudflare Workers: ~50K req/sec per worker; throttled by the platform).