Signed, retried, replayable webhooks.

Publish typed events from your TypeScript app. Good Webhooks stores them in your PostgreSQL database and delivers them as signed Standard Webhooks requests, with retries and a record of every attempt.

$ npm install good-webhooks

import { createWebhooks } from 'good-webhooks'
import { z } from 'zod'

const webhooks = createWebhooks({
  database: pool, // pg.Pool
  encryptionKey: process.env.WEBHOOK_ENCRYPTION_KEY,
  events: {
    'invoice.paid': z.object({
      invoiceId: z.string(),
      amount: z.number().int(),
    }),
  },
})

// Register the endpoint that receives them.
const { secret } = await webhooks.endpoints.create({
  url: 'https://receiver.example/webhooks',
  eventTypes: ['invoice.paid'],
})

// Publish a typed event, in your transaction.
await webhooks.publish({
  type: 'invoice.paid',
  data: { invoiceId: 'inv_123', amount: 4200 },
})

// A worker you run signs, sends, and retries.
await webhooks.worker.run({ signal })
  1. Publishpublish() validates a typed event and finds subscribed endpoints.
  2. StoreThe event and its deliveries commit with your own data.
  3. DeliverYour worker signs, sends, retries, and records every attempt.
  4. VerifyparseWebhook() checks the signature and returns a typed event.

Publish on your side. Verify on theirs.

The client validates the payload against your schema and records the event inside your transaction. The receiver imports only the verify module and checks the signature in one call.

Sender · your app

webhooks.ts
import { createWebhooks } from 'good-webhooks'
import { z } from 'zod'

export const webhooks = createWebhooks({
  database: pool, // pg.Pool
  encryptionKey: process.env.WEBHOOK_ENCRYPTION_KEY,
  events: {
    'invoice.paid': z.object({
      invoiceId: z.string(),
      amount: z.number().int(),
    }),
  },
})

// Inside the transaction that marks the invoice paid.
await webhooks.publish(
  {
    type: 'invoice.paid',
    data: { invoiceId: 'inv_123', amount: 4200 },
  },
  { transaction: client },
)

Receiver · their endpoint

app/webhooks/route.ts
import { parseWebhook, WebhookError } from 'good-webhooks/verify'
import { events } from './events'

export async function POST(request: Request) {
  try {
    const event = await parseWebhook({
      body: new Uint8Array(await request.arrayBuffer()),
      headers: request.headers,
      secret: process.env.WEBHOOK_SECRET!,
      events,
    })
    // Check event.type; then event.data is typed.
    return new Response(null, { status: 204 })
  } catch (error) {
    if (error instanceof WebhookError) {
      return new Response('Invalid webhook', { status: 400 })
    }
    throw error // 500: the sender retries.
  }
}

What a webhook request looks like

A plain HTTPS POST, signed over the exact body bytes and a timestamp. Any Standard Webhooks library can verify it. Pick a header to see what it covers.

Signed requestHow to verify it
  1. POST /webhooks HTTP/1.1
  2. Host:receiver.example
  3. Content-Type:application/json
  4. webhook-id:7a0c3f3e-5b2c-4f8e-9d1a-2e6b8c4d9f10
  5. webhook-timestamp:1760000000
  6. webhook-signature:v1,K5oZfzN95Z9UVu1EsfQmfVNQhnkZ2pj6D2hFcTjqRVo=
  7. {
  8. "id": "7a0c3f3e-5b2c-4f8e-9d1a-2e6b8c4d9f10",
  9. "type": "invoice.paid",
  10. "occurredAt": "2026-10-09T09:46:40.000Z",
  11. "data": { "invoiceId": "inv_123", "amount": 4200 }
  12. }

webhook-signature = v1, base64( HMAC-SHA256( secret, id.timestamp.body ) )

What you get

The parts of delivery that are tedious to get right, done once and tested.

  • Typed events

    Any Standard Schema validator. The publisher rejects bad payloads; the receiver decodes into the same types.

  • Standard Webhooks signing

    webhook-id, webhook-timestamp, and an HMAC-SHA256 signature on every request. Any compliant verifier works.

  • Transactional publish

    Pass your open PostgreSQL client. If the business write rolls back, the event never existed.

  • Retries and replay

    Bounded retries that honor Retry-After, every attempt recorded, and failing endpoints paused, never deleted.

  • Better Auth plugin

    Users manage their own endpoints through authenticated routes, with organization permissions.

  • Bring your own sender

    A two-method EndpointSource contract feeds an existing pipeline with recipients and secrets.

  • Safe destinations

    URLs validated at registration, addresses re-resolved and pinned per connection, no redirects.

  • Nothing implicit

    No connections, migrations, or workers start on their own. You own the pool and the process.

Pick a setup

Endpoint management and delivery are separate pieces. Take both, or just the one you are missing.

Run a complete application

Two applications in the repository install the published package and show the full path from a business action to a verified webhook. Copy either one into your own project, or receive signed webhooks right away in the hosted Playground.

Start here

  1. What it isThe model, the code, and what you still decide.
  2. Try itOne file sends a signed webhook to a local receiver.
  3. Add it to your appInstall, create the tables, publish, and run a worker.
  4. Go to productionKeys, workers, cleanup, receivers, and upgrades.

Send your first signed webhook in five minutes.

One file publishes an event and a local receiver verifies it. Nothing to sign up for.