Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

chanfana

> 编程语言
Open source

OpenAPI 3 and 3.1 schema generator and validator for Hono, itty-router and more!

760 stars0 likes0 views
WebsiteGitHub

About

OpenAPI 3 and 3.1 schema generator and validator for Hono, itty-router and more!

OpenAPI 3 and 3.1 schema generator and validator for Hono, itty-router and more!

Documentation: chanfana.pages.dev

Source Code: github.com/cloudflare/chanfana

Overview

chanfana (previously known as itty-router-openapi) is a library that adds OpenAPI schema generation and validation to any router ( Hono, itty-router, etc), meant to be a powerful and lightweight library for Cloudflare Workers but runs on any runtime supported by the base router.

The key features are:

  • OpenAPI 3 and 3.1 schema generator and validator
  • Zod v4 compatible with full TypeScript inference
  • Fully written in typescript
  • Class-based endpoints
  • Query, Path, Headers, and Body typescript inference, see Parameters and Request Validation
  • Extend existing Hono, itty-router, etc application, without touching old routes
  • CLI to extract the schema.json from your code (npx chanfana) - see CLI Documentation

AI Skills

Chanfana provides AI coding assistant skills to help you build OpenAPI endpoints faster. Install them using npx skills:

bash
npx skills install cloudflare/chanfana

Available skills:

  • write-endpoints - Comprehensive guide for building OpenAPI endpoints with schema definition, request validation, CRUD operations, and D1 integration

Getting started

Or scaffold it locally with the create-cloudflare CLI:

bash
npm create cloudflare@latest -- --template https://github.com/cloudflare/chanfana/tree/main/template

The template includes a complete Task API with Hono, D1, and Zod v4 — full CRUD endpoints, a custom endpoint example, integration tests, and auto-generated docs at /api/docs.

See template/README.md for full setup instructions.

Installation

bash
npm i chanfana --save

Command-Line Interface (CLI)

Chanfana includes a CLI tool to help you extract the OpenAPI schema from your Cloudflare Worker project. This is useful for generating a static schema file, for example, in CI/CD pipelines.

The basic command is:

bash
npx chanfana

This will start your worker using wrangler dev, fetch the schema from /openapi.json, and save it to schema.json.

For more details on options and usage, please refer to the CLI Documentation.

Minimal Hono Example

…

Feedback and contributions

chanfana aims to be at the core of new APIs built using Workers and define a pattern to allow everyone to have an OpenAPI-compliant schema without worrying about implementation details or reinventing the wheel.

chanfana is considered stable and production ready and is being used with the Radar 2.0 public API and many other Cloudflare products.

You can also talk to us in the Cloudflare Community or the Radar Discord Channel

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptapicloudflarecloudflare-workershono

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言