w3cj/hono-open-api-starter

A starter template for building fully documented type-safe JSON APIs with Hono and Open API

TypeScript

1,014

38 commits

updated Oct 31, 2025

See the code

README

Hono Open API Starter

A starter template for building fully documented type-safe JSON APIs with Hono and Open API.

A new version of drizzle was released since the video showing this starter was made. See this commit for the changes required to use drizzle v0.35+

A new version of zod was released since the video showing this starter was made. See this commit for the changes required to use zod v4.

For a cloudflare specific template, see the cloudflare branch on this repo

For other deployment examples see the hono-node-deployment-examples repo

Included

Setup

Clone this template without git history

npx degit w3cj/hono-open-api-starter my-api
cd my-api

Create .env file

cp .env.example .env

Install dependencies

pnpm install

Create sqlite db / push schema

pnpm drizzle-kit push

Run

pnpm dev

Lint

pnpm lint

Test

pnpm test

Code Tour

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

See src/routes/tasks for an example Open API group. Copy this folder / use as an example for your route groups.

All app routes are grouped together and exported into single type as AppType in app.ts for use in RPC / hono/client.

Endpoints

PathDescription
GET /docOpen API Specification
GET /referenceScalar API Documentation
GET /tasksList all tasks
POST /tasksCreate a task
GET /tasks/{id}Get one task by id
PATCH /tasks/{id}Patch one task by id
DELETE /tasks/{id}Delete one task by id

References

drizzle
hono
openapi
scalar
typescript
zod

w3cj/hono-open-api-starter

A starter template for building fully documented type-safe JSON APIs with Hono and Open API

TypeScript

1,014

38 commits

updated Oct 31, 2025

See the code

README

Hono Open API Starter

A starter template for building fully documented type-safe JSON APIs with Hono and Open API.

A new version of drizzle was released since the video showing this starter was made. See this commit for the changes required to use drizzle v0.35+

A new version of zod was released since the video showing this starter was made. See this commit for the changes required to use zod v4.

For a cloudflare specific template, see the cloudflare branch on this repo

For other deployment examples see the hono-node-deployment-examples repo

Included

Setup

Clone this template without git history

npx degit w3cj/hono-open-api-starter my-api
cd my-api

Create .env file

cp .env.example .env

Install dependencies

pnpm install

Create sqlite db / push schema

pnpm drizzle-kit push

Run

pnpm dev

Lint

pnpm lint

Test

pnpm test

Code Tour

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

See src/routes/tasks for an example Open API group. Copy this folder / use as an example for your route groups.

All app routes are grouped together and exported into single type as AppType in app.ts for use in RPC / hono/client.

Endpoints

PathDescription
GET /docOpen API Specification
GET /referenceScalar API Documentation
GET /tasksList all tasks
POST /tasksCreate a task
GET /tasks/{id}Get one task by id
PATCH /tasks/{id}Patch one task by id
DELETE /tasks/{id}Delete one task by id

References

drizzle
hono
openapi
scalar
typescript
zod

Significant stargazers

Frank Hale

101 followers · starred Jan 2025

wayne

234 followers · starred Nov 2024

David Norman

42 followers · starred Jan 2025

Prince Carlo Juguilon

77 followers · starred Oct 2024