Skip to main content

Build Type-Safe APIs with Hono and OpenAPI

A production-ready starter template that combines Hono’s blazing-fast performance with full OpenAPI documentation, automatic type safety, and interactive API exploration.

Everything you need to build production APIs

This starter template includes best practices, modern tooling, and complete type safety from database to API response.

Type-Safe Routes

Full type safety with Hono and Zod OpenAPI from request to response

Auto Documentation

Interactive API docs generated automatically with Scalar

Database Integration

Type-safe database schemas with Drizzle ORM and SQLite

Built-in Validation

Request and response validation with Zod schemas

Structured Logging

Production-ready logging with Pino and request tracing

Testing Setup

Complete testing infrastructure with Vitest

Quick start

Get up and running in minutes with this production-ready template

1

Clone the template

Use degit to clone the template without git history:
npx degit w3cj/hono-open-api-starter my-api
cd my-api
2

Install dependencies and configure

Install dependencies and set up your environment:
npm install
cp .env.example .env
3

Initialize the database

Create your SQLite database and push the schema:
pnpm drizzle-kit push
4

Start the development server

Run the development server with hot reload:
pnpm dev
Your API is now running at http://localhost:3000
  • GET /doc - OpenAPI specification (JSON)
  • GET /reference - Interactive Scalar API documentation
  • GET /tasks - List all tasks
  • POST /tasks - Create a new task
  • GET /tasks/:id - Get a task by ID
  • PATCH /tasks/:id - Update a task
  • DELETE /tasks/:id - Delete a task

Ready to build your API?

Start building production-ready, type-safe APIs with automatic documentation and modern best practices.

Get Started Now