Hono API

Structure Hono APIs with separated routes, services, middleware, and Zod validation.

1|Updated May 2, 2026
One-click install
npx skills add https://github.com/Levironexe/architect --skill hono-api-levironexe
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: Hono API
Source: https://github.com/Levironexe/architect/tree/main/skills/stacks/hono-api
Command: npx skills add https://github.com/Levironexe/architect --skill hono-api-levironexe

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires hono, zod.

What problem does it solve?

Projects built with Hono can drift into inconsistent route structure, mixed responsibilities, ad-hoc validation, and unsafe refactors that break edge compatibility or error handling contracts.

Core Features & Use Cases

  • Request validation with Zod: Enforce typed, schema-validated inputs at the route boundary using @hono/zod-validator rather than trusting raw request JSON.
  • Separation of concerns: Keep routing in src/routes, platform-agnostic business logic in src/services, and cross-cutting concerns (auth, CORS, error handling) in src/middleware to support safe phased refactoring.
  • Edge-compatible middleware and errors: Centralize consistent JSON error responses with app.onError(), implement auth guard middleware, and avoid Node-only APIs so the same code works across Cloudflare Workers, Node.js, and Bun.

Quick Start

Ask your agent to restructure the codebase to match the Hono API skill: create src/routes, src/services, src/middleware, move business logic out of handlers, add zValidator-based Zod validation, and implement a global app.onError() that returns consistent JSON using HTTPException.

Frequently Asked Questions about Hono API

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

FAQPage Schema
How do I structure a Hono API for safe refactoring and edge compatibility?▼

Structure a Hono API by separating routing in src/routes, platform-agnostic business logic in src/services, and cross-cutting concerns like auth in src/middleware. This separation supports safe phased refactoring and ensures edge compatibility across Cloudflare Workers, Node.js, and Bun.

What is the best way to validate request inputs in a Hono application?▼

The best way to validate request inputs in a Hono application is using @hono/zod-validator at the route boundary. This enforces typed, schema-validated inputs under src/schemas rather than trusting raw request JSON, ensuring data integrity.

How does centralized error handling work with Hono across different runtimes?▼

Centralized error handling in Hono works by implementing app.onError() to return consistent JSON responses using HTTPException. This approach avoids Node-only APIs, ensuring uniform error handling across edge and Node-like runtimes.

Can I use Node APIs like process or fs inside Hono route handlers?▼

No, you should avoid Node-only APIs like process or fs inside Hono route handlers to maintain edge compatibility. Business logic must be platform-agnostic inside src/services, ensuring the same code works across Cloudflare Workers and Bun.

Do I need Zod to implement schema validation for Hono APIs?▼

Yes, Zod is required to implement schema validation for Hono APIs in this architecture. You define schemas under src/schemas and apply them via zValidator to enforce typed inputs at the route boundary.

Why does my Hono API architecture have mixed responsibilities and ad-hoc validation?▼

Hono API architecture drifts into mixed responsibilities and ad-hoc validation without enforced separation. Establishing src/routes, src/services, and src/middleware directories centralizes validation and cross-cutting concerns, preventing inconsistent route structure.