# foramamin/webhookpulse architecture

> Architecture diagram of the GitHub repository foramamin/webhookpulse, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/foramamin/webhookpulse
- Repository: https://github.com/foramamin/webhookpulse

## Overview

WebhookPulse is a multi-tenant webhook reliability and observability service. Providers submit events to its API, which resolves an endpoint, verifies and normalizes the provider payload, deduplicates and persists it, then queues it for asynchronous delivery. A worker delivers to customer backends, retries failures, and routes exhausted events to a dead-letter queue; authenticated users can inspect event and attempt history and replay events. The graph also includes endpoint management and authentication. Unexcerpted worker, provider, and DLQ links rely on SOURCE INDEX references or README descriptions, not direct source inspection.

Main entry points: [`webhookPulse/backend/src/worker.py`](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/worker.py) (Delivery worker), [`webhookPulse/backend/src/services/ingestion_service.py`](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/ingestion_service.py) (Ingestion pipeline), [`webhookPulse/backend/src/repositories/event_repository.py`](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/repositories/event_repository.py) (Event repository), [`webhookPulse/backend/src/main.py`](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/main.py) (FastAPI application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and tenancy"]
  node_api["FastAPI application<br/>[main.py]"]
  node_auth_routes["Auth routes<br/>[auth_routes.py]"]
  node_auth_controller["Auth controller<br/>[auth_controller.py]"]
  node_auth_service["Auth service<br/>[auth_service.py]"]
  node_auth_guard["JWT tenant guard<br/>[dependencies.py]"]
  node_security["Token security<br/>[security.py]"]
  node_endpoint_routes["Endpoint routes<br/>[endpoint_routes.py]"]
  node_endpoint_service["Endpoint service"]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_ingestion["Webhook ingestion"]
  node_webhook_routes["Webhook routes<br/>[webhook_routes.py]"]
  node_ingestion_service["Ingestion pipeline"]
  node_provider_adapters["Provider adapters"]
  node_event_model["Event document<br/>[event.py]"]
end

subgraph group_delivery["Async delivery"]
  node_queue_service["Queue service<br/>[queue_service.py]"]
  node_redis["Redis Streams<br/>[redis.py]"]
  node_worker["Delivery worker<br/>[worker.py]"]
  node_retry["Retry policy<br/>[retry_service.py]"]
  node_dlq["Dead-letter queue<br/>[dlq_service.py]"]
  node_retry_config["Retry settings<br/>[retry_config.py]"]
end

subgraph group_persistence["Persistence and history"]
  node_event_routes["Event routes<br/>[event_routes.py]"]
  node_event_controller["Event controller"]
  node_event_service["Event history service<br/>[event_service.py]"]
  node_replay_service["Replay service<br/>[replay_service.py]"]
  node_event_repository["Event repository"]
  node_attempt_repository["Attempt repository"]
  node_mongo[("MongoDB<br/>[database.py]")]
end

node_provider(("Webhook provider"))
node_backend(("Customer backend"))

node_api -->|"mounts"| node_auth_routes
node_api -->|"mounts"| node_endpoint_routes
node_api -->|"mounts"| node_webhook_routes
node_api -->|"mounts"| node_event_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"calls"| node_auth_service
node_auth_service -->|"hashes and signs"| node_security
node_auth_routes -->|"authenticates"| node_auth_guard
node_endpoint_routes -->|"authenticates"| node_auth_guard
node_event_routes -->|"authenticates"| node_auth_guard
node_endpoint_routes -->|"dispatches"| node_endpoint_service
node_provider -->|"posts webhook"| node_webhook_routes
node_webhook_routes -->|"invokes"| node_ingestion_service
node_ingestion_service -->|"verifies and normalizes"| node_provider_adapters
node_ingestion_service -->|"constructs"| node_event_model
node_ingestion_service -->|"checks and persists"| node_event_repository
node_ingestion_service -->|"enqueues"| node_queue_service
node_queue_service -->|"writes stream"| node_redis
node_redis -->|"feeds events"| node_worker
node_worker -->|"updates event"| node_event_repository
node_worker -->|"records attempts"| node_attempt_repository
node_worker -->|"applies retry"| node_retry
node_retry -->|"reads settings"| node_retry_config
node_worker -->|"routes exhausted events"| node_dlq
node_worker -->|"delivers webhook"| node_backend
node_event_routes -->|"dispatches"| node_event_controller
node_event_controller -->|"queries history"| node_event_service
node_event_controller -->|"requests replay"| node_replay_service
node_event_service -->|"reads events"| node_event_repository
node_event_service -->|"reads attempts"| node_attempt_repository
node_replay_service -->|"loads event"| node_event_repository
node_replay_service -->|"requeues event"| node_queue_service
node_event_repository -->|"reads and writes"| node_mongo
node_attempt_repository -->|"stores attempts"| node_mongo
node_config -->|"configures connection"| node_mongo
node_config -->|"configures connection"| node_redis

click node_api "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/main.py"
click node_auth_routes "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/routes/auth_routes.py"
click node_auth_controller "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/controllers/auth_controller.py"
click node_auth_service "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/auth_service.py"
click node_auth_guard "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/core/dependencies.py"
click node_security "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/core/security.py"
click node_endpoint_routes "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/routes/endpoint_routes.py"
click node_endpoint_service "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/endpoint_service.py"
click node_webhook_routes "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/routes/webhook_routes.py"
click node_ingestion_service "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/ingestion_service.py"
click node_provider_adapters "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/providers/adapters/razorpay_adapter.py"
click node_event_model "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/models/event.py"
click node_queue_service "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/queue_service.py"
click node_redis "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/infrastructure/redis.py"
click node_worker "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/worker.py"
click node_retry "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/retry_service.py"
click node_dlq "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/dlq_service.py"
click node_event_routes "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/routes/event_routes.py"
click node_event_controller "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/controllers/event_controller.py"
click node_event_service "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/event_service.py"
click node_replay_service "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/replay_service.py"
click node_event_repository "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/repositories/event_repository.py"
click node_attempt_repository "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/repositories/delivery_attempt_repository.py"
click node_mongo "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/infrastructure/database.py"
click node_config "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/core/config.py"
click node_retry_config "https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/core/retry_config.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_auth_routes,node_auth_controller,node_auth_service,node_auth_guard,node_security,node_endpoint_routes,node_endpoint_service,node_config toneBlue
class node_webhook_routes,node_ingestion_service,node_provider_adapters,node_event_model toneAmber
class node_queue_service,node_redis,node_worker,node_retry,node_dlq,node_retry_config,node_provider toneMint
class node_event_routes,node_event_controller,node_event_service,node_replay_service,node_event_repository,node_attempt_repository,node_mongo toneRose
class node_backend toneIndigo
```

## Components

### API and tenancy

- [FastAPI application](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/main.py): `webhookPulse/backend/src/main.py`
- [Auth routes](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/routes/auth_routes.py): `webhookPulse/backend/src/routes/auth_routes.py`
- [Auth controller](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/controllers/auth_controller.py): `webhookPulse/backend/src/controllers/auth_controller.py`
- [Auth service](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/auth_service.py): `webhookPulse/backend/src/services/auth_service.py`
- [JWT tenant guard](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/core/dependencies.py): `webhookPulse/backend/src/core/dependencies.py`
- [Token security](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/core/security.py): `webhookPulse/backend/src/core/security.py`
- [Endpoint routes](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/routes/endpoint_routes.py): `webhookPulse/backend/src/routes/endpoint_routes.py`
- [Endpoint service](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/endpoint_service.py): `webhookPulse/backend/src/services/endpoint_service.py`
- [Runtime configuration](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/core/config.py): `webhookPulse/backend/src/core/config.py`

### Webhook ingestion

- [Webhook routes](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/routes/webhook_routes.py): `webhookPulse/backend/src/routes/webhook_routes.py`
- [Ingestion pipeline](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/ingestion_service.py): `webhookPulse/backend/src/services/ingestion_service.py`
- [Provider adapters](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/providers/adapters/razorpay_adapter.py): `webhookPulse/backend/src/providers/adapters/razorpay_adapter.py`
- [Event document](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/models/event.py): `webhookPulse/backend/src/models/event.py`

### Async delivery

- [Queue service](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/queue_service.py): `webhookPulse/backend/src/services/queue_service.py`
- [Redis Streams](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/infrastructure/redis.py): `webhookPulse/backend/src/infrastructure/redis.py`
- [Delivery worker](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/worker.py): `webhookPulse/backend/src/worker.py`
- [Retry policy](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/retry_service.py): `webhookPulse/backend/src/services/retry_service.py`
- [Dead-letter queue](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/dlq_service.py): `webhookPulse/backend/src/services/dlq_service.py`
- [Retry settings](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/core/retry_config.py): `webhookPulse/backend/src/core/retry_config.py`

### Persistence and history

- [Event routes](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/routes/event_routes.py): `webhookPulse/backend/src/routes/event_routes.py`
- [Event controller](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/controllers/event_controller.py): `webhookPulse/backend/src/controllers/event_controller.py`
- [Event history service](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/event_service.py): `webhookPulse/backend/src/services/event_service.py`
- [Replay service](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/services/replay_service.py): `webhookPulse/backend/src/services/replay_service.py`
- [Event repository](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/repositories/event_repository.py): `webhookPulse/backend/src/repositories/event_repository.py`
- [Attempt repository](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/repositories/delivery_attempt_repository.py): `webhookPulse/backend/src/repositories/delivery_attempt_repository.py`
- [MongoDB](https://github.com/foramamin/webhookpulse/blob/main/webhookPulse/backend/src/infrastructure/database.py): `webhookPulse/backend/src/infrastructure/database.py`

### Other components

- **Webhook provider**
- **Customer backend**

## Connections

- FastAPI application → Auth routes: mounts (evidence: `webhookPulse/backend/src/main.py`)
- FastAPI application → Endpoint routes: mounts (evidence: `webhookPulse/backend/src/main.py`)
- FastAPI application → Webhook routes: mounts (evidence: `webhookPulse/backend/src/main.py`)
- FastAPI application → Event routes: mounts (evidence: `webhookPulse/backend/src/main.py`)
- Auth routes → Auth controller: dispatches (evidence: `webhookPulse/backend/src/routes/auth_routes.py`)
- Auth controller → Auth service: calls (evidence: `webhookPulse/backend/src/controllers/auth_controller.py`)
- Auth service → Token security: hashes and signs (evidence: `webhookPulse/backend/src/services/auth_service.py`)
- Auth routes → JWT tenant guard: authenticates (evidence: `webhookPulse/backend/src/routes/auth_routes.py`)
- Endpoint routes → JWT tenant guard: authenticates (evidence: `webhookPulse/backend/src/routes/endpoint_routes.py`)
- Event routes → JWT tenant guard: authenticates (evidence: `webhookPulse/backend/src/routes/event_routes.py`)
- Endpoint routes → Endpoint service: dispatches
- Webhook provider → Webhook routes: posts webhook (evidence: `README.md`)
- Webhook routes → Ingestion pipeline: invokes
- Ingestion pipeline → Provider adapters: verifies and normalizes (evidence: `webhookPulse/backend/src/services/ingestion_service.py`)
- Ingestion pipeline → Event document: constructs (evidence: `webhookPulse/backend/src/services/ingestion_service.py`)
- Ingestion pipeline → Event repository: checks and persists (evidence: `webhookPulse/backend/src/services/ingestion_service.py`)
- Ingestion pipeline → Queue service: enqueues (evidence: `webhookPulse/backend/src/services/ingestion_service.py`)
- Queue service → Redis Streams: writes stream (evidence: `webhookPulse/backend/src/services/queue_service.py`)
- Redis Streams → Delivery worker: feeds events (evidence: `README.md`)
- Delivery worker → Event repository: updates event (evidence: `webhookPulse/backend/src/worker.py`)
- Delivery worker → Attempt repository: records attempts (evidence: `webhookPulse/backend/src/worker.py`)
- Delivery worker → Retry policy: applies retry (evidence: `webhookPulse/backend/src/worker.py`)
- Retry policy → Retry settings: reads settings (evidence: `webhookPulse/backend/src/services/retry_service.py`)
- Delivery worker → Dead-letter queue: routes exhausted events (evidence: `webhookPulse/backend/src/worker.py`)
- Delivery worker → Customer backend: delivers webhook (evidence: `README.md`)
- Event routes → Event controller: dispatches (evidence: `webhookPulse/backend/src/routes/event_routes.py`)
- Event controller → Event history service: queries history (evidence: `webhookPulse/backend/src/controllers/event_controller.py`)
- Event controller → Replay service: requests replay (evidence: `webhookPulse/backend/src/controllers/event_controller.py`)
- Event history service → Event repository: reads events (evidence: `webhookPulse/backend/src/services/event_service.py`)
- Event history service → Attempt repository: reads attempts (evidence: `webhookPulse/backend/src/services/event_service.py`)
- Replay service → Event repository: loads event (evidence: `webhookPulse/backend/src/services/replay_service.py`)
- Replay service → Queue service: requeues event (evidence: `webhookPulse/backend/src/services/replay_service.py`)
- Event repository → MongoDB: reads and writes (evidence: `webhookPulse/backend/src/repositories/event_repository.py`)
- Attempt repository → MongoDB: stores attempts (evidence: `webhookPulse/backend/src/repositories/delivery_attempt_repository.py`)
- Runtime configuration → MongoDB: configures connection (evidence: `webhookPulse/backend/src/infrastructure/database.py`)
- Runtime configuration → Redis Streams: configures connection (evidence: `webhookPulse/backend/src/infrastructure/redis.py`)
