Project
hooktrap
Catch, inspect and replay webhooks, built on boxlang-express. A bin is a throwaway URL: anything sent to it, on any method and any path below it, is stored exactly as it arrived and shows up live in the browser with its headers, query and body. Any captured request can be sent again, byte for byte, to your own server. It runs on your machine, so the payloads stay there too.
See what's really sent
Point Stripe, GitHub, Shopify or anything else at a bin before writing a handler, and read the real headers, signature and payload instead of the docs' example.
Replay, exactly
Send a captured request to your local handler as often as it takes. Bodies are kept as the exact bytes received, so an HMAC signature over the body still verifies.
Live in the browser
Requests arrive over Server-Sent Events as they're captured. JSON is pretty-printed, and a body that isn't text is shown as base64.
Safe by default
Replay only reaches loopback hosts unless you allow others, bodies are capped, and idle bins are removed after a day.
Run it
bashgit clone https://github.com/robertz/hooktrap.git
cd hooktrap
box install boxlang-express --local
./start.sh
Open http://localhost:3000 and click Create a bin. The page shows the bin's capture URL.
Capture and replay
Send anything to the bin. Any method and any path below it works, so /in/<bin>/stripe/events and /in/<bin>/github can share one:
bashcurl -X POST 'http://localhost:3000/in/<bin>/stripe/events?type=invoice.paid' \
-H 'Content-Type: application/json' \
-d '{"id":"evt_1","type":"invoice.paid"}'
To replay, enter your server's address and press Replay. The path and query the request arrived with are added to it, so the request above goes to http://localhost:8080/stripe/events?type=invoice.paid. The response's status, headers, body and timing are kept next to the request.
A provider can't reach localhost, so to catch real webhooks put a tunnel in front (ngrok, Cloudflare Tunnel, Tailscale Funnel) and set HOOKTRAP_PUBLIC_URL to its address. Every request is answered with a 200, so the provider counts the delivery as a success.
Settings
Environment variables, all optional: PORT (3000), HOOKTRAP_MAX_BODY_BYTES (1 MB), HOOKTRAP_MAX_BINS (200), HOOKTRAP_MAX_REQUESTS per bin (100, oldest drop off), HOOKTRAP_IDLE_HOURS (24), HOOKTRAP_REPLAY_HOSTS (loopback; * allows any), HOOKTRAP_REPLAY_TIMEOUT_SECONDS (15) and HOOKTRAP_PUBLIC_URL.
Things to know
- Bins live in memory, so a restart empties them.
- A bin's id is its only protection. Don't put sensitive traffic through one on a public address.
- A provider that signs a timestamp as well as the body, as Stripe does, rejects an old replay unless your handler's tolerance allows it.
Built on BoxExpress
It's a small, readable app that uses a good slice of boxlang-express 0.2.27: boxExpressRaw() keeps bodies byte-exact, a /in/:bin/*rest path pattern catches every path below a bin, res.sse() streams new requests to the page, maxBodySize caps uploads, a cron schedule prunes idle bins every hour, and the pages share one view layout.