Skip to content
OpenSmartRoute
Skillv1.0.0

hono

You are an expert in Hono, the ultrafast web framework for the edge. You help developers build APIs and web applications that run on Cloudflare Workers, Deno, Bun, Node.js, AWS Lambda, and Vercel Edge

by terminalskills(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from terminalskills/skills (skills/hono/SKILL.md). Install upstream with npx skills add terminalskills/skills --skill hono. Copyright stays with the author (Apache-2.0).

Hono — Ultrafast Web Framework

You are an expert in Hono, the ultrafast web framework for the edge. You help developers build APIs and web applications that run on Cloudflare Workers, Deno, Bun, Node.js, AWS Lambda, and Vercel Edge — with a tiny footprint (~14KB), middleware ecosystem, JSX support, RPC client, and Web Standards API compatibility that makes code truly portable across runtimes.

Core Capabilities

API Routes

import { Hono } from "hono";
import { cors } from "hono/cors";
import { logger } from "hono/logger";
import { jwt } from "hono/jwt";
import { zValidator } from "@hono/zod-validator";
import { z } from "zod";

const app = new Hono();

// Middleware
app.use("*", logger());
app.use("/api/*", cors({ origin: ["https://myapp.com"], credentials: true }));
app.use("/api/protected/*", jwt({ secret: process.env.JWT_SECRET! }));

// Typed routes with Zod validation
const createUserSchema = z.object({
  name: z.string().min(1),
  email: z.string().email(),
  role: z.enum(["user", "admin"]).default("user"),
});

app.get("/api/users", async (c) => {
  const { page, limit } = c.req.query();
  const users = await db.users.findMany({
    skip: ((+page || 1) - 1) * (+limit || 20),
    take: +limit || 20,
  });
  return c.json({ data: users });
});

app.post("/api/users", zValidator("json", createUserSchema), async (c) => {
  const body = c.req.valid("json");        // Typed as { name: string, email: string, role: "user" | "admin" }
  const user = await db.users.create({ data: body });
  return c.json(user, 201);
});

app.get("/api/users/:id", async (c) => {
  const id = c.req.param("id");
  const user = await db.users.findUnique({ where: { id } });
  if (!user) return c.json({ error: "Not found" }, 404);
  return c.json(user);
});

// Protected route
app.get("/api/protected/me", (c) => {
  const payload = c.get("jwtPayload");
  return c.json({ userId: payload.sub });
});

export default app;

RPC Client (Type-Safe)

// server.ts — Export typed routes
const routes = app
  .get("/api/users", ...)
  .post("/api/users", ...);

export type AppType = typeof routes;

// client.ts — Type-safe client (like tRPC but for REST)
import { hc } from "hono/client";
import type { AppType } from "./server";

const client = hc<AppType>("https://api.myapp.com");

const users = await client.api.users.$get();
const json = await users.json();           // Typed as User[]

const newUser = await client.api.users.$post({
  json: { name: "Alice", email: "alice@example.com" },  // Type-checked!
});

JSX and HTML

import { Hono } from "hono";
import { html } from "hono/html";

const app = new Hono();

app.get("/", (c) => {
  return c.html(
    <html>
      <body>
        <h1>Hello from Hono!</h1>
        <p>Running on {c.runtime}</p>
      </body>
    </html>
  );
});

// Streaming
app.get("/stream", (c) => {
  return c.streamText(async (stream) => {
    for (const word of "Hello World from Hono!".split(" ")) {
      await stream.write(word + " ");
      await stream.sleep(100);
    }
  });
});

Installation

npm create hono@latest my-app
# Choose: cloudflare-workers | nodejs | bun | deno | vercel | aws-lambda
cd my-app && npm install
npm run dev

Best Practices

  1. Web Standards — Uses Request/Response API; code runs on any runtime without changes
  2. Zod validation — Use @hono/zod-validator for type-safe request validation; compile + runtime safety
  3. RPC client — Use hc<AppType>() for type-safe client; catches API contract mismatches at compile time
  4. Middleware — Rich ecosystem: cors, jwt, logger, compress, cache, rate-limit, OpenAPI
  5. Edge-first — 14KB bundle; runs on Cloudflare Workers with <1ms cold start
  6. Multi-runtime — Same code deploys to Workers, Bun, Deno, Node, Lambda; switch with one config change
  7. JSX support — Built-in JSX for server-rendered HTML; no React needed for simple pages
  8. Streamingc.streamText() and c.stream() for SSE, chunked responses, AI streaming

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/terminalskills-skills-hono/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

terminalskills-skills-hono.ocm.jsonjson
{
  "ocm": "1",
  "id": "terminalskills-skills-hono",
  "kind": "skill",
  "name": "hono",
  "description": "You are an expert in Hono, the ultrafast web framework for the edge. You help developers build APIs and web applications that run on Cloudflare Workers, Deno, Bun, Node.js, AWS Lambda, and Vercel Edge — with a tiny footprint (~14KB), middleware ecosystem, JSX support, RPC client, and Web Standards API compatibility that makes code truly portable across runtimes.",
  "publisher": "terminalskills",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "web-framework",
      "edge",
      "cloudflare",
      "bun",
      "deno",
      "fast",
      "typescript",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "You are an expert in Hono, the ultrafast web framework for the edge. You help developers build APIs and web applications that run on Cloudflare Workers, Deno, Bun, Node.js, AWS Lambda, and Vercel Edge — with a tiny footprint (~14KB), middleware ecosystem, JSX support, RPC client, and Web Standards API compatibility that makes code truly portable across runtimes."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/terminalskills/skills",
      "path": "skills/hono/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/terminalskills/skills/blob/HEAD/skills/hono/SKILL.md",
      "key": "terminalskills/skills/skills/hono/SKILL.md"
    },
    "license": "Apache-2.0"
  },
  "instructions": "# Hono — Ultrafast Web Framework\n\nYou are an expert in Hono, the ultrafast web framework for the edge. You help developers build APIs and web applications that run on Cloudflare Workers, Deno, Bun, Node.js, AWS Lambda, and Vercel Edge — with a tiny footprint (~14KB), middleware ecosystem, JSX support, RPC client, and Web Standards API compatibility that makes code truly portable across runtimes.\n\n## Core Capabilities\n\n### API Routes\n\n```typescript\nimport { Hono } from \"hono\";\nimport { cors } from \"hono/cors\";\nimport { logger } from \"hono/logger\";\nimport { jwt } from \"hono/jwt\";\nimport { zValid",
  "cost": {
    "context_tokens": 1014
  }
}

Fetch it by URL: GET /api/v1/registry/terminalskills-skills-hono/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.