# ryukxo-code/watchpost architecture

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

- Interactive diagram: https://gitdiagram.com/ryukxo-code/watchpost
- Repository: https://github.com/ryukxo-code/watchpost

## Overview

Watchpost lets users register HTTP endpoints, then checks them manually or on a configured schedule. Checks update in-memory endpoint status, latency, uptime, and recent history; status changes can trigger email alerts. Users view and manage monitoring from a React dashboard, including latency charts and uptime history, or use the REST API. The sampled backend and frontend show these paths; scheduler and alert capabilities are documented and their wiring is visible in the backend excerpts.

Main entry points: [`app/monitor.py`](https://github.com/ryukxo-code/watchpost/blob/main/app/monitor.py) (Checks and history), [`app/main.py`](https://github.com/ryukxo-code/watchpost/blob/main/app/main.py) (REST routes), [`frontend/src/App.jsx`](https://github.com/ryukxo-code/watchpost/blob/main/frontend/src/App.jsx) (Dashboard and charts), [`app/alerts.py`](https://github.com/ryukxo-code/watchpost/blob/main/app/alerts.py) (Email alerts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Dashboard"]
  node_dashboard["Dashboard and charts<br/>[App.jsx]"]
end

subgraph group_api["API orchestration"]
  node_api_routes["REST routes<br/>[main.py]"]
  node_scheduler["Check scheduler<br/>[main.py]"]
end

subgraph group_monitoring["Monitoring domain"]
  node_endpoint_model["Endpoint models<br/>[models.py]"]
  node_monitor["Checks and history<br/>[monitor.py]"]
  node_endpoint_store["In-memory endpoints<br/>[monitor.py]"]
  node_alerts["Email alerts<br/>[alerts.py]"]
end

node_user(("Operator"))
node_target_api(("Monitored endpoints"))
node_smtp(("Gmail SMTP"))

node_user -->|"manages endpoints"| node_dashboard
node_dashboard -->|"calls REST API"| node_api_routes
node_api_routes -->|"invokes checks"| node_monitor
node_api_routes -->|"manages endpoints"| node_monitor
node_api_routes -->|"registers checks"| node_scheduler
node_scheduler -->|"runs checks"| node_monitor
node_monitor -->|"creates results"| node_endpoint_model
node_monitor -->|"updates state"| node_endpoint_store
node_monitor -->|"sends HTTP checks"| node_target_api
node_monitor -->|"dispatches alerts"| node_alerts
node_alerts -->|"sends email"| node_smtp

click node_dashboard "https://github.com/ryukxo-code/watchpost/blob/main/frontend/src/App.jsx"
click node_api_routes "https://github.com/ryukxo-code/watchpost/blob/main/app/main.py"
click node_scheduler "https://github.com/ryukxo-code/watchpost/blob/main/app/main.py"
click node_endpoint_model "https://github.com/ryukxo-code/watchpost/blob/main/app/models.py"
click node_monitor "https://github.com/ryukxo-code/watchpost/blob/main/app/monitor.py"
click node_endpoint_store "https://github.com/ryukxo-code/watchpost/blob/main/app/monitor.py"
click node_alerts "https://github.com/ryukxo-code/watchpost/blob/main/app/alerts.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_dashboard toneBlue
class node_api_routes,node_scheduler toneAmber
class node_endpoint_model,node_monitor,node_endpoint_store,node_alerts toneMint
class node_user,node_target_api,node_smtp toneIndigo
```

## Components

### Dashboard

- [Dashboard and charts](https://github.com/ryukxo-code/watchpost/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### API orchestration

- [REST routes](https://github.com/ryukxo-code/watchpost/blob/main/app/main.py): `app/main.py`
- [Check scheduler](https://github.com/ryukxo-code/watchpost/blob/main/app/main.py): `app/main.py`

### Monitoring domain

- [Endpoint models](https://github.com/ryukxo-code/watchpost/blob/main/app/models.py): `app/models.py`
- [Checks and history](https://github.com/ryukxo-code/watchpost/blob/main/app/monitor.py): `app/monitor.py`
- [In-memory endpoints](https://github.com/ryukxo-code/watchpost/blob/main/app/monitor.py): `app/monitor.py`
- [Email alerts](https://github.com/ryukxo-code/watchpost/blob/main/app/alerts.py): `app/alerts.py`

### Other components

- **Operator**
- **Monitored endpoints**
- **Gmail SMTP**

## Connections

- Operator → Dashboard and charts: manages endpoints (evidence: `README.md`)
- Dashboard and charts → REST routes: calls REST API (evidence: `frontend/src/App.jsx`)
- REST routes → Checks and history: invokes checks (evidence: `app/main.py`)
- REST routes → Checks and history: manages endpoints (evidence: `app/main.py`)
- REST routes → Check scheduler: registers checks (evidence: `app/main.py`)
- Check scheduler → Checks and history: runs checks (evidence: `app/main.py`)
- Checks and history → Endpoint models: creates results (evidence: `app/monitor.py`)
- Checks and history → In-memory endpoints: updates state (evidence: `app/monitor.py`)
- Checks and history → Monitored endpoints: sends HTTP checks (evidence: `app/monitor.py`)
- Checks and history → Email alerts: dispatches alerts (evidence: `app/monitor.py`)
- Email alerts → Gmail SMTP: sends email (evidence: `app/alerts.py`)
