Quickstart: mount, publish, verify
Quickstart
Section titled “Quickstart”Standalone (Docker)
docker run -p 3000:3000 -e STORAGE_DRIVER=memory ghcr.io/xantiagoma/xtandard-webhooks# open http://localhost:3000CLI (npx / bunx)
bunx @xtandard/webhooks serve # STORAGE_DRIVER=file by default → ./.webhooksElysia
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-parserapp.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).
Send your first webhook
Section titled “Send your first webhook”const { core } = webhooks;
await core.createApplication({ key: "acme" }); // your customerawait core.upsertEventType({ name: "invoice.paid" }); // the catalogawait 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});Verify on the receiving side
Section titled “Verify on the receiving side”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 Webhookpayload = Webhook(secret).verify(body, headers) # raises on failureexamples/receivers/ runs FastAPI + Go receivers against a live dispatcher as the interop proof. Details: docs/SIGNING.md.