# nabeelsyed11/selec-plc-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/nabeelsyed11/selec-plc-dashboard
- Repository: https://github.com/nabeelsyed11/selec-plc-dashboard

## Overview

Selec MiBRX-6M is an industrial edge gateway and live dashboard. Its primary workflow polls PLC registers and direct vibration sensors, processes measurements and machine state, records history and latency, then publishes live telemetry for browser monitoring. Operators can review alarms and analytics or submit safety-gated PLC commands with audit logging. The README documents additional energy, production, diagnostics, and system telemetry capabilities. Edges below are limited to calls and data flow shown in excerpts, the source index, or README; unsampled subsystem internals are represented by their exact directories.

Main entry points: [`frontend/src/App.tsx`](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/App.tsx) (Dashboard app), [`backend/app/main.py`](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/main.py) (Gateway runtime), [`backend/app/api`](https://github.com/nabeelsyed11/selec-plc-dashboard/tree/main/backend/app/api) (REST endpoints), [`backend/app/plc/modbus_client.py`](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/plc/modbus_client.py) (Modbus polling client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Signal acquisition"]
  node_modbus["Modbus polling client<br/>[modbus_client.py]"]
  node_registers["Register map<br/>[register_map.py]"]
  node_decoder["Register decoder<br/>[decoder.py]"]
  node_mock_plc["PLC simulator<br/>[mock_plc.py]"]
end

subgraph group_processing["Machine processing"]
  node_sensor_processing["Signal processing<br/>[processing.py]"]
  node_machine_state["Machine state<br/>[state.py]"]
  node_alarms["Alarm manager<br/>[alarms.py]"]
  node_vibration["Vibration sampling<br/>[sensor.py]"]
  node_vibration_analysis["Vibration analysis<br/>[analysis.py]"]
  node_latency["Latency monitor<br/>[monitor.py]"]
end

subgraph group_operations["Operations and persistence"]
  node_control["Safe control service<br/>[service.py]"]
  node_db_buffer["Buffered persistence<br/>[session.py]"]
  node_db_models[("History and audit schema<br/>[models.py]")]
  node_config["Gateway settings<br/>[config.py]"]
end

subgraph group_api["Gateway APIs"]
  node_gateway["Gateway runtime<br/>[main.py]"]
  node_rest_routes["REST endpoints"]
  node_ws_routes["WebSocket endpoint<br/>[websocket.py]"]
end

subgraph group_ui["Dashboard"]
  node_frontend_app["Dashboard app<br/>[App.tsx]"]
  node_websocket_client["Live telemetry client<br/>[websocket.ts]"]
  node_overview["Overview and live views<br/>[OverviewPage.tsx]"]
  node_latency_page["Latency analytics"]
  node_production_page["Production and energy<br/>[ProductionPage.tsx]"]
  node_vibration_page["Vibration dashboard<br/>[VibrationPage.tsx]"]
  node_alarms_page["Alarm dashboard<br/>[AlarmsPage.tsx]"]
  node_control_page["Control panel"]
  node_settings_page["Settings dashboard<br/>[SettingsPage.tsx]"]
end

node_operator(("Operator"))
node_browser(("Browser user"))
node_plc{{"Selec MiBRX-6M PLC"}}
node_vibration_hw{{"Vibration sensor"}}

node_gateway -->|"starts polling"| node_modbus
node_modbus -->|"reads registers"| node_plc
node_modbus -->|"decodes reads"| node_decoder
node_modbus -->|"uses map"| node_registers
node_modbus -->|"uses simulation"| node_mock_plc
node_gateway -->|"processes signals"| node_sensor_processing
node_gateway -->|"reads state"| node_machine_state
node_gateway -->|"checks alarms"| node_alarms
node_gateway -->|"records timing"| node_latency
node_gateway -->|"buffers records"| node_db_buffer
node_db_buffer -->|"writes history"| node_db_models
node_gateway -->|"starts sampling"| node_vibration
node_vibration -.->|"samples sensor"| node_vibration_hw
node_vibration -->|"analyzes samples"| node_vibration_analysis
node_gateway -->|"serves telemetry"| node_ws_routes
node_gateway -.->|"mounts routes"| node_rest_routes
node_rest_routes -->|"queries alarms"| node_alarms
node_rest_routes -->|"queries history"| node_db_models
node_rest_routes -->|"executes command"| node_control
node_control -->|"writes PLC"| node_modbus
node_control -->|"records audit"| node_db_models
node_rest_routes -->|"reads telemetry"| node_machine_state
node_rest_routes -->|"updates settings"| node_config
node_operator -.->|"uses dashboard"| node_frontend_app
node_browser -.->|"opens interface"| node_frontend_app
node_frontend_app -->|"uses telemetry"| node_websocket_client
node_websocket_client -.->|"receives stream"| node_ws_routes
node_ws_routes -->|"streams updates"| node_frontend_app
node_frontend_app -->|"renders overview"| node_overview
node_frontend_app -->|"renders analytics"| node_latency_page
node_frontend_app -->|"renders production"| node_production_page
node_frontend_app -->|"renders vibration"| node_vibration_page
node_frontend_app -.->|"renders alarms"| node_alarms_page
node_frontend_app -.->|"renders controls"| node_control_page
node_frontend_app -.->|"renders settings"| node_settings_page
node_overview -.->|"shows telemetry"| node_browser
node_latency_page -.->|"shows metrics"| node_browser
node_production_page -.->|"shows production"| node_browser
node_vibration_page -.->|"shows analysis"| node_browser
node_control_page -.->|"submits commands"| node_rest_routes
node_settings_page -.->|"configures gateway"| node_rest_routes

click node_modbus "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/plc/modbus_client.py"
click node_registers "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/plc/register_map.py"
click node_decoder "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/plc/decoder.py"
click node_mock_plc "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/simulation/mock_plc.py"
click node_sensor_processing "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/sensors/processing.py"
click node_machine_state "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/machine/state.py"
click node_alarms "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/machine/alarms.py"
click node_vibration "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/vibration/sensor.py"
click node_vibration_analysis "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/vibration/analysis.py"
click node_latency "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/latency/monitor.py"
click node_control "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/control/service.py"
click node_db_buffer "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/database/session.py"
click node_db_models "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/database/models.py"
click node_config "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/core/config.py"
click node_gateway "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/main.py"
click node_rest_routes "https://github.com/nabeelsyed11/selec-plc-dashboard/tree/main/backend/app/api"
click node_ws_routes "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/api/websocket.py"
click node_frontend_app "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/App.tsx"
click node_websocket_client "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/services/websocket.ts"
click node_overview "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/OverviewPage.tsx"
click node_latency_page "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/LatencyAnalyticsPage.tsx"
click node_production_page "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/ProductionPage.tsx"
click node_vibration_page "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/VibrationPage.tsx"
click node_alarms_page "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/AlarmsPage.tsx"
click node_control_page "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/ControlPanelPage.tsx"
click node_settings_page "https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/SettingsPage.tsx"

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_modbus,node_registers,node_decoder,node_mock_plc,node_browser toneBlue
class node_sensor_processing,node_machine_state,node_alarms,node_vibration,node_vibration_analysis,node_latency toneAmber
class node_control,node_db_buffer,node_db_models,node_config toneMint
class node_gateway,node_rest_routes,node_ws_routes toneRose
class node_frontend_app,node_websocket_client,node_overview,node_latency_page,node_production_page,node_vibration_page,node_alarms_page,node_control_page,node_settings_page,node_operator,node_plc,node_vibration_hw toneIndigo
```

## Components

### Signal acquisition

- [Modbus polling client](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/plc/modbus_client.py): `backend/app/plc/modbus_client.py`
- [Register map](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/plc/register_map.py): `backend/app/plc/register_map.py`
- [Register decoder](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/plc/decoder.py): `backend/app/plc/decoder.py`
- [PLC simulator](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/simulation/mock_plc.py): `backend/app/simulation/mock_plc.py`

### Machine processing

- [Signal processing](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/sensors/processing.py): `backend/app/sensors/processing.py`
- [Machine state](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/machine/state.py): `backend/app/machine/state.py`
- [Alarm manager](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/machine/alarms.py): `backend/app/machine/alarms.py`
- [Vibration sampling](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/vibration/sensor.py): `backend/app/vibration/sensor.py`
- [Vibration analysis](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/vibration/analysis.py): `backend/app/vibration/analysis.py`
- [Latency monitor](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/latency/monitor.py): `backend/app/latency/monitor.py`

### Operations and persistence

- [Safe control service](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/control/service.py): `backend/app/control/service.py`
- [Buffered persistence](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/database/session.py): `backend/app/database/session.py`
- [History and audit schema](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/database/models.py): `backend/app/database/models.py`
- [Gateway settings](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/core/config.py): `backend/app/core/config.py`

### Gateway APIs

- [Gateway runtime](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/main.py): `backend/app/main.py`
- [REST endpoints](https://github.com/nabeelsyed11/selec-plc-dashboard/tree/main/backend/app/api): `backend/app/api`
- [WebSocket endpoint](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/backend/app/api/websocket.py): `backend/app/api/websocket.py`

### Dashboard

- [Dashboard app](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Live telemetry client](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/services/websocket.ts): `frontend/src/services/websocket.ts`
- [Overview and live views](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/OverviewPage.tsx): `frontend/src/pages/OverviewPage.tsx`
- [Latency analytics](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/LatencyAnalyticsPage.tsx): `frontend/src/pages/LatencyAnalyticsPage.tsx`
- [Production and energy](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/ProductionPage.tsx): `frontend/src/pages/ProductionPage.tsx`
- [Vibration dashboard](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/VibrationPage.tsx): `frontend/src/pages/VibrationPage.tsx`
- [Alarm dashboard](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/AlarmsPage.tsx): `frontend/src/pages/AlarmsPage.tsx`
- [Control panel](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/ControlPanelPage.tsx): `frontend/src/pages/ControlPanelPage.tsx`
- [Settings dashboard](https://github.com/nabeelsyed11/selec-plc-dashboard/blob/main/frontend/src/pages/SettingsPage.tsx): `frontend/src/pages/SettingsPage.tsx`

### Other components

- **Operator**
- **Browser user**
- **Selec MiBRX-6M PLC**
- **Vibration sensor**

## Connections

- Gateway runtime → Modbus polling client: starts polling (evidence: `backend/app/main.py`)
- Modbus polling client → Selec MiBRX-6M PLC: reads registers (evidence: `backend/app/plc/modbus_client.py`)
- Modbus polling client → Register decoder: decodes reads (evidence: `backend/app/plc/modbus_client.py`)
- Modbus polling client → Register map: uses map (evidence: `backend/app/plc/modbus_client.py`)
- Modbus polling client → PLC simulator: uses simulation (evidence: `backend/app/plc/modbus_client.py`)
- Gateway runtime → Signal processing: processes signals (evidence: `backend/app/main.py`)
- Gateway runtime → Machine state: reads state (evidence: `backend/app/main.py`)
- Gateway runtime → Alarm manager: checks alarms (evidence: `backend/app/main.py`)
- Gateway runtime → Latency monitor: records timing (evidence: `backend/app/main.py`)
- Gateway runtime → Buffered persistence: buffers records (evidence: `backend/app/main.py`)
- Buffered persistence → History and audit schema: writes history (evidence: `backend/app/database/session.py`)
- Gateway runtime → Vibration sampling: starts sampling (evidence: `backend/app/main.py`)
- Vibration sampling → Vibration sensor: samples sensor (evidence: `README.md`)
- Vibration sampling → Vibration analysis: analyzes samples (evidence: `backend/app/vibration/sensor.py`)
- Gateway runtime → WebSocket endpoint: serves telemetry (evidence: `backend/app/main.py`)
- Gateway runtime → REST endpoints: mounts routes (evidence: `backend/app/main.py`)
- REST endpoints → Alarm manager: queries alarms (evidence: `backend/app/api/routes_alarms.py`)
- REST endpoints → History and audit schema: queries history (evidence: `backend/app/api/routes_signals.py`)
- REST endpoints → Safe control service: executes command (evidence: `backend/app/api/routes_control.py`)
- Safe control service → Modbus polling client: writes PLC (evidence: `backend/app/control/service.py`)
- Safe control service → History and audit schema: records audit (evidence: `backend/app/control/service.py`)
- REST endpoints → Machine state: reads telemetry (evidence: `backend/app/api/routes_system.py`)
- REST endpoints → Gateway settings: updates settings (evidence: `backend/app/api/routes_system.py`)
- Operator → Dashboard app: uses dashboard
- Browser user → Dashboard app: opens interface
- Dashboard app → Live telemetry client: uses telemetry (evidence: `frontend/src/App.tsx`)
- Live telemetry client → WebSocket endpoint: receives stream (evidence: `README.md`)
- WebSocket endpoint → Dashboard app: streams updates
- Dashboard app → Overview and live views: renders overview (evidence: `frontend/src/App.tsx`)
- Dashboard app → Latency analytics: renders analytics (evidence: `frontend/src/App.tsx`)
- Dashboard app → Production and energy: renders production (evidence: `frontend/src/App.tsx`)
- Dashboard app → Vibration dashboard: renders vibration (evidence: `frontend/src/App.tsx`)
- Dashboard app → Alarm dashboard: renders alarms (evidence: `frontend/src/App.tsx`)
- Dashboard app → Control panel: renders controls (evidence: `frontend/src/App.tsx`)
- Dashboard app → Settings dashboard: renders settings (evidence: `frontend/src/App.tsx`)
- Overview and live views → Browser user: shows telemetry
- Latency analytics → Browser user: shows metrics
- Production and energy → Browser user: shows production
- Vibration dashboard → Browser user: shows analysis
- Control panel → REST endpoints: submits commands
- Settings dashboard → REST endpoints: configures gateway
