# ellkinox/uptime-monitor architecture

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

- Interactive diagram: https://gitdiagram.com/ellkinox/uptime-monitor
- Repository: https://github.com/ellkinox/uptime-monitor

## Overview

Uptime Monitor serves a browser page through nginx and a load balancer. The browser requests status; the FastAPI endpoint refreshes a 30-second in-memory cache by checking configured websites, then returns the results and backend hostname. The README also documents separate frontend/backend containers on ECS Fargate, with nginx reaching the backend through Service Connect. Infrastructure links reflect documented deployment topology; source excerpts show the API and checking logic, but not the frontend or Terraform implementation details.

Main entry points: [`backend/main.py`](https://github.com/ellkinox/uptime-monitor/blob/main/backend/main.py) (Status API), [`frontend/nginx.conf`](https://github.com/ellkinox/uptime-monitor/blob/main/frontend/nginx.conf) (nginx proxy), [`infra/ecs.tf`](https://github.com/ellkinox/uptime-monitor/blob/main/infra/ecs.tf) (ECS Fargate), [`infra/loadbalancer.tf`](https://github.com/ellkinox/uptime-monitor/blob/main/infra/loadbalancer.tf) (Load balancer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Web presentation"]
  node_nginx["nginx proxy<br/>[nginx.conf]"]
  node_web_page["Status page<br/>[index.html]"]
end

subgraph group_monitoring["Uptime monitoring"]
  node_api["Status API<br/>[main.py]"]
  node_cache[("Result cache<br/>[main.py]")]
  node_site_checker["Website checker<br/>[main.py]"]
end

subgraph group_deployment["AWS deployment"]
  node_load_balancer{{"Load balancer<br/>[loadbalancer.tf]"}}
  node_ecs["ECS Fargate<br/>[ecs.tf]"]
  node_network["VPC network<br/>[network.tf]"]
end

node_browser(("Visitor browser"))
node_monitored_sites(("Monitored websites"))

node_browser -->|"requests page"| node_load_balancer
node_load_balancer -->|"routes traffic"| node_nginx
node_nginx -->|"serves page"| node_web_page
node_browser -->|"requests status"| node_nginx
node_nginx -->|"forwards /api"| node_api
node_api -->|"reads and refreshes"| node_cache
node_api -->|"checks expired results"| node_site_checker
node_site_checker -->|"requests URLs"| node_monitored_sites
node_api -->|"returns status JSON"| node_browser
node_ecs -->|"runs frontend"| node_nginx
node_ecs -->|"runs backend"| node_api
node_network -.->|"hosts services"| node_ecs

click node_load_balancer "https://github.com/ellkinox/uptime-monitor/blob/main/infra/loadbalancer.tf"
click node_nginx "https://github.com/ellkinox/uptime-monitor/blob/main/frontend/nginx.conf"
click node_web_page "https://github.com/ellkinox/uptime-monitor/blob/main/frontend/index.html"
click node_ecs "https://github.com/ellkinox/uptime-monitor/blob/main/infra/ecs.tf"
click node_api "https://github.com/ellkinox/uptime-monitor/blob/main/backend/main.py"
click node_cache "https://github.com/ellkinox/uptime-monitor/blob/main/backend/main.py"
click node_site_checker "https://github.com/ellkinox/uptime-monitor/blob/main/backend/main.py"
click node_network "https://github.com/ellkinox/uptime-monitor/blob/main/infra/network.tf"

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_nginx,node_web_page,node_browser toneBlue
class node_api,node_cache,node_site_checker toneAmber
class node_load_balancer,node_ecs,node_network toneMint
class node_monitored_sites toneIndigo
```

## Components

### Web presentation

- [nginx proxy](https://github.com/ellkinox/uptime-monitor/blob/main/frontend/nginx.conf): `frontend/nginx.conf`
- [Status page](https://github.com/ellkinox/uptime-monitor/blob/main/frontend/index.html): `frontend/index.html`

### Uptime monitoring

- [Status API](https://github.com/ellkinox/uptime-monitor/blob/main/backend/main.py): `backend/main.py`
- [Result cache](https://github.com/ellkinox/uptime-monitor/blob/main/backend/main.py): `backend/main.py`
- [Website checker](https://github.com/ellkinox/uptime-monitor/blob/main/backend/main.py): `backend/main.py`

### AWS deployment

- [Load balancer](https://github.com/ellkinox/uptime-monitor/blob/main/infra/loadbalancer.tf): `infra/loadbalancer.tf`
- [ECS Fargate](https://github.com/ellkinox/uptime-monitor/blob/main/infra/ecs.tf): `infra/ecs.tf`
- [VPC network](https://github.com/ellkinox/uptime-monitor/blob/main/infra/network.tf): `infra/network.tf`

### Other components

- **Visitor browser**
- **Monitored websites**

## Connections

- Visitor browser → Load balancer: requests page (evidence: `README.md`)
- Load balancer → nginx proxy: routes traffic (evidence: `README.md`)
- nginx proxy → Status page: serves page (evidence: `README.md`)
- Visitor browser → nginx proxy: requests status (evidence: `README.md`)
- nginx proxy → Status API: forwards /api (evidence: `README.md`)
- Status API → Result cache: reads and refreshes (evidence: `backend/main.py`)
- Status API → Website checker: checks expired results (evidence: `backend/main.py`)
- Website checker → Monitored websites: requests URLs (evidence: `backend/main.py`)
- Status API → Visitor browser: returns status JSON (evidence: `backend/main.py`)
- ECS Fargate → nginx proxy: runs frontend (evidence: `README.md`)
- ECS Fargate → Status API: runs backend (evidence: `README.md`)
- VPC network → ECS Fargate: hosts services
