一覧へ戻る
bufferings/hello-zod4-openapi-hono(新しいタブで開きます)
主要言語: TypeScript
- star 数
- 6
- watcher 数
- 0
- fork 数
- 0
- issue 数
- 0
- 最終更新
- 2026/01/12
主要言語: TypeScript
Hono + Zod OpenAPI sample project with Node.js.
This project demonstrates two approaches to define OpenAPI schemas with Zod:
.openapi() from @hono/zod-openapi.meta() from pure zodBoth apps implement the same POST /users endpoint with identical functionality.
# Install tools mise install # Setup corepack and git hooks mise run setup # Install dependencies pnpm install
# Start development servers pnpm start1 # Port 8000 pnpm start2 # Port 8001 # Compare OpenAPI docs pnpm compare # Format code pnpm fmt # Check formatting pnpm fmt:check # Run linter pnpm lint
src/
├── app1/ # Using .openapi() approach
│ ├── usecase.ts # Business logic with Result type
│ ├── handler.ts # Route definitions and handlers
│ ├── app.ts # App setup and OpenAPI docs
│ └── server.ts # Server startup
└── app2/ # Using .meta() approach
├── usecase.ts # Business logic with Result type
├── handler.ts # Route definitions and handlers
├── app.ts # App setup and OpenAPI docs
└── server.ts # Server startup
.openapi({ description: "..." }) from @hono/zod-openapiimport { z } from "@hono/zod-openapi".meta({ description: "..." }) from pure zodimport { z } from "zod"Both approaches result in the same OpenAPI document.