Self-hosted ยท Open Source ยท MIT License

Push events to Discord
without the noise.

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.

๐Ÿš€ Get Started ๐Ÿ“– API Reference โญ GitHub
What you get

Features

Everything you need to bridge your repositories to Discord โ€” nothing you don't.

๐Ÿ”—

GitHub & GitLab

Both platforms work out of the box. HMAC signature verification for GitHub, secret token validation for GitLab โ€” with constant-time comparison.

๐ŸŽจ

Custom Embed Templates

Design your Discord embeds with a live preview builder. Control title, description, color, footer, author, thumbnail, and more via template variables.

๐Ÿ”

Automatic Retry Queue

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.

๐Ÿ”

TOTP Two-Factor Auth

Protect admin accounts with TOTP (Google Authenticator, Bitwarden, Authy). Includes 8 one-time backup codes for recovery, SHA-256 hashed at rest.

๐Ÿ›ก๏ธ

Brute-Force Protection

Per-account lockout after 5 failed login attempts. Per-IP rate limiting (20 attempts / 15 min) persisted in SQLite โ€” limits survive server restarts.

๐Ÿ“Š

Real-Time Dashboard

Stats and live log feed update instantly via Server-Sent Events. No refresh needed โ€” new webhook events appear with a pulsing Live indicator.

๐Ÿ“ˆ

Prometheus Metrics

Scrape /metrics with any Prometheus-compatible collector. Tracks webhook counts by status, queue depth, repositories, and users.

โšก

Settings Cache

API keys are held in an in-memory RwLock cache โ€” zero DB roundtrips per request. Cache is invalidated atomically when settings are updated.

๐Ÿ“–

Swagger UI

Every endpoint is documented with utoipa annotations. Browse and try all API endpoints interactively at /api/docs.

๐ŸŒฟ

Branch & Keyword Filters

Per-repository allowed branch list and commit keyword filter โ€” silently drop pushes you don't care about. Dependabot is always filtered.

๐Ÿ—ƒ๏ธ

SQLite + Auto-Maintenance

Zero-dependency embedded database. Weekly VACUUM + ANALYZE keeps file size minimal and query planner accurate automatically.

๐Ÿ“ฆ

~20 MB Docker Image

Statically compiled Rust binary on Alpine Linux. No external runtime dependencies, no JVM, no interpreter.

Get running in 60 seconds

Quick Start

Three commands and you're live.

Shell
git clone https://github.com/your-username/hookshot.git
cd hookshot
docker compose up -d
Default credentials: Open http://localhost:8080 and sign in with admin / admin123. You will be prompted to change the password on first login.

Connect a Repository

1

Create a Repository in Hookshot

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.

2

Add the Webhook on GitHub / GitLab

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.

3

Push Something

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.

GitHub Setup

  1. Repository โ†’ Settings โ†’ Webhooks โ†’ Add webhook
  2. Payload URL: https://your-domain.com/webhook/<token>
  3. Content type: application/json
  4. Secret: paste from Hookshot repository page
  5. Select Just the push event

GitLab Setup

  1. Project โ†’ Settings โ†’ Webhooks
  2. URL: https://your-domain.com/webhook/<token>
  3. Secret token: paste from Hookshot repository page
  4. Enable Push events
  5. Click Add webhook
Templating

Embed Variables

Use {{variable}} syntax anywhere in your embed template fields โ€” title, description, footer, author, URLs.

VariableDescriptionExample
{{repo_name}}Short repository namemy-app
{{repo_full_name}}Owner/repoacme/my-app
{{repo_url}}Link to repositoryhttps://github.com/acme/my-app
{{pusher_name}}Username of pusheroctocat
{{pusher_avatar}}Avatar image URLhttps://avatars.githubusercontent.com/โ€ฆ
{{branch}}Target branch namemain
{{commit_count}}Number of commits3
{{all_commits}}All commits formatted as markdown links[`abc1234`](url) โ€“ feat: add login โ€“ octocat
{{added_commits}}Commits that added filesSame format as above
{{modified_commits}}Commits that modified filesSame format as above
{{removed_commits}}Commits that removed filesSame format as above
{{discord_timestamp_R}}Relative time2 minutes ago
{{discord_timestamp_F}}Full date & timeSunday, 25 May 2025 14:00:00
{{discord_timestamp_D}}Long date25 May 2025
{{discord_timestamp_T}}Time with seconds14:00:00
{{discord_timestamp_t}}Short time14:00
{{discord_timestamp_d}}Short date25/05/2025
{{discord_timestamp_f}}Date and short time25 May 2025 14:00
API Reference

REST API

All endpoints are documented with OpenAPI 3.0 annotations. The interactive Swagger UI is available at /api/docs on your running instance.

Authentication: Protected endpoints require a Bearer <token> header. Obtain a token via POST /api/auth/login. Admin-only endpoints additionally require the admin role.
Authentication
POSTpublic
/api/auth/login
Username + password login. Returns a full JWT or a temporary token if 2FA is enabled.
POSTpublic
/api/auth/totp/verify
Submit a 6-digit TOTP code after the initial login step.
POSTpublic
/api/auth/totp/use-backup
Authenticate using one of the 8 one-time backup codes. Code is consumed on use.
GETauth
/api/auth/me
Return the profile of the currently authenticated user.
POSTauth
/api/auth/logout
Invalidate the current JWT (adds it to the blacklist).
POSTauth
/api/auth/totp/setup
Generate a TOTP secret and OTP auth URI for QR code display.
POSTauth
/api/auth/totp/enable
Confirm a TOTP code to activate 2FA. Returns 8 backup codes (shown once).
POSTauth
/api/auth/totp/disable
Disable 2FA. Requires current password and valid TOTP code.
POSTauth
/api/auth/stream-token
Issue a 30-second one-time token for authenticating the SSE log stream.
Sessions
GETauth
/api/sessions
List all active sessions for the current user.
DELETEauth
/api/sessions/{id}
Revoke a specific session (blacklists its JWT).
POSTauth
/api/sessions/revoke-others
Revoke all sessions except the current one.
Repositories
GETauth
/api/repositories
List all configured repositories.
POSTauth
/api/repositories
Create a new repository. Returns the generated webhook token and secret.
GETauth
/api/repositories/{id}
Get a single repository by ID.
PUTauth
/api/repositories/{id}
Update fields on an existing repository (partial update).
DELETEauth
/api/repositories/{id}
Delete a repository permanently.
POSTauth
/api/repositories/{id}/test
Send a test Discord embed using the repository's current template.
POSTauth
/api/repositories/{id}/regenerate-token
Generate a new webhook token, invalidating the old URL.
GETauth
/api/repositories/export
Export all repositories as a JSON file.
POSTauth
/api/repositories/import
Import up to 100 repositories from a JSON payload.
POSTauth
/api/repositories/bulk
Activate, deactivate, or delete up to 500 repositories in one request.
Settings
GETauth
/api/settings
List all visible settings (hidden keys like JWT secret are excluded).
PUTauth
/api/settings
Update one or more settings. In-memory cache is refreshed immediately.
Incoming Webhooks
POSTpublic
/webhook/{token}
Receive a push event from GitHub or GitLab. Validates signature, filters branches, and dispatches to Discord.
Webhook Logs
GETauth
/api/logs
Paginated log list. Filter by status, platform, repository_id. Max 200 per page.
POSTauth
/api/logs/{id}/retry
Replay a specific log entry โ€” re-sends the original payload to Discord.
GETpublic
/api/logs/stream
Server-Sent Events stream. Requires a ?token=โ€ฆ one-time token from POST /api/auth/stream-token.
Statistics
GETauth
/api/stats
Webhook delivery counts for the last 24 hours and 7 days, success rate, and top repositories.
User Management admin only
GET
/api/users
List all user accounts.
POST
/api/users
Create a new user. Password is Argon2-hashed.
PUT
/api/users/{id}
Update username, email, password, or role.
DELETE
/api/users/{id}
Delete a user. Cannot delete your own account.
PUTauth
/api/users/me/password
Change your own password. Requires current password verification.
Audit Log admin only
GET
/api/audit
Last 500 audit log entries (user, action, target, timestamp).
Retry Queue admin only
GET
/api/queue
List queued Discord deliveries with pending and failed counts.
POST
/api/queue/{id}/retry
Manually trigger an immediate retry for a specific queue item.
DELETE
/api/queue/{id}
Remove a queue item permanently.
POST
/api/queue/purge-failed
Delete all queue items with status failed.
System Endpoints public
GET
/health
Database connectivity check. Returns {"status":"healthy","db":"ok"} or HTTP 503.
GET
/metrics
Prometheus text format metrics. Scrape with any compatible collector.
GET
/api/docs
Interactive Swagger UI โ€” browse and test all endpoints in the browser.
GET
/api/docs/openapi.json
Raw OpenAPI 3.0 specification as JSON.
Configuration

Environment Variables

All settings have sensible defaults. Copy .env.example to .env and adjust as needed.

VariableDefaultDescription
PORT8080HTTP port the server binds to
DATABASE_URLsqlite:data/app.dbSQLite database path. Created automatically if absent.
FRONTEND_DIRfrontend/distPath to pre-built frontend assets
HOST_PORT8080Docker Compose host-side port
RUST_LOGhookshot=info,tower_http=infoTracing log level filter
LOG_FORMATplainSet to json for structured JSON output (Loki, Datadog, CloudWatch)
CORS_ORIGINdisabledAllowed CORS origin, e.g. https://app.example.com
Settings persisted in the database (managed via the admin UI or PUT /api/settings):

log_retention_days (default 90) ยท audit_log_retention_days (default 30)
.env.example
PORT=8080
DATABASE_URL=sqlite:data/app.db
FRONTEND_DIR=frontend/dist
HOST_PORT=8080
LOG_FORMAT=json
CORS_ORIGIN=
Observability

Monitoring

Hookshot exposes Prometheus metrics and a structured JSON log stream โ€” ready to plug into your existing observability stack.

Prometheus Metrics

hookshot_webhooks_total
Total webhook log entries ever recorded
hookshot_webhooks_by_status
Entries split by success, failed, skipped
hookshot_queue_depth
Current retry queue depth (pending / failed)
hookshot_repositories
Repository count (total / active)
hookshot_users_total
Total user accounts
prometheus.yml
scrape_configs:
  - job_name: hookshot
    scrape_interval: 30s
    static_configs:
      - targets: ['hookshot:8080']

Health Check

curl https://your-domain.com/health
# {"status":"healthy","db":"ok"}

# Returns HTTP 503 + {"status":"unhealthy","db":"โ€ฆ"} on DB failure

Structured JSON Logging

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"}}
Security Model

Security

Hookshot is designed with defence-in-depth for self-hosted production use.

๐Ÿ”‘

Passwords

Argon2id hashing with per-user random salts. Minimum 8 characters enforced. Forced change on first login.

๐Ÿ”ข

TOTP 2FA + Backup Codes

RFC 6238 TOTP. 8 backup codes are generated at enable time, SHA-256 hashed, and consumed on use. One code per login attempt.

๐Ÿšซ

Rate Limiting

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.

๐Ÿ”

Signature Verification

GitHub webhooks: HMAC-SHA256 via x-hub-signature-256. GitLab: shared secret via x-gitlab-token. Both use constant-time byte comparison.

๐ŸŽซ

JWT Sessions

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.

๐Ÿ›ก๏ธ

Security Headers

X-Content-Type-Options: nosniff, X-Frame-Options: DENY, X-XSS-Protection: 1; mode=block, Referrer-Policy: strict-origin-when-cross-origin.

Under the hood

Tech Stack

LayerTechnologyWhy
BackendRust ยท Axum 0.8 ยท TokioMemory safety, zero-cost async, minimal binary size
DatabaseSQLite via SQLx 0.9 (bundled)Zero-dependency embedded DB; compile-time query verification
FrontendReact 19 ยท TypeScript ยท Vite 6 ยท TailwindFast HMR dev loop, type-safe UI
Authjsonwebtoken 10 ยท Argon2 ยท totp-rs 5.7Industry-standard JWT, memory-hard password hashing, RFC 6238 TOTP
Real-timeServer-Sent Events (SSE)Simple, firewall-friendly, no WebSocket upgrade
API Docsutoipa 5 ยท Swagger UI 9Compile-time OpenAPI 3.0 generation from Rust annotations
MonitoringPrometheus text format ยท tracing-subscriberZero extra crates, plugs into any existing stack
ContainerAlpine Linux ยท ~20 MB imageTiny attack surface, fast cold start