Webhook Development Toolkit

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/cli
app/api/webhooks/github/route.ts
1import { github } from "@better-webhook/github";
2import { toNextJS } from "@better-webhook/nextjs";
3
4const webhook = github()
5 .event("push", async (payload) => {
6 // Fully typed payload
7 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 });
15
16export const POST = toNextJS(webhook);
2
Providers
4
Adapters
100%
Type-safe

Everything for webhook development

A complete toolkit that makes working with webhooks fast, repeatable, and delightful. From local development to production.

CLI

Live Capture

Start a local server to capture incoming webhooks. View payloads in real-time via WebSocket.

CLI

Smart Replay

Replay captured webhooks to any endpoint with full header preservation. Test handlers without re-triggering events.

SDK

Signature Verification

Automatic HMAC signature verification for GitHub and Ragie. Timing-safe comparison prevents attacks.

SDK

Type-Safe Handlers

Full TypeScript support with Zod schemas. Get autocomplete for every event payload property.

CLI

Dashboard UI

Beautiful local dashboard to view captures, manage templates, and replay webhooks with a visual interface.

SDK

Framework Adapters

First-class integrations for Next.js, Express, NestJS, and GCP Cloud Functions.

CLI

Auto Signatures

CLI generates valid signatures when running templates. Test signature verification without manual setup.

CLI

Community Templates

Download and run webhook templates for GitHub and Ragie. Real payloads ready to use instantly.

CLI Tool

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.

Terminal

Capture

Start a local server to intercept and store incoming webhooks

better-webhook capture

Replay

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 list

Dashboard

Visual UI to manage captures, templates, and replay webhooks

better-webhook dashboard

Install globally with npm

$ npm install -g @better-webhook/cli
SDK Packages

Type-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/nextjs
app/api/webhooks/github/route.ts
import { 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

G

GitHub

@better-webhook/github
pushpull_requestissuesinstallation+1 more
R

Ragie

@better-webhook/ragie
document_status_updateddocument_deletedentity_extractedconnection_sync_started+2 more

See the difference

Compare traditional webhook handling with better-webhook. Less code, more safety, zero headaches.

route.tsbetter-webhook
1// The better-webhook way - type-safe and secure
2
3import { github } from "@better-webhook/github";
4import { toExpress } from "@better-webhook/express";
5
6const 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 });
19
20app.post('/webhooks/github',
21 express.raw({ type: 'application/json' }),
22 toExpress(webhook)
23);

What changes

Automatic signature verification
Full type inference with Zod
Schema-validated payloads
Built-in error hooks
~15 lines of code
50%
Less code

Webhook Providers

Pre-built providers with automatic signature verification and fully typed payloads. Create custom providers for any webhook source.

G

GitHub

R

Ragie

S

Stripe

C

Clerk

R

Resend

+

Custom

G

GitHub

@better-webhook/github

Supported Events

pushpull_requestissuesinstallationinstallation_repositories
R

Ragie

@better-webhook/ragie

Supported Events

document_status_updatedconnection_sync_finishedentity_extracted

Need a different provider? Create custom webhooks with the core package.

Learn about custom providers

Get 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.

1

Install the CLI

$ npm install -g @better-webhook/cli
2

Start the dashboard

$ better-webhook dashboard

Opens a local UI at http://localhost:4000 with capture server at port 3001

3

Point webhooks to capture server

$ http://localhost:3001/webhooks/github

Use this URL in your webhook provider settings (e.g., GitHub webhook URL)

4

Replay captured webhooks

$ better-webhook replay <capture-id> http://localhost:3000/api/webhooks/github

Replay to your local development server