# nysakun/website-uptime-monitor-updated architecture

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

- Interactive diagram: https://gitdiagram.com/nysakun/website-uptime-monitor-updated
- Repository: https://github.com/nysakun/website-uptime-monitor-updated

## Overview

This uptime-monitoring application checks domains, IPs, and URLs through CLI and web/API entry points, then stores results for history and uptime reporting. Its main flow validates a target, probes DNS/HTTP with redirect safety, records a result, and presents status or history. The README also documents dashboard watchlists and background monitoring. Source excerpts show most direct calls; the dashboard is served from index.html, while its browser-side API interactions are documented but not sampled.

Main entry points: [`api.py`](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/api.py) (REST API), [`database.py`](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/database.py) (Check and watch storage), [`checker.py`](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/checker.py) (Target checker), [`cli.py`](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/cli.py) (CLI commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_main["CLI entry<br/>[main.py]"]
  node_dashboard["Dashboard page<br/>[index.html]"]
  node_api["REST API<br/>[api.py]"]
end

subgraph group_checking["Check and safety"]
  node_checker["Target checker<br/>[checker.py]"]
  node_safety["Target safety<br/>[safety.py]"]
  node_diagnose["Failure explanations<br/>[diagnose.py]"]
end

subgraph group_monitoring["Watch monitoring"]
  node_worker["Watch worker<br/>[worker.py]"]
  node_watchlist["Watchlist controls<br/>[api.py]"]
end

subgraph group_records["History and reports"]
  node_database[("Check and watch storage<br/>[database.py]")]
  node_stats["Uptime statistics<br/>[stats.py]"]
end

subgraph group_controls["API controls"]
  node_rate_limit["IP rate limiter<br/>[ratelimit.py]"]
end

node_cli_user(("CLI user"))
node_dashboard_user(("Dashboard user"))
node_integrator(("API client"))
node_sqlite_mysql[("SQLite or MySQL")]

node_cli_user -->|"runs"| node_main
node_main -->|"invokes"| node_cli
node_cli -->|"checks targets"| node_checker
node_cli -->|"saves and reads"| node_database
node_cli -->|"requests reports"| node_stats
node_dashboard_user -->|"uses"| node_dashboard
node_dashboard -.->|"calls API"| node_api
node_integrator -->|"requests"| node_api
node_api -->|"checks target"| node_checker
node_api -->|"validates targets"| node_safety
node_api -->|"reads and saves"| node_database
node_api -->|"builds reports"| node_stats
node_api -->|"limits requests"| node_rate_limit
node_checker -->|"checks redirect IPs"| node_safety
node_checker -.->|"explained by"| node_diagnose
node_api -->|"starts and stops"| node_worker
node_api -->|"handles watchlist"| node_watchlist
node_watchlist -->|"updates watchlist"| node_database
node_worker -->|"reads targets, saves checks"| node_database
node_worker -->|"filters targets"| node_safety
node_worker -->|"checks targets"| node_checker
node_stats -->|"queries history"| node_database
node_database -->|"uses configured engine"| node_sqlite_mysql

click node_cli "https://github.com/nysakun/website-uptime-monitor-updated/blob/main/cli.py"
click node_main "https://github.com/nysakun/website-uptime-monitor-updated/blob/main/main.py"
click node_dashboard "https://github.com/nysakun/website-uptime-monitor-updated/blob/main/index.html"
click node_api "https://github.com/nysakun/website-uptime-monitor-updated/blob/main/api.py"
click node_checker "https://github.com/nysakun/website-uptime-monitor-updated/blob/main/checker.py"
click node_safety "https://github.com/nysakun/website-uptime-monitor-updated/blob/main/safety.py"
click node_diagnose "https://github.com/nysakun/website-uptime-monitor-updated/blob/main/diagnose.py"
click node_worker "https://github.com/nysakun/website-uptime-monitor-updated/blob/main/worker.py"
click node_watchlist "https://github.com/nysakun/website-uptime-monitor-updated/blob/main/api.py"
click node_database "https://github.com/nysakun/website-uptime-monitor-updated/blob/main/database.py"
click node_stats "https://github.com/nysakun/website-uptime-monitor-updated/blob/main/stats.py"
click node_rate_limit "https://github.com/nysakun/website-uptime-monitor-updated/blob/main/ratelimit.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_cli,node_main,node_dashboard,node_api,node_cli_user,node_dashboard_user,node_integrator toneBlue
class node_checker,node_safety,node_diagnose,node_sqlite_mysql toneAmber
class node_worker,node_watchlist toneMint
class node_database,node_stats toneRose
class node_rate_limit toneIndigo
```

## Components

### User interfaces

- [CLI commands](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/cli.py): `cli.py`
- [CLI entry](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/main.py): `main.py`
- [Dashboard page](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/index.html): `index.html`
- [REST API](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/api.py): `api.py`

### Check and safety

- [Target checker](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/checker.py): `checker.py`
- [Target safety](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/safety.py): `safety.py`
- [Failure explanations](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/diagnose.py): `diagnose.py`

### Watch monitoring

- [Watch worker](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/worker.py): `worker.py`
- [Watchlist controls](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/api.py): `api.py`

### History and reports

- [Check and watch storage](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/database.py): `database.py`
- [Uptime statistics](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/stats.py): `stats.py`

### API controls

- [IP rate limiter](https://github.com/nysakun/website-uptime-monitor-updated/blob/main/ratelimit.py): `ratelimit.py`

### Other components

- **CLI user**
- **Dashboard user**
- **API client**
- **SQLite or MySQL**

## Connections

- CLI user → CLI entry: runs (evidence: `README.md`)
- CLI entry → CLI commands: invokes (evidence: `main.py`)
- CLI commands → Target checker: checks targets (evidence: `cli.py`)
- CLI commands → Check and watch storage: saves and reads (evidence: `cli.py`)
- CLI commands → Uptime statistics: requests reports (evidence: `cli.py`)
- Dashboard user → Dashboard page: uses (evidence: `README.md`)
- Dashboard page → REST API: calls API
- API client → REST API: requests (evidence: `README.md`)
- REST API → Target checker: checks target (evidence: `api.py`)
- REST API → Target safety: validates targets (evidence: `api.py`)
- REST API → Check and watch storage: reads and saves (evidence: `api.py`)
- REST API → Uptime statistics: builds reports (evidence: `api.py`)
- REST API → IP rate limiter: limits requests (evidence: `api.py`)
- Target checker → Target safety: checks redirect IPs (evidence: `README.md`)
- Target checker → Failure explanations: explained by
- REST API → Watch worker: starts and stops (evidence: `api.py`)
- REST API → Watchlist controls: handles watchlist (evidence: `api.py`)
- Watchlist controls → Check and watch storage: updates watchlist (evidence: `api.py`)
- Watch worker → Check and watch storage: reads targets, saves checks (evidence: `worker.py`)
- Watch worker → Target safety: filters targets (evidence: `worker.py`)
- Watch worker → Target checker: checks targets (evidence: `worker.py`)
- Uptime statistics → Check and watch storage: queries history (evidence: `stats.py`)
- Check and watch storage → SQLite or MySQL: uses configured engine (evidence: `README.md`)
