# justinthoms/network-config-manager architecture

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

- Interactive diagram: https://gitdiagram.com/justinthoms/network-config-manager
- Repository: https://github.com/justinthoms/network-config-manager

## Overview

NCM is a self-hosted network configuration operations manager. Operators add devices, trigger or schedule SSH backups, inspect configuration changes and health, and optionally send masked configuration data for AI review; backups can also be copied off-site. The graph includes administration and security capabilities documented in the README. Router registration and startup wiring are visible in `main.py`; some service-to-API calls are not shown in the excerpts, so those links are omitted. Several feature branches are documented capabilities rather than inspected implementations.

Main entry points: [`backend/app/main.py`](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/services/ai_review.py`](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/ai_review.py) (AI change review), [`backend/app/api/backups.py`](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/backups.py) (Backup endpoints), [`backend/app/core/database.py`](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/core/database.py) (Application database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_app["FastAPI application<br/>[main.py]"]
end

subgraph group_operations["Network operations"]
  node_device_api["Device inventory<br/>[devices.py]"]
  node_backup_api["Backup endpoints<br/>[backups.py]"]
  node_backup_service["SSH backup service<br/>[backup.py]"]
  node_schedules["Backup schedules<br/>[scheduler.py]"]
  node_diff["Change comparison<br/>[diff.py]"]
  node_health_api["Device health<br/>[health.py]"]
  node_files_api["Backup file browser<br/>[files.py]"]
  node_maintenance["Background maintenance<br/>[maintenance.py]"]
end

subgraph group_ai["AI capabilities"]
  node_ai_api["AI endpoints<br/>[ai.py]"]
  node_ai_review["AI change review<br/>[ai_review.py]"]
  node_assistant["Network assistant<br/>[assistant.py]"]
  node_llm["Language model client<br/>[llm.py]"]
  node_ai_providers["AI provider connections<br/>[ai_providers.py]"]
end

subgraph group_admin["Administration and security"]
  node_auth_api["Authentication<br/>[auth.py]"]
  node_users_api["User administration<br/>[users.py]"]
  node_security_api["Security self-check<br/>[security.py]"]
  node_audit_api["Audit log<br/>[audit.py]"]
  node_hardening["Permission hardening<br/>[hardening.py]"]
end

subgraph group_storage["Persistence and integrations"]
  node_cloud_api["Google Drive copies<br/>[cloud.py]"]
  node_onedrive_api["OneDrive copies<br/>[onedrive.py]"]
  node_db[("Application database<br/>[database.py]")]
  node_backup_model["Backup records<br/>[backup.py]"]
  node_ai_review_model["AI review records<br/>[ai_review.py]"]
  node_user_model["User records<br/>[user.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

node_operator(("NOC operator"))
node_external_ai(("Configured AI service"))
node_network_devices(("Managed network devices"))
node_cloud_services(("Cloud storage services"))

node_operator -->|"uses"| node_app
node_app -->|"routes to"| node_device_api
node_app -->|"routes to"| node_backup_api
node_app -->|"routes to"| node_health_api
node_app -->|"routes to"| node_files_api
node_app -->|"routes to"| node_ai_api
node_app -->|"routes to"| node_auth_api
node_app -->|"routes to"| node_users_api
node_app -->|"routes to"| node_security_api
node_app -->|"routes to"| node_audit_api
node_app -->|"routes to"| node_cloud_api
node_app -->|"routes to"| node_onedrive_api
node_app -->|"initializes"| node_db
node_app -->|"starts"| node_schedules
node_app -->|"starts"| node_maintenance
node_network_devices -->|"provides configuration"| node_backup_service
node_schedules -.->|"runs scheduled backups"| node_backup_service
node_backup_service -.->|"records backups"| node_backup_model
node_backup_model -.->|"persists in"| node_db
node_backup_api -.->|"compares backups"| node_diff
node_ai_api -.->|"provides reviews"| node_ai_review
node_ai_review -->|"uses comparison"| node_diff
node_ai_review -->|"requests completion"| node_llm
node_ai_review -->|"selects providers"| node_ai_providers
node_assistant -.->|"uses language models"| node_llm
node_llm -->|"sends masked requests"| node_external_ai
node_ai_review -->|"stores results"| node_ai_review_model
node_ai_review_model -.->|"persists in"| node_db
node_operator -->|"checks device health"| node_health_api
node_backup_api -.->|"copies backups"| node_cloud_api
node_backup_api -.->|"copies backups"| node_onedrive_api
node_cloud_api -->|"uploads copies"| node_cloud_services
node_onedrive_api -->|"uploads copies"| node_cloud_services
node_db -->|"uses database settings"| node_config
node_app -->|"runs startup checks"| node_hardening
node_auth_api -->|"authenticates users"| node_user_model

click node_app "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/main.py"
click node_device_api "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/devices.py"
click node_backup_api "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/backups.py"
click node_backup_service "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/backup.py"
click node_schedules "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/scheduler.py"
click node_diff "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/diff.py"
click node_health_api "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/health.py"
click node_files_api "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/files.py"
click node_ai_api "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/ai.py"
click node_ai_review "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/ai_review.py"
click node_assistant "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/assistant.py"
click node_llm "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/llm.py"
click node_ai_providers "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/ai_providers.py"
click node_auth_api "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/auth.py"
click node_users_api "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/users.py"
click node_security_api "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/security.py"
click node_audit_api "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/audit.py"
click node_cloud_api "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/cloud.py"
click node_onedrive_api "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/onedrive.py"
click node_db "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/core/database.py"
click node_backup_model "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/models/backup.py"
click node_ai_review_model "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/models/ai_review.py"
click node_user_model "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/models/user.py"
click node_config "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/core/config.py"
click node_hardening "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/hardening.py"
click node_maintenance "https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/maintenance.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 toneBlue
class node_device_api,node_backup_api,node_backup_service,node_schedules,node_diff,node_health_api,node_files_api,node_maintenance,node_cloud_services toneAmber
class node_ai_api,node_ai_review,node_assistant,node_llm,node_ai_providers toneMint
class node_auth_api,node_users_api,node_security_api,node_audit_api,node_hardening toneRose
class node_cloud_api,node_onedrive_api,node_db,node_backup_model,node_ai_review_model,node_user_model,node_config,node_operator,node_external_ai,node_network_devices toneIndigo
```

## Components

### Application entry

- [FastAPI application](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/main.py): `backend/app/main.py`

### Network operations

- [Device inventory](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/devices.py): `backend/app/api/devices.py`
- [Backup endpoints](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/backups.py): `backend/app/api/backups.py`
- [SSH backup service](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/backup.py): `backend/app/services/backup.py`
- [Backup schedules](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/scheduler.py): `backend/app/services/scheduler.py`
- [Change comparison](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/diff.py): `backend/app/services/diff.py`
- [Device health](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/health.py): `backend/app/api/health.py`
- [Backup file browser](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/files.py): `backend/app/api/files.py`
- [Background maintenance](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/maintenance.py): `backend/app/services/maintenance.py`

### AI capabilities

- [AI endpoints](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/ai.py): `backend/app/api/ai.py`
- [AI change review](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/ai_review.py): `backend/app/services/ai_review.py`
- [Network assistant](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/assistant.py): `backend/app/services/assistant.py`
- [Language model client](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/llm.py): `backend/app/services/llm.py`
- [AI provider connections](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/ai_providers.py): `backend/app/services/ai_providers.py`

### Administration and security

- [Authentication](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [User administration](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/users.py): `backend/app/api/users.py`
- [Security self-check](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/security.py): `backend/app/api/security.py`
- [Audit log](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/audit.py): `backend/app/api/audit.py`
- [Permission hardening](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/services/hardening.py): `backend/app/services/hardening.py`

### Persistence and integrations

- [Google Drive copies](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/cloud.py): `backend/app/api/cloud.py`
- [OneDrive copies](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/api/onedrive.py): `backend/app/api/onedrive.py`
- [Application database](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Backup records](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/models/backup.py): `backend/app/models/backup.py`
- [AI review records](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/models/ai_review.py): `backend/app/models/ai_review.py`
- [User records](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [Runtime configuration](https://github.com/justinthoms/network-config-manager/blob/main/backend/app/core/config.py): `backend/app/core/config.py`

### Other components

- **NOC operator**
- **Configured AI service**
- **Managed network devices**
- **Cloud storage services**

## Connections

- NOC operator → FastAPI application: uses (evidence: `README.md`)
- FastAPI application → Device inventory: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Backup endpoints: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Device health: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Backup file browser: routes to (evidence: `backend/app/main.py`)
- FastAPI application → AI endpoints: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Authentication: routes to (evidence: `backend/app/main.py`)
- FastAPI application → User administration: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Security self-check: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Audit log: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Google Drive copies: routes to (evidence: `backend/app/main.py`)
- FastAPI application → OneDrive copies: routes to (evidence: `backend/app/main.py`)
- FastAPI application → Application database: initializes (evidence: `backend/app/main.py`)
- FastAPI application → Backup schedules: starts (evidence: `backend/app/main.py`)
- FastAPI application → Background maintenance: starts (evidence: `backend/app/main.py`)
- Managed network devices → SSH backup service: provides configuration (evidence: `README.md`)
- Backup schedules → SSH backup service: runs scheduled backups
- SSH backup service → Backup records: records backups
- Backup records → Application database: persists in
- Backup endpoints → Change comparison: compares backups
- AI endpoints → AI change review: provides reviews
- AI change review → Change comparison: uses comparison (evidence: `backend/app/services/ai_review.py`)
- AI change review → Language model client: requests completion (evidence: `backend/app/services/ai_review.py`)
- AI change review → AI provider connections: selects providers (evidence: `backend/app/services/ai_review.py`)
- Network assistant → Language model client: uses language models
- Language model client → Configured AI service: sends masked requests (evidence: `README.md`)
- AI change review → AI review records: stores results (evidence: `backend/app/services/ai_review.py`)
- AI review records → Application database: persists in
- NOC operator → Device health: checks device health (evidence: `README.md`)
- Backup endpoints → Google Drive copies: copies backups
- Backup endpoints → OneDrive copies: copies backups
- Google Drive copies → Cloud storage services: uploads copies (evidence: `README.md`)
- OneDrive copies → Cloud storage services: uploads copies (evidence: `README.md`)
- Application database → Runtime configuration: uses database settings (evidence: `backend/app/core/database.py`)
- FastAPI application → Permission hardening: runs startup checks (evidence: `backend/app/main.py`)
- Authentication → User records: authenticates users (evidence: `backend/app/api/auth.py`)
