npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

takibi-hono

v0.0.4

Published

Takibi Hono is a code generator from OpenAPI to hono

Readme

Takibi Hono

OpenAPI to Hono Code Generator

Takibi Hono generates type-safe Hono code from OpenAPI / TypeSpec specifications.

  • OpenAPI schemas to validation schemas (zod | valibot | typebox | arktype | effect)
  • hono-openapi route definitions with describeRoute
  • App entry point + handler stubs with handler merge
  • Component splitting into separate files (schemas, parameters, headers, etc.)
  • Vite plugin for automatic regeneration on spec changes

Install

npm install -D takibi-hono

Setup

Create takibi-hono.config.ts:

Minimal Config

// takibi-hono.config.ts
import { defineConfig } from 'takibi-hono/config'

export default defineConfig({
  input: 'main.tsp',
  schema: 'zod',
})

Full Config

// takibi-hono.config.ts
import { defineConfig } from 'takibi-hono/config'

export default defineConfig({
  // OpenAPI spec file (.yaml, .json, or .tsp)
  input: 'openapi.yaml',

  // Schema library for validation
  schema: 'zod', // "zod" | "valibot" | "typebox" | "arktype" | "effect"

  // Base path prefix for all routes
  basePath: '/api',

  // Enable hono-openapi style output
  // @see https://hono.dev/examples/hono-openapi
  openapi: true,

  // oxfmt FormatOptions for generated code output
  // @see https://www.npmjs.com/package/oxfmt
  // format: {},

  // Code generation options
  'takibi-hono': {
    readonly: true, // Add 'as const' to generated schemas

    // Export type inference from schemas
    exportSchemasTypes: true,
    exportParametersTypes: true,
    exportHeadersTypes: true,

    // Handler stub generation
    handlers: {
      output: './src/handlers', // Output directory for handler files
    },

    // Split components into separate files (OpenAPI Components Object)
    components: {
      output: './src/components', // Single file output for all components

      schemas: {
        output: './src/schemas',
        exportTypes: true,
        split: true,
        import: '../schemas',
      },
      parameters: {
        output: './src/parameters',
        exportTypes: true,
        split: true,
        import: '../parameters',
      },
      headers: {
        output: './src/headers',
        exportTypes: true,
        split: true,
        import: '../headers',
      },
      securitySchemes: {
        output: './src/securitySchemes',
        split: true,
        import: '../securitySchemes',
      },
      requestBodies: {
        output: './src/requestBodies',
        split: true,
        import: '../requestBodies',
      },
      responses: {
        output: './src/responses',
        split: true,
        import: '../responses',
      },
      examples: {
        output: './src/examples',
        split: true,
        import: '../examples',
      },
      links: {
        output: './src/links',
        split: true,
        import: '../links',
      },
      callbacks: {
        output: './src/callbacks',
        split: true,
        import: '../callbacks',
      },
      pathItems: {
        output: './src/pathItems',
        split: true,
        import: '../pathItems',
      },
      webhooks: {
        output: './src/webhooks',
        split: true,
        import: '../webhooks',
      },
    },
  },
})

Usage

CLI

npx takibi-hono

Vite Plugin

// vite.config.ts
import { defineConfig } from 'vite'
import { takibiHonoVite } from 'takibi-hono/vite-plugin'

export default defineConfig({
  plugins: [takibiHonoVite()],
})

The plugin watches your OpenAPI/TypeSpec files and config, automatically regenerating code on changes.

Handler Merge

When regenerating, takibi-hono preserves your hand-written code:

  • Handler bodies (c) => { ... } — your implementation logic is kept
  • User-added imports — only generator-managed imports are updated
  • Non-handler code (helpers, constants, middleware) — left untouched
  • JSDoc comments on routes — restored after regeneration

Route metadata (describeRoute, validators) is updated from the spec. New routes are added with a stub (c) => {}. Deleted routes are removed.

Example

Given a TypeSpec input:

// main.tsp
import "@typespec/http";

using Http;

@service(#{ title: "Takibi Hono API" })
namespace TakibiHonoAPI;

@route("/hono")
interface Hono {
  @summary("Welcome")
  @doc("Returns a welcome message from Takibi Hono.")
  @get welcome(): { message: string };
}

With config:

import { defineConfig } from 'takibi-hono/config'

export default defineConfig({
  input: 'main.tsp',
  schema: 'valibot',
  openapi: true,
})

takibi-hono generates:

// src/handlers/hono.ts
import { Hono } from 'hono'
import { describeRoute, resolver } from 'hono-openapi'
import * as v from 'valibot'

export const honoHandler = new Hono().get(
  '/hono',
  describeRoute({
    description: 'Returns a welcome message from Takibi Hono.',
    summary: 'Welcome',
    operationId: 'Hono_welcome',
    responses: {
      200: {
        description: 'The request has succeeded.',
        content: {
          'application/json': {
            schema: resolver(v.object({ message: v.string() })),
          },
        },
      },
    },
  }),
  (c) => {},
)
// src/index.ts
import { Hono } from 'hono'
import { honoHandler } from './handlers'

const app = new Hono()

export const api = app.route('/', honoHandler)

export default app

You write your logic in the handler body. On the next regeneration, your code is preserved:

(c) => return c.json({ message: 'Takibi Hono🔥' }),

License

Distributed under the MIT License. See LICENSE for more information.