# willbrid/easy-api-prom-sms-alert architecture

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

- Interactive diagram: https://gitdiagram.com/willbrid/easy-api-prom-sms-alert
- Repository: https://github.com/willbrid/easy-api-prom-sms-alert

## Overview

Easy-api-prom-sms-alert is a configurable Prometheus/Alertmanager webhook that turns incoming alerts into provider-specific HTTP POST requests for SMS or messaging services. Its main workflow is configuration loading, HTTP alert receipt, per-alert recipient/message resolution, request construction, and provider delivery (or simulation logging). The graph follows sampled wiring and README capabilities; provider-specific integrations are described as generic HTTP APIs, and unsampled implementation details are omitted.

Main entry points: [`internal/app/app.go`](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/app/app.go) (Application assembly), [`internal/usecase/alert/alert.go`](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/usecase/alert/alert.go) (Alert use case), [`internal/microservice/alert/alert.go`](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/microservice/alert/alert.go) (Provider request delivery), [`cmd/main.go`](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/cmd/main.go) (Program entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and configuration"]
  node_main["Program entry<br/>[main.go]"]
  node_flags["Runtime flags<br/>[flag.go]"]
  node_config["Provider configuration<br/>[config.go]"]
end

subgraph group_ingress["HTTP ingress"]
  node_router["Route registration<br/>[handler.go]"]
  node_middleware["Authentication middleware<br/>[middleware.go]"]
  node_http_handlers["HTTP handlers<br/>[alertHandler.go]"]
end

subgraph group_alerts["Alert processing"]
  node_domain["Alert model<br/>[alert.go]"]
  node_usecase["Alert use case<br/>[alert.go]"]
  node_alert_helpers["Alert extraction<br/>[alerthelper.go]"]
  node_recipient_helper["Recipient lookup<br/>[recipienthelper.go]"]
end

subgraph group_delivery["Provider delivery"]
  node_microservice_factory["Delivery service setup<br/>[microservice.go]"]
  node_alert_service["Provider request delivery<br/>[alert.go]"]
  node_param_factory["Parameter factory<br/>[factory.go]"]
  node_param_builder["HTTP parameter encoding<br/>[builder.go]"]
end

subgraph group_runtime["Runtime infrastructure"]
  node_app["Application assembly<br/>[app.go]"]
  node_server["HTTP server<br/>[server.go]"]
  node_http_client["HTTP client<br/>[client.go]"]
  node_logging["Logging<br/>[logger.go]"]
end

node_prometheus(("Prometheus / Alertmanager"))
node_provider_api{{"SMS / messaging API"}}

node_prometheus -->|"posts alerts"| node_http_handlers
node_main -->|"loads flags"| node_flags
node_main -->|"loads configuration"| node_config
node_main -->|"initializes logger"| node_logging
node_main -->|"starts application"| node_app
node_app -->|"uses settings"| node_config
node_app -->|"constructs delivery"| node_microservice_factory
node_app -->|"starts server"| node_server
node_app -->|"initializes routes"| node_router
node_app -->|"constructs use cases"| node_usecase
node_router -->|"registers authentication"| node_middleware
node_router -->|"registers routes"| node_http_handlers
node_http_handlers -->|"submits alert"| node_usecase
node_http_handlers -->|"wraps alert data"| node_domain
node_usecase -->|"extracts alert details"| node_alert_helpers
node_usecase -->|"resolves recipients"| node_recipient_helper
node_usecase -->|"uses alert settings"| node_domain
node_usecase -->|"requests delivery"| node_alert_service
node_microservice_factory -->|"creates service"| node_alert_service
node_alert_service -->|"builds parameters"| node_param_factory
node_alert_service -->|"posts request"| node_http_client
node_alert_service -->|"sends HTTP POST"| node_provider_api
node_param_factory -->|"creates encoder"| node_param_builder

click node_main "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/cmd/main.go"
click node_flags "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/config/flag.go"
click node_config "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/config/config.go"
click node_app "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/app/app.go"
click node_server "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/pkg/httpserver/server.go"
click node_router "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/handler/handler.go"
click node_middleware "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/handler/middleware/middleware.go"
click node_http_handlers "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/handler/httphandler/alertHandler.go"
click node_domain "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/domain/alert.go"
click node_usecase "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/usecase/alert/alert.go"
click node_alert_helpers "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/pkg/alerthelper/alerthelper.go"
click node_recipient_helper "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/pkg/recipienthelper/recipienthelper.go"
click node_microservice_factory "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/microservice/microservice.go"
click node_alert_service "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/microservice/alert/alert.go"
click node_param_factory "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/pkg/httpparam/factory.go"
click node_param_builder "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/pkg/httpparam/builder.go"
click node_http_client "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/pkg/httpclient/client.go"
click node_logging "https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/pkg/logging/logger.go"

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_main,node_flags,node_config toneBlue
class node_router,node_middleware,node_http_handlers toneAmber
class node_domain,node_usecase,node_alert_helpers,node_recipient_helper,node_provider_api toneMint
class node_microservice_factory,node_alert_service,node_param_factory,node_param_builder toneRose
class node_app,node_server,node_http_client,node_logging,node_prometheus toneIndigo
```

## Components

### Startup and configuration

- [Program entry](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/cmd/main.go): `cmd/main.go`
- [Runtime flags](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/config/flag.go): `config/flag.go`
- [Provider configuration](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/config/config.go): `config/config.go`

### HTTP ingress

- [Route registration](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/handler/handler.go): `internal/handler/handler.go`
- [Authentication middleware](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/handler/middleware/middleware.go): `internal/handler/middleware/middleware.go`
- [HTTP handlers](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/handler/httphandler/alertHandler.go): `internal/handler/httphandler/alertHandler.go`

### Alert processing

- [Alert model](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/domain/alert.go): `internal/domain/alert.go`
- [Alert use case](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/usecase/alert/alert.go): `internal/usecase/alert/alert.go`
- [Alert extraction](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/pkg/alerthelper/alerthelper.go): `internal/pkg/alerthelper/alerthelper.go`
- [Recipient lookup](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/pkg/recipienthelper/recipienthelper.go): `internal/pkg/recipienthelper/recipienthelper.go`

### Provider delivery

- [Delivery service setup](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/microservice/microservice.go): `internal/microservice/microservice.go`
- [Provider request delivery](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/microservice/alert/alert.go): `internal/microservice/alert/alert.go`
- [Parameter factory](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/pkg/httpparam/factory.go): `pkg/httpparam/factory.go`
- [HTTP parameter encoding](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/pkg/httpparam/builder.go): `pkg/httpparam/builder.go`

### Runtime infrastructure

- [Application assembly](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/internal/app/app.go): `internal/app/app.go`
- [HTTP server](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/pkg/httpserver/server.go): `pkg/httpserver/server.go`
- [HTTP client](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/pkg/httpclient/client.go): `pkg/httpclient/client.go`
- [Logging](https://github.com/willbrid/easy-api-prom-sms-alert/blob/main/pkg/logging/logger.go): `pkg/logging/logger.go`

### Other components

- **Prometheus / Alertmanager**
- **SMS / messaging API**

## Connections

- Prometheus / Alertmanager → HTTP handlers: posts alerts (evidence: `README.md`)
- Program entry → Runtime flags: loads flags (evidence: `cmd/main.go`)
- Program entry → Provider configuration: loads configuration (evidence: `cmd/main.go`)
- Program entry → Logging: initializes logger (evidence: `cmd/main.go`)
- Program entry → Application assembly: starts application (evidence: `cmd/main.go`)
- Application assembly → Provider configuration: uses settings (evidence: `internal/app/app.go`)
- Application assembly → Delivery service setup: constructs delivery (evidence: `internal/app/app.go`)
- Application assembly → HTTP server: starts server (evidence: `internal/app/app.go`)
- Application assembly → Route registration: initializes routes (evidence: `internal/app/app.go`)
- Application assembly → Alert use case: constructs use cases (evidence: `internal/app/app.go`)
- Route registration → Authentication middleware: registers authentication (evidence: `internal/handler/handler.go`)
- Route registration → HTTP handlers: registers routes (evidence: `internal/handler/handler.go`)
- HTTP handlers → Alert use case: submits alert (evidence: `internal/handler/httphandler/alertHandler.go`)
- HTTP handlers → Alert model: wraps alert data (evidence: `internal/handler/httphandler/alertHandler.go`)
- Alert use case → Alert extraction: extracts alert details (evidence: `internal/usecase/alert/alert.go`)
- Alert use case → Recipient lookup: resolves recipients (evidence: `internal/usecase/alert/alert.go`)
- Alert use case → Alert model: uses alert settings (evidence: `internal/usecase/alert/alert.go`)
- Alert use case → Provider request delivery: requests delivery (evidence: `internal/usecase/alert/alert.go`)
- Delivery service setup → Provider request delivery: creates service (evidence: `internal/microservice/microservice.go`)
- Provider request delivery → Parameter factory: builds parameters (evidence: `internal/microservice/alert/alert.go`)
- Provider request delivery → HTTP client: posts request (evidence: `internal/microservice/alert/alert.go`)
- Provider request delivery → SMS / messaging API: sends HTTP POST (evidence: `README.md`)
- Parameter factory → HTTP parameter encoding: creates encoder (evidence: `pkg/httpparam/factory.go`)
