# expediteinternationa/monitor1 architecture

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

- Interactive diagram: https://gitdiagram.com/expediteinternationa/monitor1
- Repository: https://github.com/expediteinternationa/monitor1

## Overview

This repository implements an infrastructure and website-traffic dashboard. Users view fleet, container, traffic, and alert data, and can configure agent or direct-Docker sources; the frontend polls an API and presents the results. The backend has both a database-backed server and a file-backed live-server implementation, plus collection, alerting, and persistence components. The excerpts show only parts of the backend routes and UI, so uncertain inter-module calls are omitted; the API-to-server connection is shown as unverified.

Main entry points: [`frontend/src/App.js`](https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/App.js) (Dashboard shell), [`backend/server.py`](https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/server.py) (API and polling), [`frontend/src/lib/api.js`](https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/lib/api.js) (Polling API client), [`backend/live_server.py`](https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/live_server.py) (File-backed API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Dashboard UI"]
  node_app["Dashboard shell<br/>[App.js]"]
  node_api_client["Polling API client<br/>[api.js]"]
  node_fleet["Fleet overview<br/>[KpiStrip.js]"]
  node_server_charts["Server charts<br/>[ServerLoadChart.js]"]
  node_visitor_charts["Visitor charts<br/>[VisitorCharts.js]"]
  node_containers_ui["Container table<br/>[ContainersTable.js]"]
  node_traffic_ui["Traffic views<br/>[TrafficSection.js]"]
  node_setup_ui["Source setup<br/>[SetupPanel.js]"]
  node_alerts_ui["Alerts panel<br/>[AlertsPanel.js]"]
  node_infra_ui["Infrastructure view"]
end

subgraph group_api["Backend API"]
  node_server["API and polling<br/>[server.py]"]
  node_live_server["File-backed API<br/>[live_server.py]"]
  node_alerts["Alert evaluation<br/>[alerts.py]"]
  node_controls["Container controls<br/>[controls.py]"]
end

subgraph group_collection["Collection and Controls"]
  node_agent["Host agent<br/>[agent_script.py]"]
  node_docker["Docker utilities<br/>[docker_utils.py]"]
  node_gcp["GCP inventory<br/>[gcp_inventory.py]"]
  node_tracker["Website tracker<br/>[tracker.js]"]
end

subgraph group_persistence["Persistence"]
  node_mongo[("Mongo database<br/>[database.py]")]
  node_file_store[("File-backed store<br/>[file_store.py]")]
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_app
node_app -->|"polls through"| node_api_client
node_app -->|"renders"| node_fleet
node_app -->|"renders"| node_server_charts
node_app -->|"renders"| node_visitor_charts
node_app -->|"renders"| node_containers_ui
node_app -->|"renders"| node_traffic_ui
node_app -->|"renders"| node_setup_ui
node_app -->|"renders"| node_alerts_ui
node_app -->|"renders"| node_infra_ui
node_setup_ui -->|"requests via"| node_api_client
node_visitor_charts -->|"polls via"| node_api_client
node_infra_ui -->|"polls via"| node_api_client
node_api_client -.->|"sends API requests"| node_server
node_server -->|"reads and writes"| node_mongo
node_server -->|"evaluates alerts"| node_alerts
node_server -.->|"delegates controls"| node_controls
node_server -.->|"uses utilities"| node_docker
node_live_server -.->|"uses utilities"| node_docker
node_live_server -.->|"reads and writes"| node_file_store
node_live_server -.->|"uses inventory"| node_gcp
node_file_store -->|"parses user agents"| node_docker
node_agent -.->|"submits metrics"| node_server
node_tracker -.->|"submits tracking events"| node_server

click node_app "https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/App.js"
click node_api_client "https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/lib/api.js"
click node_fleet "https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/KpiStrip.js"
click node_server_charts "https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/ServerLoadChart.js"
click node_visitor_charts "https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/VisitorCharts.js"
click node_containers_ui "https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/ContainersTable.js"
click node_traffic_ui "https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/TrafficSection.js"
click node_setup_ui "https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/SetupPanel.js"
click node_alerts_ui "https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/AlertsPanel.js"
click node_infra_ui "https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/InfrastructurePanel.js"
click node_server "https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/server.py"
click node_live_server "https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/live_server.py"
click node_alerts "https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/alerts.py"
click node_controls "https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/controls.py"
click node_agent "https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/agent_script.py"
click node_docker "https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/docker_utils.py"
click node_gcp "https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/gcp_inventory.py"
click node_tracker "https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/tracker.js"
click node_mongo "https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/database.py"
click node_file_store "https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/file_store.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_app,node_api_client,node_fleet,node_server_charts,node_visitor_charts,node_containers_ui,node_traffic_ui,node_setup_ui,node_alerts_ui,node_infra_ui,node_user toneBlue
class node_server,node_live_server,node_alerts,node_controls toneAmber
class node_agent,node_docker,node_gcp,node_tracker toneMint
class node_mongo,node_file_store toneRose
```

## Components

### Dashboard UI

- [Dashboard shell](https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/App.js): `frontend/src/App.js`
- [Polling API client](https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/lib/api.js): `frontend/src/lib/api.js`
- [Fleet overview](https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/KpiStrip.js): `frontend/src/components/KpiStrip.js`
- [Server charts](https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/ServerLoadChart.js): `frontend/src/components/ServerLoadChart.js`
- [Visitor charts](https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/VisitorCharts.js): `frontend/src/components/VisitorCharts.js`
- [Container table](https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/ContainersTable.js): `frontend/src/components/ContainersTable.js`
- [Traffic views](https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/TrafficSection.js): `frontend/src/components/TrafficSection.js`
- [Source setup](https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/SetupPanel.js): `frontend/src/components/SetupPanel.js`
- [Alerts panel](https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/AlertsPanel.js): `frontend/src/components/AlertsPanel.js`
- [Infrastructure view](https://github.com/expediteinternationa/monitor1/blob/monitor1/frontend/src/components/InfrastructurePanel.js): `frontend/src/components/InfrastructurePanel.js`

### Backend API

- [API and polling](https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/server.py): `backend/server.py`
- [File-backed API](https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/live_server.py): `backend/live_server.py`
- [Alert evaluation](https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/alerts.py): `backend/alerts.py`
- [Container controls](https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/controls.py): `backend/controls.py`

### Collection and Controls

- [Host agent](https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/agent_script.py): `backend/agent_script.py`
- [Docker utilities](https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/docker_utils.py): `backend/docker_utils.py`
- [GCP inventory](https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/gcp_inventory.py): `backend/gcp_inventory.py`
- [Website tracker](https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/tracker.js): `backend/tracker.js`

### Persistence

- [Mongo database](https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/database.py): `backend/database.py`
- [File-backed store](https://github.com/expediteinternationa/monitor1/blob/monitor1/backend/file_store.py): `backend/file_store.py`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Dashboard shell: uses (evidence: `frontend/src/App.js`)
- Dashboard shell → Polling API client: polls through (evidence: `frontend/src/App.js`)
- Dashboard shell → Fleet overview: renders (evidence: `frontend/src/App.js`)
- Dashboard shell → Server charts: renders (evidence: `frontend/src/App.js`)
- Dashboard shell → Visitor charts: renders (evidence: `frontend/src/App.js`)
- Dashboard shell → Container table: renders (evidence: `frontend/src/App.js`)
- Dashboard shell → Traffic views: renders (evidence: `frontend/src/App.js`)
- Dashboard shell → Source setup: renders (evidence: `frontend/src/App.js`)
- Dashboard shell → Alerts panel: renders (evidence: `frontend/src/App.js`)
- Dashboard shell → Infrastructure view: renders (evidence: `frontend/src/App.js`)
- Source setup → Polling API client: requests via (evidence: `frontend/src/components/SetupPanel.js`)
- Visitor charts → Polling API client: polls via (evidence: `frontend/src/components/VisitorCharts.js`)
- Infrastructure view → Polling API client: polls via (evidence: `frontend/src/components/InfrastructurePanel.js`)
- Polling API client → API and polling: sends API requests
- API and polling → Mongo database: reads and writes (evidence: `backend/server.py`)
- API and polling → Alert evaluation: evaluates alerts (evidence: `backend/server.py`)
- API and polling → Container controls: delegates controls (evidence: `backend/server.py`)
- API and polling → Docker utilities: uses utilities (evidence: `backend/server.py`)
- File-backed API → Docker utilities: uses utilities (evidence: `backend/live_server.py`)
- File-backed API → File-backed store: reads and writes (evidence: `backend/live_server.py`)
- File-backed API → GCP inventory: uses inventory (evidence: `backend/live_server.py`)
- File-backed store → Docker utilities: parses user agents (evidence: `backend/file_store.py`)
- Host agent → API and polling: submits metrics
- Website tracker → API and polling: submits tracking events
