How gopesh-1157/motor-guard works
MotorGuard is a local-first industrial motor monitoring and predictive-maintenance platform. Sensor-equipped motors and simulated motors publish telemetry through MQTT; the gateway ingests readings, persists them, evaluates alert rules, and serves API and live-update capabilities to dashboard users. The dashboard supports fleet and device views, live monitoring, analytics, alerts, maintenance workflows, reporting, settings, and role-based access. Source evidence is partial: the README documents the overall topology and capabilities, while sampled backend and frontend files establish only some internal calls and rendering relationships.
Main entry points: App.tsx Dashboard App · main.py Gateway Runtime · endpoints/auth.py Auth Routes · core/auth.py Authentication and RBAC
Components 30
Edge and Messaging
- Motor Fleet
- Motor Simulator
simulator/simulator.py - MQTT Broker
- MQTT Subscriber
backend/app/mqtt/subscriber.py
Gateway Services
- Gateway Runtime
backend/app/main.py - REST API Routes
backend/app/api/v1/api.py - Telemetry Ingestion
backend/app/services/telemetry_ingestion.py - Alert Rules
backend/app/services/alert_service.py - Motor Registry
backend/app/services/motor_service.py - Device Registry
backend/app/services/device_service.py - Maintenance Records
backend/app/services/maintenance_service.py - MongoDB
- Live WebSocket
backend/app/api/v1/endpoints/websocket.py
Identity and Access
- Auth Routes
backend/app/api/v1/endpoints/auth.py - Authentication and RBAC
backend/app/core/auth.py - Token Security
backend/app/core/security.py - User Service
backend/app/services/user_service.py
Monitoring Dashboard
- Dashboard App
frontend/src/App.tsx - Fleet Overview
frontend/src/components/OverviewView.tsx - Live Monitoring
frontend/src/components/LiveMonitoringView.tsx - Device Nodes
frontend/src/components/DeviceNodesView.tsx - Alerts and Dispatch
frontend/src/components/AlertsView.tsx - Motor Management
frontend/src/components/MotorManagementView.tsx - Analytics
frontend/src/components/AnalyticsView.tsx - Reports
frontend/src/components/ReportsView.tsx - Settings
frontend/src/components/SettingsView.tsx - Digital Twin
frontend/src/components/MotorDigitalTwin3D.tsx - Motor Detail
frontend/src/components/MotorDetailModal.tsx - Telemetry Hook
frontend/src/hooks/useTelemetry.ts
Other components
- Dashboard User
Connections 32
- Motor Fleet → MQTT Broker: publishes telemetry
README.md - Motor Simulator → MQTT Broker: publishes telemetry
README.md - MQTT Broker → MQTT Subscriber: delivers messages
README.md - MQTT Subscriber → Gateway Runtime: forwards telemetry
backend/app/main.py - Gateway Runtime → Telemetry Ingestion: ingests readings
backend/app/main.py - Gateway Runtime → Alert Rules: evaluates readings
backend/app/main.py - Gateway Runtime → Live WebSocket: broadcasts updates
backend/app/main.py - Gateway Runtime → MongoDB: persists data
README.md - Telemetry Ingestion → MongoDB: stores telemetry
- Alert Rules → MongoDB: stores alerts
- Motor Registry → MongoDB: reads and updates
backend/app/services/motor_service.py - Device Registry → MongoDB: reads and updates
backend/app/services/device_service.py - Maintenance Records → MongoDB: stores records
- REST API Routes → Auth Routes: registers routes
backend/app/api/v1/api.py - Auth Routes → User Service: authenticates users
backend/app/api/v1/endpoints/auth.py - Auth Routes → Authentication and RBAC: checks access
backend/app/api/v1/endpoints/auth.py - Auth Routes → Token Security: creates tokens
backend/app/api/v1/endpoints/auth.py - Authentication and RBAC → Token Security: validates tokens
backend/app/core/auth.py - Authentication and RBAC → User Service: loads users
backend/app/core/auth.py - Dashboard User → Dashboard App: uses dashboard
README.md - Dashboard App → Fleet Overview: renders view
frontend/src/App.tsx - Dashboard App → Live Monitoring: renders view
frontend/src/App.tsx - Dashboard App → Device Nodes: renders view
frontend/src/App.tsx - Dashboard App → Alerts and Dispatch: renders view
frontend/src/App.tsx - Dashboard App → Motor Management: renders view
frontend/src/App.tsx - Dashboard App → Analytics: renders view
frontend/src/App.tsx - Dashboard App → Reports: renders view
frontend/src/App.tsx - Dashboard App → Settings: renders view
frontend/src/App.tsx - Dashboard App → Digital Twin: renders view
frontend/src/App.tsx - Dashboard App → Motor Detail: renders modal
frontend/src/App.tsx - Live Monitoring → Telemetry Hook: uses telemetry
- Telemetry Hook → Live WebSocket: receives updates