Kotodayori
A Hono-inspired, type-safe webhook routing library for TypeScript
Kotodayori provides a clean, type-safe API for handling webhooks from any event source. It features a modular architecture with adapters for popular frameworks and platforms, and a pluggable verifier system for signature validation.
Features
Section titled “Features”- Type-Safe — Full TypeScript support with generic event type definitions
- Framework Adapters — Built-in support for Hono, Express, AWS Lambda, and EventBridge
- Pluggable Verification — Bring your own verifier for any webhook provider
- Middleware Support — Add cross-cutting concerns with middleware
- Flexible Routing — Group handlers, mount nested routers, and fanout patterns
- Stripe Support — First-class support for 351+ Stripe event types
Quick Start
Section titled “Quick Start”The fastest way to get started is using the scaffolding tool:
npx create-kotodayoriOr install and use with Stripe and Hono:
pnpm add @kotodayori/stripe @kotodayori/hono stripeimport { Hono } from 'hono';import Stripe from 'stripe';import { StripeWebhookRouter, createStripeVerifier } from '@kotodayori/stripe';import { honoAdapter } from '@kotodayori/hono';
const stripe = new Stripe(process.env.STRIPE_API_KEY!);const router = new StripeWebhookRouter();
router.on('payment_intent.succeeded', async (event) => { console.log('Payment succeeded:', event.data.object.id);});
const app = new Hono();app.post('/webhook', honoAdapter(router, { verifier: createStripeVerifier(stripe, process.env.STRIPE_WEBHOOK_SECRET!),}));
export default app;Packages
Section titled “Packages”| Package | Description |
|---|---|
@kotodayori/core | Core webhook routing logic and Verifier type |
@kotodayori/stripe | Stripe-specific types, router, and verifier |
@kotodayori/zod | Zod schema validation helpers |
@kotodayori/hono | Hono framework adapter |
@kotodayori/express | Express framework adapter |
@kotodayori/lambda | AWS Lambda adapter |
@kotodayori/eventbridge | AWS EventBridge adapter |
create-kotodayori | Scaffolding tool for new projects |