DEV Community

Mubashir Taj
Mubashir Taj

Posted on Originally published at mubashirtaj.dev

HookForge: An Open-Source Webhook Engine Written in Go

Originally published on my blog: https://mubashirtaj.dev/blog/hookforge-open-source-webhook-engine-go

Every growing product hits the same wall. A payment succeeds, and suddenly five different services need to know about it: billing, email, analytics, fulfillment, and the customer's dashboard. If the main app calls each one directly, it ends up coupled to every downstream service, and a failure in any of them becomes the main app's problem.

That is the problem webhooks solve, and it is why I built HookForge: an open-source webhook event router written in Go. Your app sends an event to HookForge once. HookForge stores it, signs it, and delivers it to every active endpoint subscribed to that event type, with retries, rate limits, and a dashboard to watch it all happen.

HookForge is open source under MubiLabs. The code is on GitHub and the image is on Docker Hub as mubilabs/hookforge.

How an event flows through HookForge

The flow is deliberately simple:

  1. Create a project in the dashboard and copy its API key. The key is shown once; only its SHA-256 hash is stored.
  2. Add one or more endpoint URLs to the project, with the event types each one wants, such as payment.succeeded, or * for everything.
  3. Your app sends the event to POST /v1/events with the project API key.
  4. HookForge stores the event with its original JSON payload and creates one pending delivery job for every active matching endpoint.
  5. A fixed pool of five workers processes jobs from a bounded queue. A 2xx response marks the job as a success. Failures are retried with exponential backoff and eventually marked dead.
curl -X POST http://localhost:8080/v1/events \
  -H 'Authorization: Bearer YOUR_PROJECT_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"event_type":"payment.succeeded","payload":{"payment_id":"pay_123","amount":42}}'
Enter fullscreen mode Exit fullscreen mode

An accepted request returns 202 Accepted with an event ID and the number of delivery jobs created.

Built for the failure cases

Sending a webhook is easy. Delivering it reliably, without taking your own service down, is the real work. HookForge focuses on that part:

  • Signed deliveries. Every delivery carries an X-Webhook-Signature header with an HMAC-SHA256 signature of the raw request body, so receivers can verify the event actually came from HookForge.
  • Exponential retries. Failed deliveries retry after 20, 40, 80, and 160 seconds. The fifth failed attempt becomes a dead-letter job instead of retrying forever.
  • Backpressure by design. The delivery queue is bounded at 100 jobs with five workers, and each project is rate limited to 60 events per minute with a burst of 20. Request bodies are capped at 1 MiB.
  • Safe outbound requests. Endpoints must resolve to public IP addresses. Localhost and private network targets are blocked, and redirects are never followed, which closes the usual SSRF holes in webhook systems.
  • At-least-once delivery. If the process stops mid-request, the delivery is retried after restart rather than lost.

The dashboard

HookForge ships with a dashboard for managing projects and endpoints and for inspecting recent events and delivery jobs. From a project page you can edit or delete endpoints, watch deliveries succeed or fail in real time, and manually re-send a job with its retry counter reset.

The screenshots on the original post are from my own workspace, where a project routes payment events from a production site into HookForge.

Running it

The fastest way to try HookForge is Docker Compose:

docker compose up -d --build
docker compose logs -f webhook-engine
Enter fullscreen mode Exit fullscreen mode

Then open http://localhost:8080/login. Data lives in SQLite inside a named Docker volume, so restarts do not lose your projects or events. The production image is a multi-stage build: Go compiles a static binary, and the final image is distroless, running as a non-root user with no shell or package manager inside.

To run it from source instead, you need Go 1.27.4 or newer:

go test ./...
go run ./cmd/server
Enter fullscreen mode Exit fullscreen mode

Why Go

A webhook engine is mostly concurrent network work: accepting events, fanning them out, and running many deliveries in parallel without letting one slow endpoint block the rest. Go fits that shape well. The bounded queue and fixed worker pool keep memory predictable, and the whole system ships as a single static binary, which keeps the Docker image small and the deployment boring. Boring is a compliment for infrastructure.

Try it and contribute

HookForge is open source and ready to self-host. Clone it, run the Compose stack, send your first event, and watch it land in the dashboard:

github.com/Mubashirtaj/hookforge

Issues, ideas, and pull requests are welcome. If you run webhooks in production and something in your setup hurts, I would like to hear about it.

Top comments (0)