# erlanggaalfian/netbackup architecture

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

- Interactive diagram: https://gitdiagram.com/erlanggaalfian/netbackup
- Repository: https://github.com/erlanggaalfian/netbackup

## Overview

NetBackup is a web application for centrally managing network-device configuration backups. Administrators sign in, configure vendors and devices, and set schedules; cron checks schedules and invokes the Python backup engine, which connects to devices and stores results for browsing, download, and audit. The web application also provides cached connectivity monitoring, user/settings management, and optional Google Drive and Telegram integrations. Relationships among unsampled features follow the README; source excerpts and the index provide additional call/import evidence, but do not establish every runtime connection.

Main entry points: [`web/includes/header.php`](https://github.com/erlanggaalfian/netbackup/blob/main/web/includes/header.php) (Shared page layout), [`web/dashboard.php`](https://github.com/erlanggaalfian/netbackup/blob/main/web/dashboard.php) (Dashboard), [`python/backup_single.py`](https://github.com/erlanggaalfian/netbackup/blob/main/python/backup_single.py) (Device backup engine), [`web/index.php`](https://github.com/erlanggaalfian/netbackup/blob/main/web/index.php) (Page router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web access"]
  node_router["Page router<br/>[index.php]"]
  node_layout["Shared page layout<br/>[header.php]"]
  node_navbar["Navigation<br/>[navbar.php]"]
  node_footer["Shared UI behavior<br/>[footer.php]"]
end

subgraph group_management["Management UI"]
  node_dashboard["Dashboard<br/>[dashboard.php]"]
  node_devices["Device inventory<br/>[devices.php]"]
  node_vendors["Vendor commands<br/>[vendors.php]"]
  node_schedule["Backup schedules<br/>[schedule.php]"]
  node_backups["Backup history<br/>[backups.php]"]
  node_backupview["View backup<br/>[view_backup.php]"]
  node_logs["Activity logs<br/>[logs.php]"]
  node_settings["System settings<br/>[settings.php]"]
end

subgraph group_backup["Backup engine"]
  node_cron["Scheduled runner"]
  node_engine["Device backup engine<br/>[backup_single.py]"]
  node_drive_backup["Database Drive backup"]
end

subgraph group_monitoring["Connectivity"]
  node_connectivity["Connectivity checks and cache<br/>[db.php]"]
  node_connectivity_api["Connectivity APIs"]
end

subgraph group_data["Data and integrations"]
  node_auth["Authentication and security<br/>[db.php]"]
  node_python_db["Python database helpers<br/>[db.py]"]
  node_database[("MariaDB / MySQL")]
  node_telegram["Telegram notifications<br/>[telegram_util.py]"]
end

node_admin(("Administrator / User"))
node_devices_network{{"Network devices"}}
node_telegram_service{{"Telegram API"}}
node_google_drive{{"Google Drive"}}

node_admin -->|"requests pages"| node_router
node_router -->|"checks session"| node_auth
node_router -->|"routes pages"| node_dashboard
node_dashboard -->|"fetches status"| node_connectivity_api
node_devices -->|"fetches status"| node_connectivity_api
node_connectivity_api -.->|"reads status"| node_connectivity
node_connectivity -->|"checks reachability"| node_devices_network
node_dashboard -->|"reads statistics"| node_database
node_devices -->|"manages inventory"| node_database
node_vendors -->|"stores commands"| node_database
node_schedule -->|"stores schedules"| node_database
node_cron -->|"loads schedule data"| node_python_db
node_cron -->|"runs backups"| node_engine
node_engine -->|"uses database helpers"| node_python_db
node_engine -->|"connects via SSH/Telnet"| node_devices_network
node_engine -->|"saves results"| node_database
node_python_db -->|"connects and logs"| node_database
node_backups -->|"reads history"| node_database
node_backupview -->|"reads configuration"| node_database
node_logs -->|"reads audit trail"| node_database
node_settings -->|"stores settings"| node_database
node_engine -.->|"notifies results"| node_telegram
node_telegram -->|"sends messages"| node_telegram_service
node_drive_backup -->|"uses database helpers"| node_python_db
node_drive_backup -.->|"uploads database backup"| node_google_drive
node_admin -->|"views results"| node_dashboard
node_dashboard -.->|"links history"| node_backups
node_router -->|"loads for 404"| node_layout
node_layout -->|"includes navigation"| node_navbar
node_backups -.->|"uses shared layout"| node_layout
node_logs -.->|"uses shared layout"| node_layout
node_schedule -.->|"uses shared layout"| node_layout
node_vendors -.->|"uses shared layout"| node_layout
node_dashboard -.->|"uses shared layout"| node_layout
node_devices -.->|"uses shared layout"| node_layout
node_layout -.->|"paired page UI"| node_footer

click node_router "https://github.com/erlanggaalfian/netbackup/blob/main/web/index.php"
click node_auth "https://github.com/erlanggaalfian/netbackup/blob/main/config/db.php"
click node_dashboard "https://github.com/erlanggaalfian/netbackup/blob/main/web/dashboard.php"
click node_devices "https://github.com/erlanggaalfian/netbackup/blob/main/web/devices.php"
click node_vendors "https://github.com/erlanggaalfian/netbackup/blob/main/web/vendors.php"
click node_schedule "https://github.com/erlanggaalfian/netbackup/blob/main/web/schedule.php"
click node_backups "https://github.com/erlanggaalfian/netbackup/blob/main/web/backups.php"
click node_backupview "https://github.com/erlanggaalfian/netbackup/blob/main/web/view_backup.php"
click node_logs "https://github.com/erlanggaalfian/netbackup/blob/main/web/logs.php"
click node_settings "https://github.com/erlanggaalfian/netbackup/blob/main/web/settings.php"
click node_layout "https://github.com/erlanggaalfian/netbackup/blob/main/web/includes/header.php"
click node_navbar "https://github.com/erlanggaalfian/netbackup/blob/main/web/includes/navbar.php"
click node_footer "https://github.com/erlanggaalfian/netbackup/blob/main/web/includes/footer.php"
click node_cron "https://github.com/erlanggaalfian/netbackup/blob/main/python/run_scheduled_backup.py"
click node_engine "https://github.com/erlanggaalfian/netbackup/blob/main/python/backup_single.py"
click node_connectivity "https://github.com/erlanggaalfian/netbackup/blob/main/config/db.php"
click node_connectivity_api "https://github.com/erlanggaalfian/netbackup/blob/main/web/api_dashboard_connectivity.php"
click node_python_db "https://github.com/erlanggaalfian/netbackup/blob/main/python/db.py"
click node_telegram "https://github.com/erlanggaalfian/netbackup/blob/main/python/telegram_util.py"
click node_drive_backup "https://github.com/erlanggaalfian/netbackup/blob/main/python/backup_db_to_drive.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_router,node_layout,node_navbar,node_footer,node_admin toneBlue
class node_dashboard,node_devices,node_vendors,node_schedule,node_backups,node_backupview,node_logs,node_settings toneAmber
class node_cron,node_engine,node_drive_backup,node_telegram_service toneMint
class node_connectivity,node_connectivity_api toneRose
class node_auth,node_python_db,node_database,node_telegram,node_devices_network,node_google_drive toneIndigo
```

## Components

### Web access

- [Page router](https://github.com/erlanggaalfian/netbackup/blob/main/web/index.php): `web/index.php`
- [Shared page layout](https://github.com/erlanggaalfian/netbackup/blob/main/web/includes/header.php): `web/includes/header.php`
- [Navigation](https://github.com/erlanggaalfian/netbackup/blob/main/web/includes/navbar.php): `web/includes/navbar.php`
- [Shared UI behavior](https://github.com/erlanggaalfian/netbackup/blob/main/web/includes/footer.php): `web/includes/footer.php`

### Management UI

- [Dashboard](https://github.com/erlanggaalfian/netbackup/blob/main/web/dashboard.php): `web/dashboard.php`
- [Device inventory](https://github.com/erlanggaalfian/netbackup/blob/main/web/devices.php): `web/devices.php`
- [Vendor commands](https://github.com/erlanggaalfian/netbackup/blob/main/web/vendors.php): `web/vendors.php`
- [Backup schedules](https://github.com/erlanggaalfian/netbackup/blob/main/web/schedule.php): `web/schedule.php`
- [Backup history](https://github.com/erlanggaalfian/netbackup/blob/main/web/backups.php): `web/backups.php`
- [View backup](https://github.com/erlanggaalfian/netbackup/blob/main/web/view_backup.php): `web/view_backup.php`
- [Activity logs](https://github.com/erlanggaalfian/netbackup/blob/main/web/logs.php): `web/logs.php`
- [System settings](https://github.com/erlanggaalfian/netbackup/blob/main/web/settings.php): `web/settings.php`

### Backup engine

- [Scheduled runner](https://github.com/erlanggaalfian/netbackup/blob/main/python/run_scheduled_backup.py): `python/run_scheduled_backup.py`
- [Device backup engine](https://github.com/erlanggaalfian/netbackup/blob/main/python/backup_single.py): `python/backup_single.py`
- [Database Drive backup](https://github.com/erlanggaalfian/netbackup/blob/main/python/backup_db_to_drive.py): `python/backup_db_to_drive.py`

### Connectivity

- [Connectivity checks and cache](https://github.com/erlanggaalfian/netbackup/blob/main/config/db.php): `config/db.php`
- [Connectivity APIs](https://github.com/erlanggaalfian/netbackup/blob/main/web/api_dashboard_connectivity.php): `web/api_dashboard_connectivity.php`

### Data and integrations

- [Authentication and security](https://github.com/erlanggaalfian/netbackup/blob/main/config/db.php): `config/db.php`
- [Python database helpers](https://github.com/erlanggaalfian/netbackup/blob/main/python/db.py): `python/db.py`
- **MariaDB / MySQL**
- [Telegram notifications](https://github.com/erlanggaalfian/netbackup/blob/main/python/telegram_util.py): `python/telegram_util.py`

### Other components

- **Administrator / User**
- **Network devices**
- **Telegram API**
- **Google Drive**

## Connections

- Administrator / User → Page router: requests pages (evidence: `web/index.php`)
- Page router → Authentication and security: checks session (evidence: `web/index.php`)
- Page router → Dashboard: routes pages (evidence: `web/index.php`)
- Dashboard → Connectivity APIs: fetches status (evidence: `README.md`)
- Device inventory → Connectivity APIs: fetches status (evidence: `web/devices.php`)
- Connectivity APIs → Connectivity checks and cache: reads status (evidence: `web/api_dashboard_connectivity.php`)
- Connectivity checks and cache → Network devices: checks reachability (evidence: `README.md`)
- Dashboard → MariaDB / MySQL: reads statistics (evidence: `web/dashboard.php`)
- Device inventory → MariaDB / MySQL: manages inventory (evidence: `web/devices.php`)
- Vendor commands → MariaDB / MySQL: stores commands (evidence: `README.md`)
- Backup schedules → MariaDB / MySQL: stores schedules (evidence: `README.md`)
- Scheduled runner → Python database helpers: loads schedule data (evidence: `python/run_scheduled_backup.py`)
- Scheduled runner → Device backup engine: runs backups (evidence: `python/run_scheduled_backup.py`)
- Device backup engine → Python database helpers: uses database helpers (evidence: `python/backup_single.py`)
- Device backup engine → Network devices: connects via SSH/Telnet (evidence: `README.md`)
- Device backup engine → MariaDB / MySQL: saves results (evidence: `python/backup_single.py`)
- Python database helpers → MariaDB / MySQL: connects and logs (evidence: `python/db.py`)
- Backup history → MariaDB / MySQL: reads history (evidence: `web/backups.php`)
- View backup → MariaDB / MySQL: reads configuration (evidence: `README.md`)
- Activity logs → MariaDB / MySQL: reads audit trail (evidence: `README.md`)
- System settings → MariaDB / MySQL: stores settings (evidence: `README.md`)
- Device backup engine → Telegram notifications: notifies results (evidence: `python/backup_single.py`)
- Telegram notifications → Telegram API: sends messages (evidence: `python/telegram_util.py`)
- Database Drive backup → Python database helpers: uses database helpers (evidence: `python/backup_db_to_drive.py`)
- Database Drive backup → Google Drive: uploads database backup (evidence: `README.md`)
- Administrator / User → Dashboard: views results (evidence: `README.md`)
- Dashboard → Backup history: links history
- Page router → Shared page layout: loads for 404 (evidence: `web/index.php`)
- Shared page layout → Navigation: includes navigation (evidence: `web/includes/header.php`)
- Backup history → Shared page layout: uses shared layout (evidence: `web/backups.php`)
- Activity logs → Shared page layout: uses shared layout (evidence: `web/logs.php`)
- Backup schedules → Shared page layout: uses shared layout (evidence: `web/schedule.php`)
- Vendor commands → Shared page layout: uses shared layout (evidence: `web/vendors.php`)
- Dashboard → Shared page layout: uses shared layout (evidence: `web/dashboard.php`)
- Device inventory → Shared page layout: uses shared layout (evidence: `web/devices.php`)
- Shared page layout → Shared UI behavior: paired page UI
