Hookshot is a webhook bridge for GitHub & GitLab that delivers fully customizable Discord embeds โ with a clean admin UI, automatic retry queuing, and production-grade security.
Everything you need to bridge your repositories to Discord โ nothing you don't.
Both platforms work out of the box. HMAC signature verification for GitHub, secret token validation for GitLab โ with constant-time comparison.
Design your Discord embeds with a live preview builder. Control title, description, color, footer, author, thumbnail, and more via template variables.
Discord 429 / 5xx responses trigger exponential backoff retries (30 s โ 5 min, up to 5 attempts). Inspect and manage the queue from the admin panel.
Protect admin accounts with TOTP (Google Authenticator, Bitwarden, Authy). Includes 8 one-time backup codes for recovery, SHA-256 hashed at rest.
Per-account lockout after 5 failed login attempts. Per-IP rate limiting (20 attempts / 15 min) persisted in SQLite โ limits survive server restarts.
Stats and live log feed update instantly via Server-Sent Events. No refresh needed โ new webhook events appear with a pulsing Live indicator.
Scrape /metrics with any Prometheus-compatible collector. Tracks webhook counts by status, queue depth, repositories, and users.
API keys are held in an in-memory RwLock cache โ zero DB roundtrips per request. Cache is invalidated atomically when settings are updated.
Every endpoint is documented with utoipa annotations. Browse and try all API endpoints interactively at /api/docs.
Per-repository allowed branch list and commit keyword filter โ silently drop pushes you don't care about. Dependabot is always filtered.
Zero-dependency embedded database. Weekly VACUUM + ANALYZE keeps file size minimal and query planner accurate automatically.
Statically compiled Rust binary on Alpine Linux. No external runtime dependencies, no JVM, no interpreter.
Three commands and you're live.
git clone https://github.com/your-username/hookshot.git
cd hookshot
docker compose up -d
Go to the admin panel โ Repositories โ Add. Enter your repo's full name, choose GitHub or GitLab, and paste your Discord webhook URL. Hookshot generates a unique token and secret automatically.
In your repository's webhook settings, set the payload URL to https://your-domain.com/webhook/<token>, set content type to application/json, and enter the secret. Subscribe to push events only.
Push a commit. Within seconds a Discord embed appears in your channel. Use the Test Send button in Hookshot to fire a test without a real push.
https://your-domain.com/webhook/<token>application/jsonhttps://your-domain.com/webhook/<token>Use {{variable}} syntax anywhere in your embed template fields โ title, description, footer, author, URLs.
| Variable | Description | Example |
|---|---|---|
{{repo_name}} | Short repository name | my-app |
{{repo_full_name}} | Owner/repo | acme/my-app |
{{repo_url}} | Link to repository | https://github.com/acme/my-app |
{{pusher_name}} | Username of pusher | octocat |
{{pusher_avatar}} | Avatar image URL | https://avatars.githubusercontent.com/โฆ |
{{branch}} | Target branch name | main |
{{commit_count}} | Number of commits | 3 |
{{all_commits}} | All commits formatted as markdown links | [`abc1234`](url) โ feat: add login โ octocat |
{{added_commits}} | Commits that added files | Same format as above |
{{modified_commits}} | Commits that modified files | Same format as above |
{{removed_commits}} | Commits that removed files | Same format as above |
{{discord_timestamp_R}} | Relative time | 2 minutes ago |
{{discord_timestamp_F}} | Full date & time | Sunday, 25 May 2025 14:00:00 |
{{discord_timestamp_D}} | Long date | 25 May 2025 |
{{discord_timestamp_T}} | Time with seconds | 14:00:00 |
{{discord_timestamp_t}} | Short time | 14:00 |
{{discord_timestamp_d}} | Short date | 25/05/2025 |
{{discord_timestamp_f}} | Date and short time | 25 May 2025 14:00 |
All endpoints are documented with OpenAPI 3.0 annotations. The interactive Swagger UI is available at /api/docs on your running instance.
Bearer <token> header. Obtain a token via POST /api/auth/login. Admin-only endpoints additionally require the admin role.
status, platform, repository_id. Max 200 per page.?token=โฆ one-time token from POST /api/auth/stream-token.failed.{"status":"healthy","db":"ok"} or HTTP 503.All settings have sensible defaults. Copy .env.example to .env and adjust as needed.
| Variable | Default | Description |
|---|---|---|
PORT | 8080 | HTTP port the server binds to |
DATABASE_URL | sqlite:data/app.db | SQLite database path. Created automatically if absent. |
FRONTEND_DIR | frontend/dist | Path to pre-built frontend assets |
HOST_PORT | 8080 | Docker Compose host-side port |
RUST_LOG | hookshot=info,tower_http=info | Tracing log level filter |
LOG_FORMAT | plain | Set to json for structured JSON output (Loki, Datadog, CloudWatch) |
CORS_ORIGIN | disabled | Allowed CORS origin, e.g. https://app.example.com |
PUT /api/settings):
log_retention_days (default 90) ยท audit_log_retention_days (default 30)
PORT=8080
DATABASE_URL=sqlite:data/app.db
FRONTEND_DIR=frontend/dist
HOST_PORT=8080
LOG_FORMAT=json
CORS_ORIGIN=
Hookshot exposes Prometheus metrics and a structured JSON log stream โ ready to plug into your existing observability stack.
success, failed, skippedpending / failed)total / active)scrape_configs:
- job_name: hookshot
scrape_interval: 30s
static_configs:
- targets: ['hookshot:8080']
curl https://your-domain.com/health
# {"status":"healthy","db":"ok"}
# Returns HTTP 503 + {"status":"unhealthy","db":"โฆ"} on DB failure
Set LOG_FORMAT=json to emit newline-delimited JSON โ compatible with Loki, Datadog, CloudWatch Logs, etc.
{"timestamp":"2025-05-25T14:00:00Z","level":"INFO","target":"hookshot","message":"Webhook processed","fields":{"status":"success"}}
Hookshot is designed with defence-in-depth for self-hosted production use.
Argon2id hashing with per-user random salts. Minimum 8 characters enforced. Forced change on first login.
RFC 6238 TOTP. 8 backup codes are generated at enable time, SHA-256 hashed, and consumed on use. One code per login attempt.
Login and TOTP: 20 attempts / 15 min per IP, persisted in SQLite. Webhooks: 120 / 60 s per IP in-memory. All return proper Retry-After and X-RateLimit-* headers.
GitHub webhooks: HMAC-SHA256 via x-hub-signature-256. GitLab: shared secret via x-gitlab-token. Both use constant-time byte comparison.
HS256 JWTs with a randomly generated secret stored in the database. Logout blacklists the JTI. Per-session revocation supported. Expired blacklist entries are purged daily.
X-Content-Type-Options: nosniff, X-Frame-Options: DENY, X-XSS-Protection: 1; mode=block, Referrer-Policy: strict-origin-when-cross-origin.
| Layer | Technology | Why |
|---|---|---|
| Backend | Rust ยท Axum 0.8 ยท Tokio | Memory safety, zero-cost async, minimal binary size |
| Database | SQLite via SQLx 0.9 (bundled) | Zero-dependency embedded DB; compile-time query verification |
| Frontend | React 19 ยท TypeScript ยท Vite 6 ยท Tailwind | Fast HMR dev loop, type-safe UI |
| Auth | jsonwebtoken 10 ยท Argon2 ยท totp-rs 5.7 | Industry-standard JWT, memory-hard password hashing, RFC 6238 TOTP |
| Real-time | Server-Sent Events (SSE) | Simple, firewall-friendly, no WebSocket upgrade |
| API Docs | utoipa 5 ยท Swagger UI 9 | Compile-time OpenAPI 3.0 generation from Rust annotations |
| Monitoring | Prometheus text format ยท tracing-subscriber | Zero extra crates, plugs into any existing stack |
| Container | Alpine Linux ยท ~20 MB image | Tiny attack surface, fast cold start |