Demo
Text version of the video
The video has background music and no narration. This is what it shows on screen.
- Webhooks are HTTP requests, and doing them well is harder than it looks: receivers go down (503), requests time out, and two workers can send the same event.
- HookLine: a webhook delivery service with signed payloads, retries, dead letters, manual replay and full delivery history.
- Architecture: one package, two processes, one database. The API never sends webhooks, and the worker never accepts HTTP requests.
- One command, docker compose up, starts the whole stack. Migrations run once, then the API and the worker start.
- A producer sends one event and gets 201 Created. HookLine creates one pending delivery for every endpoint that wants this event type.
- The event and its deliveries commit in one transaction: both exist, or neither does.
- Retrying with the same Idempotency-Key returns the same event instead of creating a new one.
- Workers claim due deliveries with SELECT ... FOR UPDATE SKIP LOCKED, so two workers never send the same delivery.
- Every delivery is signed with HMAC-SHA256 over the timestamp and the raw body.
- Retries use exponential backoff with jitter. A random factor from 0.5 to 1.0 stops failed deliveries from all returning at once.
- Billing is offline: eight attempts fail and the delivery goes dead after 18 minutes. A manual retry starts a fresh run, and a second retry is refused.
- Subscriber URLs cannot reach the internal network: private, loopback, link-local and reserved addresses are blocked.
- Accounts, limits and statistics: 15-minute JWT sessions with rotating refresh tokens, roles, API keys stored as SHA-256 hashes, a rate limit per API key and a stats endpoint. Every error is an RFC 9457 problem details body.
- Tested against a real PostgreSQL: 568 tests passed with 100% line and branch coverage, using Testcontainers and concurrency tests built on threading.Barrier. CI enforces an 85% floor and runs a Docker Compose smoke test.
- What it doesn't do yet.
What it does
Producer applications send events to HookLine’s API with an API key. HookLine creates one delivery for every endpoint subscribed to that event type, and a separate worker process sends them. Each request is signed with HMAC-SHA256. Failed deliveries are retried with exponential backoff and jitter, and after the last attempt they move to a dead-letter state where a user can retry them by hand. Users manage endpoints, keys and deliveries through a JWT-protected API.
Architecture
Two processes share one PostgreSQL database: the FastAPI app takes events and serves the management API, and the worker polls for due deliveries. Each feature package has the same four files: models, schemas, service and router. Alembic manages three migrations, and Docker Compose runs the database, a migration step, the API, the worker and a demo receiver that verifies signatures.
The hard part
Several workers must never send the same delivery twice at once. Instead of adding a message broker, the worker claims due rows with SELECT ... FOR UPDATE SKIP LOCKED and sets a lease. A worker only records a result if it still holds the lease, so a crashed worker’s deliveries become claimable again when the lease runs out.
The second hard part was not becoming an SSRF tool. Target URLs must be HTTPS and must not resolve to private, loopback, link-local or reserved addresses. That check runs when an endpoint is saved and again right before every delivery.
Decisions
- PostgreSQL as the job queue, recorded in ADR 0002, so the whole service runs on one database.
- Idempotency keys on event intake: same key and same body returns the original event, same key with a different body is a 409.
- Rotating refresh tokens. Reusing an old one revokes all of that user’s sessions.
- Rate limiting per API key in fixed one-minute windows, with
Retry-Afteron a 429.
Testing
388 test functions, which run as 568 tests once parameterised cases expand: 169 unit tests and 219 integration tests on PostgreSQL 17 in Testcontainers, covering auth flows, idempotency under concurrency, worker leases and concurrent claims, retries and schema constraints. No test touches the network, and line coverage is 100%. CI runs ruff, mypy with untyped functions disallowed, the tests with a coverage gate, and an end-to-end smoke test against the Compose stack.
Next
Endpoint signing secrets are stored in plain text because the worker needs them to sign; encrypting them at rest is the obvious next step. There’s no dashboard and no hosted deployment yet.