# Architecture Overview

The ASF Infrastructure Monitor is a lightweight, real-time monitoring solution designed to track the health of local servers and web services.

## System Components

```mermaid
graph TD
    User((User Browser))
    Caddy[Caddy Proxy]
    MonitorApp[Monitor App Container]
    
    subgraph "Local Network / Internet"
        PC[Ubuntu Server PC]
        PI[Raspberry Pi]
        WebServices[Web Services]
    end

    User -->|HTTPS| Caddy
    Caddy -->|HTTP| MonitorApp
    
    MonitorApp -->|SSH| PC
    MonitorApp -->|SSH| PI
    MonitorApp -->|HTTP/Ping| WebServices
```

### 1. Frontend (Client-Side)
- **Technology**: HTML5, Vanilla CSS, JavaScript (ES6+).
- **Libraries**: Chart.js for gauges, FontAwesome for icons.
- **Functionality**: Fetches data from the backend every 60 seconds and updates the UI dynamically without page reloads.

### 2. Backend (Server-Side)
- **Technology**: Python 3.11, FastAPI.
- **Monitoring Logic**:
    - **SSH**: Uses `paramiko` to execute remote commands on the PC and Raspberry Pi.
    - **Web**: Uses `requests` to check the status and latency of web services.
- **Concurrency**: Uses `asyncio` to perform all monitoring checks in parallel, ensuring fast response times.

### 3. Deployment
- **Containerization**: Docker & Docker Compose.
- **Proxy**: Caddy handles SSL termination and routes traffic to the container.
