# erlanggaalfian/smartolt architecture

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

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

## Overview

SmartOLT is a web-based GPON OLT/ONU management system. The main workflow is an administrator using the PHP dashboard to inspect or change ONU/OLT state: PHP actions read and persist operational data, then call the Python engine for vendor CLI/SNMP work; scheduled sync refreshes database-backed monitoring. Separate branches cover TR-069/GenieACS, VPN tunnels, and administration. The README documents these capabilities, but unsampled implementations are represented only at supported directory paths; edges without direct source or README evidence are omitted.

Main entry points: [`backend/js-api/server.js`](https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/server.js) (Node API server), [`backend/db.php`](https://github.com/erlanggaalfian/smartolt/blob/main/backend/db.php) (MySQL database), [`backend/python_engine/registry.py`](https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/registry.py) (Vendor registry), [`backend/js-api/db.js`](https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/db.js) (Node DB pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web management"]
  node_phpui["PHP dashboard<br/>[header.php]"]
  node_onuview["ONU monitoring<br/>[onu-detail.php]"]
  node_oltview["OLT management<br/>[olt-detail.php]"]
  node_onuactions["ONU actions"]
  node_oltactions["OLT actions"]
end

subgraph group_olt["OLT operations"]
  node_discovery["ONU discovery"]
  node_sync["Background sync<br/>[cron_sync.py]"]
  node_phpbridge["PHP driver bridge<br/>[driver.php]"]
  node_engineapi["Python engine API<br/>[app.py]"]
  node_registry["Vendor registry<br/>[registry.py]"]
  node_zte300["ZTE C300 driver<br/>[zte_c300.py]"]
  node_zte320["ZTE C320 driver<br/>[zte_c320.py]"]
  node_cdata["CData driver<br/>[cdata_fd1602sb1.py]"]
  node_snmp["SNMP operations<br/>[snmp_module.py]"]
end

subgraph group_acs["TR-069 and VPN"]
  node_geniehelper["GenieACS client<br/>[genieacs.php]"]
  node_genie["GenieACS"]
  node_mongo[("MongoDB")]
  node_provision["FiberHome provisioning"]
  node_vpn["VPN tunnels<br/>[vpn-tunnels.php]"]
  node_vpnservice["OpenVPN"]
end

subgraph group_api["API and identity"]
  node_jsserver["Node API server<br/>[server.js]"]
  node_authroutes["Authentication routes<br/>[auth.js]"]
  node_jsauth["JWT authentication<br/>[auth.js]"]
  node_jsolt["OLT API routes<br/>[olt.js]"]
  node_jsonu["ONU API routes<br/>[onu.js]"]
  node_jsother["Other API routes"]
end

subgraph group_state["Persistence"]
  node_db[("MySQL database<br/>[db.php]")]
  node_jsdb["Node DB pool<br/>[db.js]"]
end

node_admin(("Administrator"))
node_browser(("Browser"))
node_oltdevice["OLT devices"]
node_onu["ONU devices"]

node_admin -->|"uses"| node_phpui
node_phpui -->|"opens"| node_onuview
node_onuview -->|"requests"| node_onuactions
node_oltview -->|"requests"| node_oltactions
node_onuactions -->|"reads/writes"| node_db
node_oltactions -->|"reads/writes"| node_db
node_onuactions -->|"calls"| node_phpbridge
node_oltactions -->|"calls"| node_phpbridge
node_phpbridge -->|"dispatches"| node_engineapi
node_engineapi -->|"loads"| node_registry
node_registry -->|"registers"| node_zte300
node_registry -->|"registers"| node_zte320
node_registry -->|"registers"| node_cdata
node_zte300 -->|"uses"| node_snmp
node_zte320 -->|"uses"| node_snmp
node_cdata -->|"uses"| node_snmp
node_zte300 -.->|"SSH/SNMP"| node_oltdevice
node_zte320 -.->|"SSH/SNMP"| node_oltdevice
node_cdata -.->|"SSH/SNMP"| node_oltdevice
node_sync -.->|"refreshes"| node_db
node_sync -.->|"synchronizes"| node_discovery
node_discovery -.->|"records"| node_db
node_oltdevice -->|"GPON"| node_onu
node_onuview -->|"uses"| node_geniehelper
node_geniehelper -->|"REST NBI"| node_genie
node_genie -->|"stores"| node_mongo
node_provision -.->|"provisions"| node_genie
node_vpn -.->|"manages"| node_vpnservice
node_vpnservice -.->|"TR-069 tunnel"| node_onu
node_browser -.->|"calls API"| node_jsserver
node_jsserver -->|"routes"| node_authroutes
node_jsserver -->|"routes"| node_jsolt
node_jsserver -->|"routes"| node_jsonu
node_jsserver -->|"routes"| node_jsother
node_authroutes -->|"mints/verifies"| node_jsauth
node_jsolt -->|"queries"| node_jsdb
node_jsonu -->|"queries"| node_jsdb
node_authroutes -->|"queries"| node_jsdb
node_jsdb -.->|"connects"| node_db

click node_phpui "https://github.com/erlanggaalfian/smartolt/blob/main/frontend/header.php"
click node_onuview "https://github.com/erlanggaalfian/smartolt/blob/main/frontend/onu-detail.php"
click node_oltview "https://github.com/erlanggaalfian/smartolt/blob/main/frontend/olt-detail.php"
click node_onuactions "https://github.com/erlanggaalfian/smartolt/tree/main/frontend/action"
click node_oltactions "https://github.com/erlanggaalfian/smartolt/tree/main/frontend/action"
click node_discovery "https://github.com/erlanggaalfian/smartolt/tree/main/backend/python_engine"
click node_sync "https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/cron_sync.py"
click node_phpbridge "https://github.com/erlanggaalfian/smartolt/blob/main/backend/driver.php"
click node_engineapi "https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/app.py"
click node_registry "https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/registry.py"
click node_zte300 "https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/drivers/zte_c300.py"
click node_zte320 "https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/drivers/zte_c320.py"
click node_cdata "https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/drivers/cdata_fd1602sb1.py"
click node_snmp "https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/snmp_module.py"
click node_db "https://github.com/erlanggaalfian/smartolt/blob/main/backend/db.php"
click node_geniehelper "https://github.com/erlanggaalfian/smartolt/blob/main/backend/genieacs.php"
click node_provision "https://github.com/erlanggaalfian/smartolt/blob/main/deploy/genieacs/provisions/fiberhome-wan-access.js"
click node_vpn "https://github.com/erlanggaalfian/smartolt/blob/main/frontend/vpn-tunnels.php"
click node_jsserver "https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/server.js"
click node_authroutes "https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/routes/auth.js"
click node_jsauth "https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/auth.js"
click node_jsdb "https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/db.js"
click node_jsolt "https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/routes/olt.js"
click node_jsonu "https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/routes/onu.js"
click node_jsother "https://github.com/erlanggaalfian/smartolt/tree/main/backend/js-api/routes"

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_phpui,node_onuview,node_oltview,node_onuactions,node_oltactions,node_browser toneBlue
class node_discovery,node_sync,node_phpbridge,node_engineapi,node_registry,node_zte300,node_zte320,node_cdata,node_snmp toneAmber
class node_geniehelper,node_genie,node_mongo,node_provision,node_vpn,node_vpnservice toneMint
class node_jsserver,node_authroutes,node_jsauth,node_jsolt,node_jsonu,node_jsother toneRose
class node_db,node_jsdb,node_admin,node_oltdevice,node_onu toneIndigo
```

## Components

### Web management

- [PHP dashboard](https://github.com/erlanggaalfian/smartolt/blob/main/frontend/header.php): `frontend/header.php`
- [ONU monitoring](https://github.com/erlanggaalfian/smartolt/blob/main/frontend/onu-detail.php): `frontend/onu-detail.php`
- [OLT management](https://github.com/erlanggaalfian/smartolt/blob/main/frontend/olt-detail.php): `frontend/olt-detail.php`
- [ONU actions](https://github.com/erlanggaalfian/smartolt/tree/main/frontend/action): `frontend/action`
- [OLT actions](https://github.com/erlanggaalfian/smartolt/tree/main/frontend/action): `frontend/action`

### OLT operations

- [ONU discovery](https://github.com/erlanggaalfian/smartolt/tree/main/backend/python_engine): `backend/python_engine`
- [Background sync](https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/cron_sync.py): `backend/python_engine/cron_sync.py`
- [PHP driver bridge](https://github.com/erlanggaalfian/smartolt/blob/main/backend/driver.php): `backend/driver.php`
- [Python engine API](https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/app.py): `backend/python_engine/app.py`
- [Vendor registry](https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/registry.py): `backend/python_engine/registry.py`
- [ZTE C300 driver](https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/drivers/zte_c300.py): `backend/python_engine/drivers/zte_c300.py`
- [ZTE C320 driver](https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/drivers/zte_c320.py): `backend/python_engine/drivers/zte_c320.py`
- [CData driver](https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/drivers/cdata_fd1602sb1.py): `backend/python_engine/drivers/cdata_fd1602sb1.py`
- [SNMP operations](https://github.com/erlanggaalfian/smartolt/blob/main/backend/python_engine/snmp_module.py): `backend/python_engine/snmp_module.py`

### TR-069 and VPN

- [GenieACS client](https://github.com/erlanggaalfian/smartolt/blob/main/backend/genieacs.php): `backend/genieacs.php`
- **GenieACS**
- **MongoDB**
- [FiberHome provisioning](https://github.com/erlanggaalfian/smartolt/blob/main/deploy/genieacs/provisions/fiberhome-wan-access.js): `deploy/genieacs/provisions/fiberhome-wan-access.js`
- [VPN tunnels](https://github.com/erlanggaalfian/smartolt/blob/main/frontend/vpn-tunnels.php): `frontend/vpn-tunnels.php`
- **OpenVPN**

### API and identity

- [Node API server](https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/server.js): `backend/js-api/server.js`
- [Authentication routes](https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/routes/auth.js): `backend/js-api/routes/auth.js`
- [JWT authentication](https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/auth.js): `backend/js-api/auth.js`
- [OLT API routes](https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/routes/olt.js): `backend/js-api/routes/olt.js`
- [ONU API routes](https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/routes/onu.js): `backend/js-api/routes/onu.js`
- [Other API routes](https://github.com/erlanggaalfian/smartolt/tree/main/backend/js-api/routes): `backend/js-api/routes`

### Persistence

- [MySQL database](https://github.com/erlanggaalfian/smartolt/blob/main/backend/db.php): `backend/db.php`
- [Node DB pool](https://github.com/erlanggaalfian/smartolt/blob/main/backend/js-api/db.js): `backend/js-api/db.js`

### Other components

- **Administrator**
- **Browser**
- **OLT devices**
- **ONU devices**

## Connections

- Administrator → PHP dashboard: uses (evidence: `README.md`)
- PHP dashboard → ONU monitoring: opens (evidence: `frontend/header.php`)
- ONU monitoring → ONU actions: requests (evidence: `frontend/onu-detail.php`)
- OLT management → OLT actions: requests
- ONU actions → MySQL database: reads/writes (evidence: `frontend/action/onu-data.php`)
- OLT actions → MySQL database: reads/writes (evidence: `frontend/action/auth-onu.php`)
- ONU actions → PHP driver bridge: calls (evidence: `frontend/action/auth-onu.php`)
- OLT actions → PHP driver bridge: calls (evidence: `backend/driver.php`)
- PHP driver bridge → Python engine API: dispatches (evidence: `backend/driver.php`)
- Python engine API → Vendor registry: loads (evidence: `backend/python_engine/app.py`)
- Vendor registry → ZTE C300 driver: registers (evidence: `backend/python_engine/registry.py`)
- Vendor registry → ZTE C320 driver: registers (evidence: `backend/python_engine/registry.py`)
- Vendor registry → CData driver: registers (evidence: `backend/python_engine/registry.py`)
- ZTE C300 driver → SNMP operations: uses (evidence: `backend/python_engine/drivers/zte_c300.py`)
- ZTE C320 driver → SNMP operations: uses (evidence: `backend/python_engine/drivers/zte_c320.py`)
- CData driver → SNMP operations: uses (evidence: `backend/python_engine/drivers/cdata_fd1602sb1.py`)
- ZTE C300 driver → OLT devices: SSH/SNMP (evidence: `README.md`)
- ZTE C320 driver → OLT devices: SSH/SNMP (evidence: `README.md`)
- CData driver → OLT devices: SSH/SNMP (evidence: `README.md`)
- Background sync → MySQL database: refreshes (evidence: `README.md`)
- Background sync → ONU discovery: synchronizes (evidence: `README.md`)
- ONU discovery → MySQL database: records (evidence: `README.md`)
- OLT devices → ONU devices: GPON (evidence: `README.md`)
- ONU monitoring → GenieACS client: uses (evidence: `frontend/onu-detail.php`)
- GenieACS client → GenieACS: REST NBI (evidence: `README.md`)
- GenieACS → MongoDB: stores (evidence: `README.md`)
- FiberHome provisioning → GenieACS: provisions
- VPN tunnels → OpenVPN: manages (evidence: `README.md`)
- OpenVPN → ONU devices: TR-069 tunnel (evidence: `README.md`)
- Browser → Node API server: calls API
- Node API server → Authentication routes: routes (evidence: `backend/js-api/server.js`)
- Node API server → OLT API routes: routes (evidence: `backend/js-api/server.js`)
- Node API server → ONU API routes: routes (evidence: `backend/js-api/server.js`)
- Node API server → Other API routes: routes (evidence: `backend/js-api/server.js`)
- Authentication routes → JWT authentication: mints/verifies (evidence: `backend/js-api/routes/auth.js`)
- OLT API routes → Node DB pool: queries (evidence: `backend/js-api/routes/olt.js`)
- ONU API routes → Node DB pool: queries (evidence: `backend/js-api/routes/onu.js`)
- Authentication routes → Node DB pool: queries (evidence: `backend/js-api/routes/auth.js`)
- Node DB pool → MySQL database: connects (evidence: `backend/js-api/db.js`)
