# j0rdan-m/breachnotifier architecture

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

- Interactive diagram: https://gitdiagram.com/j0rdan-m/breachnotifier
- Repository: https://github.com/j0rdan-m/breachnotifier

## Overview

BreachNotifier periodically checks configured email addresses for breaches, filters results against persisted state, then logs and optionally notifies about new compromises. Configuration selects the checker, logger, and notifier implementations; the documented integrations include LeakCheck, Wazuh, and TheHive. The graph reflects the orchestration and calls visible in the excerpts. The ELK implementation is included as a documented selectable logger, but its behavior was not sampled.

Main entry points: [`main.go`](https://github.com/j0rdan-m/breachnotifier/blob/main/main.go) (Monitor runner), [`logger/factory.go`](https://github.com/j0rdan-m/breachnotifier/blob/main/logger/factory.go) (Logger factory), [`checker/factory.go`](https://github.com/j0rdan-m/breachnotifier/blob/main/checker/factory.go) (Checker factory), [`checker/leakcheck_checker.go`](https://github.com/j0rdan-m/breachnotifier/blob/main/checker/leakcheck_checker.go) (LeakCheck client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Monitoring flow"]
  node_main["Monitor runner<br/>[main.go]"]
end

subgraph group_configuration["Configuration and state"]
  node_config["YAML configuration<br/>[config.go]"]
  node_state[("Breach state<br/>[state.go]")]
end

subgraph group_checking["Breach checking"]
  node_checker_factory["Checker factory<br/>[factory.go]"]
  node_checker_api["Checker contract<br/>[checker.go]"]
  node_leakcheck["LeakCheck client"]
end

subgraph group_logging["Logging"]
  node_logger_factory["Logger factory<br/>[factory.go]"]
  node_wazuh_logger["Wazuh logger<br/>[wazuh_logger.go]"]
  node_elk_logger["ELK logger<br/>[elk_logger.go]"]
  node_log_contract["Log contract<br/>[logger.go]"]
end

subgraph group_notifications["Notifications"]
  node_notifier_factory["Notifier factory<br/>[factory.go]"]
  node_notifier_contract["Notification contract<br/>[notifier.go]"]
  node_thehive_notifier["TheHive client"]
end

node_operator(("Operator"))
node_leakcheck_service{{"LeakCheck API"}}
node_log_file[("JSON log file")]
node_thehive_service{{"TheHive"}}

node_operator -->|"runs"| node_main
node_main -->|"loads settings"| node_config
node_main -->|"loads and saves"| node_state
node_main -->|"selects checker"| node_checker_factory
node_checker_factory -->|"creates"| node_leakcheck
node_leakcheck -->|"checks email"| node_leakcheck_service
node_main -->|"filters new sources"| node_state
node_main -->|"selects logger"| node_logger_factory
node_logger_factory -->|"creates"| node_wazuh_logger
node_logger_factory -->|"creates"| node_elk_logger
node_main -->|"writes new breaches"| node_log_contract
node_wazuh_logger -->|"appends JSON"| node_log_file
node_main -->|"selects notifier"| node_notifier_factory
node_notifier_factory -->|"creates"| node_thehive_notifier
node_main -->|"sends new breaches"| node_notifier_contract
node_thehive_notifier -->|"posts alerts"| node_thehive_service

click node_main "https://github.com/j0rdan-m/breachnotifier/blob/main/main.go"
click node_config "https://github.com/j0rdan-m/breachnotifier/blob/main/config/config.go"
click node_state "https://github.com/j0rdan-m/breachnotifier/blob/main/config/state.go"
click node_checker_factory "https://github.com/j0rdan-m/breachnotifier/blob/main/checker/factory.go"
click node_checker_api "https://github.com/j0rdan-m/breachnotifier/blob/main/checker/checker.go"
click node_leakcheck "https://github.com/j0rdan-m/breachnotifier/blob/main/checker/leakcheck_checker.go"
click node_logger_factory "https://github.com/j0rdan-m/breachnotifier/blob/main/logger/factory.go"
click node_wazuh_logger "https://github.com/j0rdan-m/breachnotifier/blob/main/logger/wazuh_logger.go"
click node_elk_logger "https://github.com/j0rdan-m/breachnotifier/blob/main/logger/elk_logger.go"
click node_log_contract "https://github.com/j0rdan-m/breachnotifier/blob/main/logger/logger.go"
click node_notifier_factory "https://github.com/j0rdan-m/breachnotifier/blob/main/notifier/factory.go"
click node_notifier_contract "https://github.com/j0rdan-m/breachnotifier/blob/main/notifier/notifier.go"
click node_thehive_notifier "https://github.com/j0rdan-m/breachnotifier/blob/main/notifier/thehive_notifier.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 toneBlue
class node_config,node_state,node_log_file toneAmber
class node_checker_factory,node_checker_api,node_leakcheck,node_leakcheck_service toneMint
class node_logger_factory,node_wazuh_logger,node_elk_logger,node_log_contract toneRose
class node_notifier_factory,node_notifier_contract,node_thehive_notifier,node_operator,node_thehive_service toneIndigo
```

## Components

### Monitoring flow

- [Monitor runner](https://github.com/j0rdan-m/breachnotifier/blob/main/main.go): `main.go`

### Configuration and state

- [YAML configuration](https://github.com/j0rdan-m/breachnotifier/blob/main/config/config.go): `config/config.go`
- [Breach state](https://github.com/j0rdan-m/breachnotifier/blob/main/config/state.go): `config/state.go`

### Breach checking

- [Checker factory](https://github.com/j0rdan-m/breachnotifier/blob/main/checker/factory.go): `checker/factory.go`
- [Checker contract](https://github.com/j0rdan-m/breachnotifier/blob/main/checker/checker.go): `checker/checker.go`
- [LeakCheck client](https://github.com/j0rdan-m/breachnotifier/blob/main/checker/leakcheck_checker.go): `checker/leakcheck_checker.go`

### Logging

- [Logger factory](https://github.com/j0rdan-m/breachnotifier/blob/main/logger/factory.go): `logger/factory.go`
- [Wazuh logger](https://github.com/j0rdan-m/breachnotifier/blob/main/logger/wazuh_logger.go): `logger/wazuh_logger.go`
- [ELK logger](https://github.com/j0rdan-m/breachnotifier/blob/main/logger/elk_logger.go): `logger/elk_logger.go`
- [Log contract](https://github.com/j0rdan-m/breachnotifier/blob/main/logger/logger.go): `logger/logger.go`

### Notifications

- [Notifier factory](https://github.com/j0rdan-m/breachnotifier/blob/main/notifier/factory.go): `notifier/factory.go`
- [Notification contract](https://github.com/j0rdan-m/breachnotifier/blob/main/notifier/notifier.go): `notifier/notifier.go`
- [TheHive client](https://github.com/j0rdan-m/breachnotifier/blob/main/notifier/thehive_notifier.go): `notifier/thehive_notifier.go`

### Other components

- **Operator**
- **LeakCheck API**
- **JSON log file**
- **TheHive**

## Connections

- Operator → Monitor runner: runs (evidence: `README.md`)
- Monitor runner → YAML configuration: loads settings (evidence: `main.go`)
- Monitor runner → Breach state: loads and saves (evidence: `main.go`)
- Monitor runner → Checker factory: selects checker (evidence: `main.go`)
- Checker factory → LeakCheck client: creates (evidence: `checker/factory.go`)
- LeakCheck client → LeakCheck API: checks email (evidence: `checker/leakcheck_checker.go`)
- Monitor runner → Breach state: filters new sources (evidence: `main.go`)
- Monitor runner → Logger factory: selects logger (evidence: `main.go`)
- Logger factory → Wazuh logger: creates (evidence: `logger/factory.go`)
- Logger factory → ELK logger: creates (evidence: `logger/factory.go`)
- Monitor runner → Log contract: writes new breaches (evidence: `main.go`)
- Wazuh logger → JSON log file: appends JSON (evidence: `logger/wazuh_logger.go`)
- Monitor runner → Notifier factory: selects notifier (evidence: `main.go`)
- Notifier factory → TheHive client: creates (evidence: `notifier/factory.go`)
- Monitor runner → Notification contract: sends new breaches (evidence: `main.go`)
- TheHive client → TheHive: posts alerts (evidence: `notifier/thehive_notifier.go`)
