How chaeyeon1382-arch/scada-capstone-infra works
This is a small SCADA system for collecting sensor readings over Modbus, forwarding them through MQTT to a cloud API and database, and enabling dashboard monitoring and relay control. Its main workflow runs from the edge gateway’s sensor read and anomaly check through broker ingestion and persistence, then exposes readings to the UI. Relay commands travel back through the API and broker to the gateway. The README documents the dashboard and Slack capabilities; their implementation details are not fully sampled, so those links rely on documented behavior.
Main entry points: mqtt_client.py MQTT Ingestion · control.py Relay API · main.py API App · index.html Web Dashboard
Components 17
Edge Gateway
- Modbus I/O
gateway/modbus_client.py - Anomaly Check
gateway/security.py - Gateway Loop
gateway/main.py - Gateway MQTT
gateway/mqtt_client.py
FastAPI Backend
- API App
server/fastapi/main.py - MQTT Ingestion
server/fastapi/mqtt_client.py - Sensor API
server/fastapi/routers/sensor.py - Relay API
server/fastapi/routers/control.py - Slack API
server/fastapi/routers/slack.py - Database Access
server/fastapi/database.py - Data Models
server/fastapi/models.py
Dashboard
- Web Dashboard
ui/index.html - Dashboard Config
ui/config.js
External Services
- MQTT Broker
server/rabbitmq/rabbitmq.conf - PostgreSQL
server/fastapi/database.py
Other components
- Sensor Hardware
- Slack
Connections 26
- Sensor Hardware → Modbus I/O: sends readings
README.md - Gateway Loop → Modbus I/O: reads and controls
gateway/main.py - Gateway Loop → Anomaly Check: checks payload
gateway/main.py - Gateway Loop → Gateway MQTT: publishes readings
gateway/main.py - Gateway MQTT → MQTT Broker: publishes and subscribes
README.md - MQTT Broker → MQTT Ingestion: delivers sensor data
README.md - API App → MQTT Ingestion: starts subscriber
server/fastapi/main.py - MQTT Ingestion → Database Access: stores readings
server/fastapi/mqtt_client.py - MQTT Ingestion → Slack: sends threshold alerts
server/fastapi/mqtt_client.py - API App → Sensor API: registers routes
server/fastapi/main.py - API App → Relay API: registers routes
server/fastapi/main.py - API App → Slack API: registers routes
server/fastapi/main.py - Sensor API → Database Access: queries readings
server/fastapi/routers/sensor.py - Relay API → Database Access: records commands
server/fastapi/routers/control.py - Database Access → PostgreSQL: connects to
server/fastapi/database.py - MQTT Ingestion → Data Models: creates sensor record
server/fastapi/mqtt_client.py - Sensor API → Data Models: queries sensor records
server/fastapi/routers/sensor.py - Relay API → Data Models: creates relay log
server/fastapi/routers/control.py - Web Dashboard → Dashboard Config: uses configuration
- Web Dashboard → Sensor API: requests readings
README.md - Web Dashboard → Relay API: sends controls
README.md - Relay API → MQTT Broker: publishes relay command
server/fastapi/routers/control.py - MQTT Broker → Gateway MQTT: delivers relay command
gateway/mqtt_client.py - Gateway MQTT → Modbus I/O: controls relay
gateway/mqtt_client.py - Web Dashboard → Slack API: requests alert
- Slack API → Slack: posts alert
server/fastapi/routers/slack.py