How fmustapha78-svg/water-backend-oran works
This small Node.js service monitors water pressure from an MQTT device, serves status over HTTP, stores periodic pressure history, and sends Firebase topic notifications for water outages and recovery. The main runtime flow is MQTT messages into in-memory sensor state, with threshold alerts and rate-limited Supabase logging; HTTP clients read status or trigger a notification test. The excerpt does not show every route or the full notification configuration, so the graph includes only evidenced relationships.
Main entry points: index.js Backend service
Components 10
Device ingestion
- Backend service
index.js - Live water state
index.js
HTTP API
- Status and utility routes
index.js
External services
- Pressure history
index.js - MQTT broker
- Supabase
- Firebase Messaging
Other components
- Water sensor
- HTTP clients
- Alert subscribers
Connections 10
- Water sensor → MQTT broker: publishes telemetry
- Backend service → MQTT broker: subscribes to topics
index.js - MQTT broker → Backend service: delivers messages
index.js - Backend service → Live water state: updates readings
index.js - Backend service → Pressure history: inserts logs
index.js - Backend service → Firebase Messaging: sends alerts
index.js - HTTP clients → Status and utility routes: requests routes
index.js - Status and utility routes → Live water state: reads status
index.js - Status and utility routes → Firebase Messaging: triggers test alert
index.js - Firebase Messaging → Alert subscribers: delivers topic alert