Skip to content

Quickstart: mount, publish, verify

Standalone (Docker)
Terminal window
docker run -p 3000:3000 -e STORAGE_DRIVER=memory ghcr.io/xantiagoma/xtandard-webhooks
# open http://localhost:3000
CLI (npx / bunx)
Terminal window
bunx @xtandard/webhooks serve # STORAGE_DRIVER=file by default → ./.webhooks
Elysia
import { Elysia } from "elysia";
import { webhooksPanel } from "@xtandard/webhooks/elysia";
import { createMemoryStorage } from "@xtandard/webhooks/storage/memory";
const webhooks = webhooksPanel({ storage: createMemoryStorage() });
new Elysia().mount("/webhooks", webhooks).listen(3000);
Hono
import { Hono } from "hono";
import { webhooksPanel } from "@xtandard/webhooks/hono";
import { createMemoryStorage } from "@xtandard/webhooks/storage/memory";
const app = new Hono();
app.route("/webhooks", webhooksPanel({ storage: createMemoryStorage() }));
Express
import express from "express";
import { webhooksPanel } from "@xtandard/webhooks/express";
import { createMemoryStorage } from "@xtandard/webhooks/storage/memory";
const app = express();
app.use("/webhooks", webhooksPanel({ storage: createMemoryStorage() })); // before body-parser
app.listen(3000);
Bun
import { webhooksPanel } from "@xtandard/webhooks/bun";
import { createMemoryStorage } from "@xtandard/webhooks/storage/memory";
const webhooks = webhooksPanel({ storage: createMemoryStorage(), basePath: "/webhooks" });
Bun.serve({ port: 3000, fetch: webhooks.fetch });

Mounting the panel starts an in-process dispatcher by default (dispatcher: false for split-worker deployments).

const { core } = webhooks;
await core.createApplication({ key: "acme" }); // your customer
await core.upsertEventType({ name: "invoice.paid" }); // the catalog
await core.createEndpoint("acme", {
url: "https://api.acme-customer.com/webhooks", // their receiver
eventTypes: ["invoice.paid"],
});
// The hot path — in the handler where the thing actually happens:
await core.publish("acme", {
eventType: "invoice.paid",
payload: { invoiceId: "inv_123", amount: 4200 },
idempotencyKey: `invoice-paid-inv_123`, // safe to call twice
});

TypeScript (this package, zero deps, any WinterCG runtime):

import { verifyWebhook } from "@xtandard/webhooks/receiver";
export default async function handler(request: Request) {
const event = await verifyWebhook(request, process.env.WEBHOOK_SECRET!); // throws if invalid
// event.type === "invoice.paid", event.data === { invoiceId, amount }
return new Response("ok");
}

Python / Go / anything — the official Standard Webhooks libraries verify deliveries from this package unmodified:

from standardwebhooks.webhooks import Webhook
payload = Webhook(secret).verify(body, headers) # raises on failure

examples/receivers/ runs FastAPI + Go receivers against a live dispatcher as the interop proof. Details: docs/SIGNING.md.