hono-routing

Build type-safe Hono APIs for Cloudflare Workers, Deno, Bun, and Node.js.

3|1|Updated Jun 3, 2025
One-click install
npx skills add https://github.com/Tobbe3108/GoPayShortcuts --skill hono-routing-tobbe3108
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hono-routing
Source: https://github.com/Tobbe3108/GoPayShortcuts/tree/main/.opencode/skills/hono-routing
Command: npx skills add https://github.com/Tobbe3108/GoPayShortcuts --skill hono-routing-tobbe3108

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Hono API development across multiple runtimes can be error-prone without clear patterns for routing, validation, middleware, and RPC type sharing. This skill provides production-ready patterns and guidance to create type-safe APIs across Cloudflare Workers, Deno, Bun, and Node.js.

Core Features & Use Cases

  • Routing and middleware chains with Hono that are type-safe across runtimes.
  • Validation patterns using Zod/Valibot (and other validators) with per-handler inference.
  • RPC (type-safe client/server) with exported route types for IDE-friendly integration.
  • Streaming endpoints (SSE) and WebSocket support, plus security middlewares (CSRF, secure headers).
  • Examples and templates for common use cases like API routes, sub-apps, and error handling.

Quick Start

Install dependencies and start building a Hono-based API. Use the provided patterns to export a route, create an RPC client type, and implement a minimal protected endpoint.

Frequently Asked Questions about hono-routing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build type-safe Hono APIs across Cloudflare Workers, Deno, and Bun?

Type-safe Hono APIs are built using production-ready patterns for routing, validation, and middleware composition that work uniformly across Cloudflare Workers, Deno, Bun, and Node.js. The Skill enforces per-route validation and exports RPC types for IDE-friendly integration.

How does Hono RPC type sharing work for client-server integration?

Hono RPC type sharing works by exporting route types from the server, allowing the client to automatically infer request and response schemas. This provides end-to-end type safety and IDE autocomplete without manual type definitions.

Can I use Zod or Valibot for per-route validation in Hono?

Yes, you can use Zod, Valibot, or other validators for per-route validation in Hono. The Skill provides validation patterns that ensure per-handler type inference, keeping incoming request data strictly typed across all endpoints.

What is the best way to structure middleware and error handling in Hono?

The best way to structure middleware and error handling in Hono is by following centralized error handling guidance and middleware composition rules. This ensures security middlewares like CSRF and secure headers are applied consistently across sub-apps and routes.

Does Hono support WebSocket and streaming endpoints like SSE?

Yes, Hono supports WebSocket and streaming endpoints like Server-Sent Events (SSE). The Skill provides implementation patterns for these real-time communication use cases across supported runtimes.

Why does my Hono API lose type inference when splitting routes into sub-apps?

Hono APIs lose type inference when sub-apps are not properly typed or route types are not exported correctly. Applying the Skill's RPC type export rules and middleware composition patterns restores strict type safety across modular route structures.