Hono Local Development Guide
Use Hono to build lightweight Web APIs and edge services, with Node.js defaulting to localhost:3000, and can also be deployed to Cloudflare Workers.
Hono is an ultrafast web framework with a simple API and a small footprint, capable of running on multiple runtimes including Cloudflare Workers, Deno, Bun, and Node.js. It is suitable for REST APIs, BFF layers, and edge functions.
Quick Start (Node.js)
npm create hono@latest my-app
cd my-app
npm install
npm run devYou can choose either the nodejs or cloudflare-workers template.
Default localhost Access
| Purpose | Address |
|---|---|
| Node Development Server | http://localhost:3000 |
| Cloudflare Workers Local | http://localhost:8787 (via wrangler dev) |
In the Node template, you can modify the port in the entry file by changing serve({ fetch: app.fetch, port: 3000 }).
Common Commands
| Command | Description |
|---|---|
npm run dev | Local development (depending on the template, either Node or Wrangler) |
wrangler dev | Local simulation for Workers (Cloudflare template) |
wrangler deploy | Deploy to Cloudflare Workers |
Minimal Example
import { Hono } from 'hono';
const app = new Hono();
app.get('/', (c) => c.json({ message: 'Hello from localhost!' }));
app.get('/api/health', (c) => c.json({ ok: true }));
export default app;Use Cases
- Lightweight REST / JSON APIs
- Integration with frontend SPAs (same-origin or CORS)
- Edge deployment: low latency, globally distributed
Summary
Hono local Node development typically accesses http://localhost:3000, while the Workers mode uses http://localhost:8787, making it suitable for quickly setting up APIs and edge services.