How srinu-design/hopper works
Hopper accepts tenant-scoped jobs over HTTP, stores them durably in PostgreSQL, and has workers execute registered tasks with at-least-once delivery, retries, and dead-letter handling. Scheduling, administration, and operational controls extend that workflow. The README documents core behavior; source excerpts and the SOURCE INDEX support selected module relationships. Several scheduler, API, and queue implementations were not sampled, so their internal call paths are not expanded.
Main entry points: main.py HTTP application · postgres.py PostgreSQL queue · loop.py Worker loop · client.py Mini broker client
Components 26
HTTP API
- HTTP application
src/hopper/api/main.py - Job endpoints
src/hopper/api/jobs.py - Admin endpoints
src/hopper/api/admin.py - Tenant authentication
src/hopper/auth/api_keys.py - Tenant and key store
src/hopper/auth/store.py - Schedule endpoints
src/hopper/api/schedules.py - Web console
src/hopper/web/static/app.js
Queue and workers
- PostgreSQL queue
src/hopper/queue/postgres.py - Worker loop
src/hopper/worker/loop.py - Task registry
src/hopper/tasks/registry.py - HTTP task
src/hopper/tasks/http.py - Job context
src/hopper/tasks/context.py - Dead-letter handling
src/hopper/queue/dlq.py
Scheduling
- Scheduled jobs
src/hopper/queue/schedules.py - Cron scheduler
src/hopper/scheduler/cron.py - Lease reaper
src/hopper/scheduler/reaper.py - Job retention
src/hopper/scheduler/retention.py
Limits and observability
- Rate limits
src/hopper/ratelimit/limiter.py - Queue backpressure
src/hopper/ratelimit/backpressure.py - Prometheus metrics
src/hopper/metrics.py
Mini broker
- Mini broker client
src/hopper/minibroker/client.py - Mini broker server
src/hopper/minibroker/server.py - Mini broker store
src/hopper/minibroker/store.py
Other components
- API client
- PostgreSQL
- Redis
Connections 26
- API client → HTTP application: sends requests
- HTTP application → Job endpoints: routes requests
src/hopper/api/main.py - HTTP application → Admin endpoints: routes requests
src/hopper/api/main.py - HTTP application → Schedule endpoints: routes requests
src/hopper/api/main.py - HTTP application → Web console: installs console
src/hopper/api/main.py - Job endpoints → PostgreSQL queue: enqueues jobs
src/hopper/api/jobs.py - PostgreSQL queue → PostgreSQL: stores job rows
- Worker loop → PostgreSQL queue: claims and updates
- Worker loop → Task registry: dispatches tasks
src/hopper/worker/loop.py - Worker loop → Job context: sets job context
src/hopper/worker/loop.py - Task registry → HTTP task: registers handler
src/hopper/tasks/http.py - PostgreSQL queue → Dead-letter handling: supports replay
- Schedule endpoints → Scheduled jobs: manages schedules
- Cron scheduler → PostgreSQL queue: enqueues due jobs
- Lease reaper → PostgreSQL queue: reclaims expired leases
- Job retention → PostgreSQL queue: deletes expired jobs
- Admin endpoints → Tenant and key store: manages tenants and keys
src/hopper/api/admin.py - Tenant authentication → Tenant and key store: checks API keys
src/hopper/auth/api_keys.py - HTTP application → Rate limits: configures limiter
src/hopper/api/main.py - HTTP application → Queue backpressure: configures backpressure
src/hopper/api/main.py - Rate limits → Redis: uses token buckets
src/hopper/ratelimit/limiter.py - Queue backpressure → Redis: uses cached depth
- HTTP application → Prometheus metrics: serves metrics
src/hopper/api/main.py - Mini broker client → Mini broker server: sends broker commands
src/hopper/minibroker/client.py - Mini broker server → Mini broker store: updates message state
src/hopper/minibroker/server.py - Mini broker client → Worker loop: adapts broker interface
src/hopper/minibroker/client.py