A starter template for building fully documented type-safe JSON APIs with Hono and Open API. forked from hono-open-api-starter
For a cloudflare specific template, see the cloudflare branch on this repo and the cloudflare-drizzle-v0.35 branch
For other deployment examples see the hono-node-deployment-examples repo
- Structured logging with pino / hono-pino
- Documented / type-safe routes with @hono/zod-openapi
- Interactive API documentation with scalar / @scalar/hono-api-reference
- JSend standard response schema jsend
- Type-safe schemas and environment variables with zod
- Single source of truth database schemas with drizzle and drizzle-zod
- Testing with vitest
- Sensible editor, formatting and linting settings with @antfu/eslint-config
Clone this template without git history
npx degit hi-reeve/hono-open-api-starter my-api
cd my-api
Create .env
file
cp .env.example .env
Install dependencies
pnpm install
Create postgres db / push schema
pnpm drizzle-kit push
Run
pnpm dev
Lint
pnpm lint
Test
pnpm test
Base hono app exported from app.ts. Local development uses @hono/node-server defined in index.ts - update this file or create a new entry point to use your preferred runtime.
Typesafe env defined in env.ts - add any other required environment variables here. The application will not start if any required environment variables are missing
All app routes are grouped together and exported into single type as AppType
in app.ts for use in RPC / hono/client.
Path | Description |
---|---|
GET /docs | Open API Specification |
GET /references | Scalar API Documentation |
GET / | Api Welcome Index |