# ahmedabrarzayad/infra-monitor architecture

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

- Interactive diagram: https://gitdiagram.com/ahmedabrarzayad/infra-monitor
- Repository: https://github.com/ahmedabrarzayad/infra-monitor

## Overview

Infra Monitor is a Django backend, a Flutter client, and a separate ML service for Linux-server monitoring. The principal workflow enrolls an organization’s server, receives telemetry, and presents operational data and work items—alerts, incidents, logs, and anomaly detections—to users. The graph preserves those distinct domain stages and the Request Shield and AI-assistant capabilities. Several feature relationships are documented in the README; unsampled implementation details are not inferred. The supplied tree contains no Flutter application source files, so the client is represented only by its initiating users.

Main entry points: [`backend/infra_monitor/urls.py`](https://github.com/ahmedabrarzayad/infra-monitor/blob/main/backend/infra_monitor/urls.py) (Django API routing), [`backend/servers`](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/servers) (Servers and services), [`backend/ml_model`](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/ml_model) (Anomaly detections), [`backend/common/authorization.py`](https://github.com/ahmedabrarzayad/infra-monitor/blob/main/backend/common/authorization.py) (Membership authorization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Accounts and access"]
  node_accounts["Accounts and enrollment"]
  node_org_access["Membership authorization<br/>[authorization.py]"]
end

subgraph group_monitor["Monitoring and ingestion"]
  node_installer["Installer and ingestion"]
  node_servers[("Servers and services")]
  node_metrics["Telemetry queries<br/>[victoriametrics.py]"]
end

subgraph group_operations["Operational workflows"]
  node_alerts["Alerts"]
  node_incidents[("Incidents and updates")]
  node_logs[("Operational logs")]
  node_dashboard["Dashboard analytics"]
end

subgraph group_intelligence["Analytics and assistance"]
  node_ml_records[("Anomaly detections")]
  node_ml_tasks["Inference orchestration<br/>[tasks.py]"]
  node_ml_service["ML service<br/>[main.py]"]
  node_assistant["AI assistant"]
  node_shield["Request Shield"]
end

subgraph group_platform["Platform services"]
  node_notifications["Notifications"]
  node_django["Django API routing<br/>[urls.py]"]
end

node_user(("Organization user"))
node_victoria[("VictoriaMetrics")]
node_alloy["Grafana Alloy"]

node_user -->|"enrolls"| node_accounts
node_accounts -.->|"registers organization"| node_servers
node_alloy -->|"writes telemetry"| node_victoria
node_installer -->|"enrolls hosts"| node_servers
node_installer -->|"accepts remote writes"| node_victoria
node_user -->|"views overview"| node_dashboard
node_user -->|"reviews alerts"| node_alerts
node_user -->|"manages incidents"| node_incidents
node_user -->|"views logs"| node_logs
node_user -->|"reviews anomalies"| node_ml_records
node_metrics -->|"queries metrics"| node_victoria
node_ml_tasks -->|"loads services"| node_servers
node_ml_tasks -->|"trains and infers"| node_ml_service
node_ml_service -->|"posts detections"| node_ml_records
node_user -.->|"asks questions"| node_assistant
node_assistant -->|"uses anomaly evidence"| node_ml_records
node_assistant -.->|"streams guidance"| node_user
node_shield -->|"classifies requests"| node_ml_service
node_django -->|"routes API"| node_accounts
node_django -->|"routes API"| node_servers
node_django -->|"routes API"| node_alerts
node_django -->|"routes API"| node_incidents
node_django -->|"routes API"| node_logs
node_org_access -->|"limits visibility"| node_servers
node_org_access -->|"limits visibility"| node_incidents
node_org_access -->|"limits visibility"| node_ml_records
node_notifications -.->|"delivers updates"| node_user

click node_accounts "https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/accounts"
click node_org_access "https://github.com/ahmedabrarzayad/infra-monitor/blob/main/backend/common/authorization.py"
click node_installer "https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/installer"
click node_servers "https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/servers"
click node_metrics "https://github.com/ahmedabrarzayad/infra-monitor/blob/main/backend/servers/services/victoriametrics.py"
click node_alerts "https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/alert"
click node_incidents "https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/incident"
click node_logs "https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/log"
click node_dashboard "https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/dashboard"
click node_ml_records "https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/ml_model"
click node_ml_tasks "https://github.com/ahmedabrarzayad/infra-monitor/blob/main/backend/ml_model/tasks.py"
click node_ml_service "https://github.com/ahmedabrarzayad/infra-monitor/blob/main/model/app/main.py"
click node_assistant "https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/ai"
click node_shield "https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/sanitize"
click node_notifications "https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/notifications"
click node_django "https://github.com/ahmedabrarzayad/infra-monitor/blob/main/backend/infra_monitor/urls.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_accounts,node_org_access,node_user toneBlue
class node_installer,node_servers,node_metrics,node_victoria toneAmber
class node_alerts,node_incidents,node_logs,node_dashboard toneMint
class node_ml_records,node_ml_tasks,node_ml_service,node_assistant,node_shield toneRose
class node_notifications,node_django,node_alloy toneIndigo
```

## Components

### Accounts and access

- [Accounts and enrollment](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/accounts): `backend/accounts`
- [Membership authorization](https://github.com/ahmedabrarzayad/infra-monitor/blob/main/backend/common/authorization.py): `backend/common/authorization.py`

### Monitoring and ingestion

- [Installer and ingestion](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/installer): `backend/installer`
- [Servers and services](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/servers): `backend/servers`
- [Telemetry queries](https://github.com/ahmedabrarzayad/infra-monitor/blob/main/backend/servers/services/victoriametrics.py): `backend/servers/services/victoriametrics.py`

### Operational workflows

- [Alerts](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/alert): `backend/alert`
- [Incidents and updates](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/incident): `backend/incident`
- [Operational logs](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/log): `backend/log`
- [Dashboard analytics](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/dashboard): `backend/dashboard`

### Analytics and assistance

- [Anomaly detections](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/ml_model): `backend/ml_model`
- [Inference orchestration](https://github.com/ahmedabrarzayad/infra-monitor/blob/main/backend/ml_model/tasks.py): `backend/ml_model/tasks.py`
- [ML service](https://github.com/ahmedabrarzayad/infra-monitor/blob/main/model/app/main.py): `model/app/main.py`
- [AI assistant](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/ai): `backend/ai`
- [Request Shield](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/sanitize): `backend/sanitize`

### Platform services

- [Notifications](https://github.com/ahmedabrarzayad/infra-monitor/tree/main/backend/notifications): `backend/notifications`
- [Django API routing](https://github.com/ahmedabrarzayad/infra-monitor/blob/main/backend/infra_monitor/urls.py): `backend/infra_monitor/urls.py`

### Other components

- **Organization user**
- **VictoriaMetrics**
- **Grafana Alloy**

## Connections

- Organization user → Accounts and enrollment: enrolls
- Accounts and enrollment → Servers and services: registers organization (evidence: `backend/accounts/services/organization_service.py`)
- Grafana Alloy → VictoriaMetrics: writes telemetry
- Installer and ingestion → Servers and services: enrolls hosts
- Installer and ingestion → VictoriaMetrics: accepts remote writes
- Organization user → Dashboard analytics: views overview
- Organization user → Alerts: reviews alerts
- Organization user → Incidents and updates: manages incidents
- Organization user → Operational logs: views logs
- Organization user → Anomaly detections: reviews anomalies
- Telemetry queries → VictoriaMetrics: queries metrics
- Inference orchestration → Servers and services: loads services (evidence: `backend/ml_model/tasks.py`)
- Inference orchestration → ML service: trains and infers (evidence: `backend/ml_model/tasks.py`)
- ML service → Anomaly detections: posts detections (evidence: `model/app/main.py`)
- Organization user → AI assistant: asks questions
- AI assistant → Anomaly detections: uses anomaly evidence (evidence: `backend/ai/services.py`)
- AI assistant → Organization user: streams guidance
- Request Shield → ML service: classifies requests (evidence: `backend/sanitize/services.py`)
- Django API routing → Accounts and enrollment: routes API
- Django API routing → Servers and services: routes API
- Django API routing → Alerts: routes API
- Django API routing → Incidents and updates: routes API
- Django API routing → Operational logs: routes API
- Membership authorization → Servers and services: limits visibility (evidence: `backend/common/authorization.py`)
- Membership authorization → Incidents and updates: limits visibility (evidence: `backend/common/authorization.py`)
- Membership authorization → Anomaly detections: limits visibility (evidence: `backend/common/authorization.py`)
- Notifications → Organization user: delivers updates
