Webhooks.Type-safe. Local-first.
Two tools, one goal: make webhook development delightful. A CLI to capture, replay, and test webhooks locally. An SDK for type-safe handlers with automatic signature verification.
Quick Install
$ npm install -g @better-webhook/cli1import { github } from "@better-webhook/github";2import { toNextJS } from "@better-webhook/nextjs";34const webhook = github()5 .event("push", async (payload) => {6 // Fully typed payload7 console.log(payload.repository.name);8 console.log(payload.commits.length);9 })10 .event("pull_request", async (payload) => {11 if (payload.action === "opened") {12 await notifyTeam(payload.pull_request);13 }14 });1516export const POST = toNextJS(webhook);Everything for webhook development
A complete toolkit that makes working with webhooks fast, repeatable, and delightful. From local development to production.
Live Capture
Start a local server to capture incoming webhooks. View payloads in real-time via WebSocket.
Smart Replay
Replay captured webhooks to any endpoint with full header preservation. Test handlers without re-triggering events.
Signature Verification
Automatic HMAC signature verification for GitHub and Ragie. Timing-safe comparison prevents attacks.
Type-Safe Handlers
Full TypeScript support with Zod schemas. Get autocomplete for every event payload property.
Dashboard UI
Beautiful local dashboard to view captures, manage templates, and replay webhooks with a visual interface.
Framework Adapters
First-class integrations for Next.js, Express, NestJS, and GCP Cloud Functions.
Auto Signatures
CLI generates valid signatures when running templates. Test signature verification without manual setup.
Community Templates
Download and run webhook templates for GitHub and Ragie. Real payloads ready to use instantly.
Capture. Replay. Test.
A powerful CLI for local webhook development. Capture real webhooks, replay them on demand, and test your handlers without triggering external events.
Capture
Start a local server to intercept and store incoming webhooks
better-webhook captureReplay
Re-send captured webhooks to any endpoint with full headers
better-webhook replay <id> <url>Templates
Download and run community templates for GitHub, Ragie, and more
better-webhook templates listDashboard
Visual UI to manage captures, templates, and replay webhooks
better-webhook dashboardInstall globally with npm
$ npm install -g @better-webhook/cliType-safe. Verified. Simple.
Build webhook handlers with full TypeScript support, automatic signature verification, and Zod schema validation. Works with your favorite framework.
Signature Verification
Automatic HMAC signature verification for all supported providers. Timing-safe comparison to prevent attacks.
Type-Safe Handlers
Full TypeScript support with Zod schemas. Get autocomplete for every event payload property.
Framework Adapters
First-class support for Next.js, Express, NestJS, and GCP Cloud Functions.
$ npm install @better-webhook/github @better-webhook/nextjsimport { github } from "@better-webhook/github";
import { toNextJS } from "@better-webhook/nextjs";
const webhook = github()
.event("push", async (payload) => {
// Fully typed - payload.repository, payload.commits, etc.
console.log(`Push to ${payload.repository.name}`);
console.log(`${payload.commits.length} commits`);
})
.event("pull_request", async (payload) => {
if (payload.action === "opened") {
console.log(`New PR: ${payload.pull_request.title}`);
}
})
.onError((error, context) => {
console.error(`Error in ${context.eventType}`, error);
});
export const POST = toNextJS(webhook);Available Providers
GitHub
@better-webhook/githubRagie
@better-webhook/ragieSee the difference
Compare traditional webhook handling with better-webhook. Less code, more safety, zero headaches.
1// The better-webhook way - type-safe and secure23import { github } from "@better-webhook/github";4import { toExpress } from "@better-webhook/express";56const webhook = github()7 .event("push", async (payload) => {8 // Full autocomplete and type safety!9 console.log(payload.repository.name);10 console.log(payload.commits.length);11 12 for (const commit of payload.commits) {13 console.log(commit.message);14 }15 })16 .onError((error, context) => {17 logger.error(`Failed: ${context.eventType}`, error);18 });1920app.post('/webhooks/github',21 express.raw({ type: 'application/json' }),22 toExpress(webhook)23);What changes
Webhook Providers
Pre-built providers with automatic signature verification and fully typed payloads. Create custom providers for any webhook source.
GitHub
Ragie
Stripe
Clerk
Resend
Custom
GitHub
@better-webhook/githubSupported Events
Ragie
@better-webhook/ragieSupported Events
Need a different provider? Create custom webhooks with the core package.
Learn about custom providersGet started in minutes
Choose how you want to work with webhooks - capture and replay with the CLI, or build type-safe handlers with the SDK.
Install the CLI
$ npm install -g @better-webhook/cliStart the dashboard
$ better-webhook dashboardOpens a local UI at http://localhost:4000 with capture server at port 3001
Point webhooks to capture server
$ http://localhost:3001/webhooks/githubUse this URL in your webhook provider settings (e.g., GitHub webhook URL)
Replay captured webhooks
$ better-webhook replay <capture-id> http://localhost:3000/api/webhooks/githubReplay to your local development server