Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsApr 3, 2026·2 min de lectura

Hono — Ultrafast Web Framework for the Edge

Tiny, fast web framework for Cloudflare Workers, Deno, Bun, and Node.js. Perfect API layer for AI services. 29K+ GitHub stars.

Listo para agents

Staging seguro para este activo

Este activo primero queda en staging. El prompt copiado pide inspeccionar los archivos staged antes de activar scripts, config MCP o config global.

Stage only · 17/100Política: staging
Superficie agent
Cualquier agent MCP/CLI
Tipo
Script
Instalación
Stage only
Confianza
Confianza: Established
Entrada
hono.md
Comando de staging seguro
npx -y tokrepo@latest install ff72c952-86a4-402d-b288-7468b3a3f4c5 --target codex

Primero deja archivos en staging; la activación requiere revisar el README y el plan staged.

TL;DR
Hono is a lightweight web framework running on Cloudflare Workers, Deno, and Bun.
§01

What it is

Hono is an ultrafast, lightweight web framework designed for edge computing runtimes. It runs on Cloudflare Workers, Deno, Bun, AWS Lambda, Fastly, and Node.js with the same codebase. The framework weighs under 14KB, starts in milliseconds, and provides a familiar Express-like API with TypeScript-first design.

It targets developers building APIs, web applications, and AI service backends that need to run close to users on edge infrastructure with minimal latency.

§02

How it saves time or tokens

Hono lets you write one API codebase and deploy it to any edge or serverless platform. Instead of learning platform-specific APIs for each cloud provider, you use Hono's unified routing, middleware, and response helpers. For AI applications, this means building lightweight proxy APIs, rate limiting layers, or model routing services that deploy globally on edge networks with sub-millisecond cold starts.

§03

How to use

  1. Create a new project:
npm create hono@latest my-app
cd my-app
npm install
  1. Define routes:
import { Hono } from 'hono';

const app = new Hono();

app.get('/', (c) => c.text('Hello Hono'));
app.get('/api/health', (c) => c.json({ status: 'ok' }));

export default app;
  1. Deploy to your platform:
# Cloudflare Workers
npx wrangler deploy

# Or run locally with any runtime
npx hono dev src/index.ts
§04

Example

import { Hono } from 'hono';
import { cors } from 'hono/cors';
import { bearerAuth } from 'hono/bearer-auth';

const app = new Hono();

app.use('/api/*', cors());
app.use('/api/*', bearerAuth({ token: 'my-secret-token' }));

// AI model proxy endpoint
app.post('/api/generate', async (c) => {
    const { prompt, model } = await c.req.json();
    
    const response = await fetch('https://api.openai.com/v1/chat/completions', {
        method: 'POST',
        headers: {
            'Authorization': `Bearer ${c.env.OPENAI_KEY}`,
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            model: model || 'gpt-4o',
            messages: [{ role: 'user', content: prompt }]
        })
    });
    
    return c.json(await response.json());
});

export default app;
§05

Related on TokRepo

§06

Common pitfalls

  • Edge runtimes have memory and execution time limits. AI inference tasks that take more than a few seconds or need large models should run on dedicated servers, not edge functions.
  • Not all Node.js APIs are available on every edge runtime. Test your middleware and dependencies on your target platform before deploying.
  • Hono's ecosystem is smaller than Express's. Check if the middleware you need exists before starting a project. Many common patterns (CORS, auth, rate limiting) are built-in.

Preguntas frecuentes

Which runtimes does Hono support?+

Hono runs on Cloudflare Workers, Deno, Bun, Node.js, AWS Lambda, Fastly Compute, Vercel Edge, Netlify Edge, and Lagon. You write the same code and change only the entry point adapter for each platform. This portability avoids vendor lock-in.

How does Hono compare to Express.js?+

Hono is significantly faster and smaller than Express. It uses a RegExpRouter for fast route matching, weighs under 14KB, and is designed for edge runtimes that Express does not support. Hono provides similar middleware patterns but with TypeScript-first design and better type inference.

Can I use Hono for AI applications?+

Yes. Hono works well as a lightweight API layer for AI applications -- model proxy endpoints, rate limiting, request routing, and authentication. Deploy it on edge networks for low-latency API access globally. Keep heavy computation (model inference) on dedicated GPU servers.

Does Hono support WebSocket?+

Yes. Hono provides WebSocket support through runtime-specific adapters. On Cloudflare Workers, it uses Durable Objects for WebSocket connections. On other runtimes, it delegates to the platform's native WebSocket support. This enables real-time features like streaming AI responses.

Is Hono suitable for full-stack applications?+

Yes. Hono includes JSX support for server-side rendering, static file serving, and template rendering. You can build full-stack apps with Hono, though for complex frontend UIs, pairing Hono as a backend API with a dedicated frontend framework is more common.

Referencias (3)
🙏

Fuente y agradecimientos

Created by Yusuke Wada. Licensed under MIT.

hono — ⭐ 29,700+

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados