How iamvolvic/iot-greenhouse works
Greenhouse Observer is an IoT monitoring product: ESP32 sensor readings travel through the Flespi MQTT broker to a .NET backend, are persisted, and reach a live dashboard over WebSockets. Users also authenticate and manage devices through HTTPS APIs. The graph preserves the documented ingestion, persistence, and live-update stages, plus authentication, device management, and the backend’s service and storage layers. Internal MQTT, persistence, and WebSocket wiring is only partially evidenced by the excerpts and README; uncertain links are omitted rather than inferred.
Main entry points: MqttServices MQTT listener · WebSocketHandler.cs WebSocket handling · AppDbContext.cs Database context · Program.cs API startup
Components 16
Devices and dashboard
- ESP32 sensors
- Flespi broker
- Live dashboard
Frontend/src/modules/editor/components/index.tsx
Backend API
- Authentication API
Backend/Greenhouse.API/Controllers/AuthController.cs - Device API
Backend/Greenhouse.API/Controllers/DeviceController.cs - Subscription API
Backend/Greenhouse.API/Controllers/SubscriptionController.cs - API startup
Backend/Greenhouse.API/Program.cs
Realtime ingestion
- MQTT listener
Backend/Greenhouse.Infrastructure/MqttServices - WebSocket handling
Backend/Greenhouse.API/WebSocketHandler.cs - Connection manager
Backend/Greenhouse.Infrastructure/WebsocketServices/ConnectionManager.cs
Application services
- Device services
Backend/Greenhouse.Infrastructure/Services/DeviceService.cs - Auth services
Backend/Greenhouse.Infrastructure/AuthService/AuthService.cs - JWT manager
Backend/Greenhouse.Infrastructure/Security/JwtManager.cs
Persistence
- Database context
Backend/Greenhouse.Infrastructure/AppDbContext.cs - Device repository
Backend/Greenhouse.Infrastructure/Infrastructure.DataAccess/Repositories/DeviceRepository.cs - Domain records
Backend/Greenhouse.Domain/DatabaseDtos/Device.cs
Connections 18
- ESP32 sensors → Flespi broker: sends MQTT
- Flespi broker → MQTT listener: forwards MQTT
- MQTT listener → Database context: persists readings
- MQTT listener → WebSocket handling: feeds updates
- WebSocket handling → Connection manager: dispatches sockets
- WebSocket handling → Live dashboard: pushes updates
- Live dashboard → Device API: manages devices
- Device API → Device services: invokes
Backend/Greenhouse.API/Controllers/DeviceController.cs - Device services → Device repository: uses
Backend/Greenhouse.Infrastructure/Services/DeviceService.cs - Device repository → Database context: queries
Backend/Greenhouse.Infrastructure/Infrastructure.DataAccess/Repositories/DeviceRepository.cs - Database context → Domain records: stores records
Backend/Greenhouse.Infrastructure/AppDbContext.cs - Authentication API → Auth services: invokes
Backend/Greenhouse.API/Controllers/AuthController.cs - Auth services → JWT manager: validates tokens
Backend/Greenhouse.Infrastructure/AuthService/AuthService.cs - Auth services → Domain records: loads user
Backend/Greenhouse.Infrastructure/AuthService/AuthService.cs - API startup → Database context: configures
Backend/Greenhouse.API/Program.cs - API startup → MQTT listener: configures
Backend/Greenhouse.API/Program.cs - API startup → WebSocket handling: configures
Backend/Greenhouse.API/Program.cs - Subscription API → Device services: invokes
Backend/Greenhouse.API/Controllers/SubscriptionController.cs