Docs/Get started
Type-safe webhooks for TypeScript
Send, store and verify webhooks in the Standard Webhooks format.
Define events as schemas. send() validates the data and delivers it, signed, to each subscriber.
webhooks.ts
import { webhooks } from "@typedhook/sdk";
import { z } from "zod"; // or valibot, arktype
export const wh = webhooks({
events: {
"invoice.paid": z.object({ invoiceId: z.string(), amountCents: z.number() }),
},
subscribers: async ({ event, subject }) => db.findSubscribers(event, subject),
signing: { secret: process.env.WEBHOOK_SECRET! },
});
const result = await wh.send({
event: "invoice.paid",
subject: "acct_42",
data: { invoiceId: "inv_1", amountCents: 4200 },
});
if (!result.ok) console.error(result.error);Features
01
Typed events
Use zod, valibot or arktype. The event name types data.
02
Transactional outbox
Events are saved in your transaction and retried by a worker.
03
Zero-dependency verifier
Runs on Node 20+, Bun, Deno, Workers and edge.
04
Typed payloads
Export EventUnion. Receivers import it as a type.
Read next
Edit on GitHubLast updated on October 14, 2026