How sarthak-shubham/mochi works
Mochi is a webhook event relay: operators register HTTP endpoints and subscribe them to event types; publishers submit events, which Mochi persists, queues for matching subscribers, delivers asynchronously, and tracks delivery outcomes for lookup. The graph separates HTTP handling, Redis-backed state and routing, and background delivery. Source excerpts show the principal calls and Redis stream flow; the empty README provides no additional documented capabilities, and unsampled files are not inferred.
Main entry points: worker.go Delivery workers · handlers.go Event publish and lookup · server.go HTTP server · main.go Service startup
Components 16
Runtime
- Configuration
internal/config/config.go - Service startup
cmd/mochi/main.go
HTTP API
- HTTP server
internal/api/server.go - Endpoint subscriptions
internal/api/handlers.go - Event publish and lookup
internal/api/handlers.go - HTTP helpers
internal/api/helpers.go
State and routing
- Endpoint and subscriptions
internal/store/endpoints.go - Events and deliveries
internal/store/events.go - Store and keys
internal/store/store.go
Delivery
- Delivery stream
internal/store/events.go - Delivery workers
internal/worker/worker.go
Other components
- Operator
- Event publisher
- Subscriber endpoint
- Redis
- Webhook receiver
Connections 24
- Operator → HTTP server: manages endpoints
internal/api/server.go - Event publisher → HTTP server: publishes events
internal/api/server.go - HTTP server → Endpoint subscriptions: routes endpoint requests
internal/api/server.go - HTTP server → Event publish and lookup: routes event requests
internal/api/server.go - Endpoint subscriptions → HTTP helpers: writes responses
internal/api/handlers.go - Event publish and lookup → HTTP helpers: writes responses
internal/api/handlers.go - Endpoint subscriptions → Endpoint and subscriptions: manages subscriptions
internal/api/handlers.go - Event publish and lookup → Events and deliveries: saves and reads events
internal/api/handlers.go - Event publish and lookup → Endpoint and subscriptions: finds subscribers
internal/api/handlers.go - Event publish and lookup → Delivery stream: schedules deliveries
internal/api/handlers.go - Service startup → Configuration: loads settings
cmd/mochi/main.go - Service startup → Store and keys: creates store
cmd/mochi/main.go - Service startup → Delivery workers: starts workers
cmd/mochi/main.go - Service startup → HTTP server: starts server
cmd/mochi/main.go - Store and keys → Redis: uses client
internal/store/store.go - Endpoint and subscriptions → Redis: reads and writes
internal/store/endpoints.go - Events and deliveries → Redis: reads and writes
internal/store/events.go - Events and deliveries → Delivery stream: enqueues messages
internal/store/events.go - Delivery workers → Delivery stream: reads and acknowledges
internal/worker/worker.go - Delivery workers → Events and deliveries: loads and records delivery
internal/worker/worker.go - Delivery workers → Endpoint and subscriptions: loads endpoint
internal/worker/worker.go - Delivery workers → Webhook receiver: posts event
internal/worker/worker.go - Webhook receiver → Delivery workers: returns HTTP result
internal/worker/worker.go - Subscriber endpoint → Webhook receiver: receives delivery