hono-apilisted
Install: claude install-skill whimzyLive/nightshift-ai
# Hono REST API — Composable Architecture
A scalable structure for Hono APIs using `@hono/zod-openapi`: routes are schema-first, business
logic lives in a class-based service layer, and the OpenAPI document is generated from the route
definitions — never written by hand.
## Core principle
Routes are **schema-first**: declare the request/response shape with Zod via `createRoute`, then write
the handler. `c.req.valid(...)` returns typed, validated input, and the OpenAPI spec is derived from
the same definitions.
## Folder structure
Group by **feature**, co-locate each route/service with its own schema, and keep one source root:
```
src/
├── app.ts # OpenAPIHono root — mounts routers + docs + error handler
├── index.ts # runtime entry (server / serverless adapter)
├── routes/
│ └── health/
│ ├── route.ts # createRoute + handler
│ └── schema.ts # Zod schemas for this route only
└── services/
└── orders/
├── service.interface.ts # the contract
├── service.ts # class implements the interface
└── schema.ts # Zod schemas for this service only
```
Rules:
- **Group by feature** — each route and service gets its own directory; files are `route.ts` /
`schema.ts` / `service.ts` (no repeated prefix — the directory name gives context).
- **Schema co-location** — a `schema.ts` lives in the same directory as its `route.ts` / `service.ts`.
Only cross-cuttin