How danishxd/ecosmart-feeder works
EcoSmart Feeder monitors fish-pond conditions and supports device management, feeding control, alerts, and sensor-informed chat/recommendations. The primary flow is ESP32 sensor data sent over MQTT to the backend, stored as time-series readings, then exposed to the mobile app through APIs and real-time updates. The mobile app also manages accounts, devices, schedules, and sensor views. Source evidence is incomplete for several mobile screens and recommendation internals, so their detailed runtime links are not inferred.
Main entry points: app.ts Fastify API · iot.service.ts Sensor processing · api.ts HTTP client · iot.routes.ts Sensor API
Components 25
Device firmware
- ESP32 sensors
firmware/esp32/main.cpp
Backend services
- Fastify API
apps/backend/src/app.ts - Authentication
apps/backend/src/modules/auth/auth.service.ts - Device management
apps/backend/src/modules/devices/devices.routes.ts - Sensor API
apps/backend/src/modules/iot/iot.routes.ts - Sensor processing
apps/backend/src/modules/iot/iot.service.ts - MQTT bridge
apps/backend/src/modules/iot/mqtt.bridge.ts - Alert rules
apps/backend/src/modules/alerts/alert.engine.ts - Feeding schedules
apps/backend/src/modules/schedules/schedules.routes.ts - Socket server
apps/backend/src/plugins/socket.ts
Data stores
- PostgreSQL
apps/backend/drizzle/schema.ts - InfluxDB readings
apps/backend/src/plugins/influx.ts
Mobile application
- Login and signup
apps/mobile/app/(auth)/signup.tsx - Device setup
apps/mobile/app/(app)/setup-device.tsx - Feeding control
apps/mobile/app/(app)/control.tsx - Dashboard and monitoring
apps/mobile/app/(app)/dashboard.tsx - Alert screen
apps/mobile/app/(app)/alerts.tsx - Chat screen
apps/mobile/app/(app)/chat.tsx - HTTP client
apps/mobile/lib/api.ts - Sensor state
apps/mobile/stores/sensorStore.ts - Live updates
apps/mobile/hooks/useWebSocket.ts - Local notifications
apps/mobile/hooks/usePushNotification.ts
AI features
- Sensor chat
apps/backend/src/modules/chat/chat.service.ts - Recommendations
apps/backend/src/modules/recommendation/recommendation.routes.ts
Other components
- Pond keeper
Connections 27
- Pond keeper → Login and signup: uses
README.md - Pond keeper → Dashboard and monitoring: monitors
README.md - ESP32 sensors → MQTT bridge: sends MQTT
README.md - MQTT bridge → Sensor processing: passes readings
apps/backend/src/modules/iot/mqtt.bridge.ts - Fastify API → Authentication: registers routes
apps/backend/src/app.ts - Fastify API → Sensor API: registers routes
apps/backend/src/app.ts - Fastify API → Device management: registers routes
apps/backend/src/app.ts - Fastify API → Alert rules: registers routes
apps/backend/src/app.ts - Fastify API → Sensor chat: registers routes
apps/backend/src/app.ts - Fastify API → Feeding schedules: registers routes
apps/backend/src/app.ts - Fastify API → Recommendations: registers routes
apps/backend/src/app.ts - Sensor API → Sensor processing: calls
apps/backend/src/modules/iot/iot.routes.ts - Sensor processing → PostgreSQL: checks devices
apps/backend/src/modules/iot/iot.service.ts - Sensor processing → InfluxDB readings: writes and queries
apps/backend/src/modules/iot/iot.service.ts - Sensor chat → Sensor processing: reads sensor data
apps/backend/src/modules/chat/chat.service.ts - Authentication → PostgreSQL: stores accounts and tokens
apps/backend/src/modules/auth/auth.service.ts - Device management → PostgreSQL: stores devices
apps/backend/src/modules/devices/devices.routes.ts - Login and signup → HTTP client: uses
apps/mobile/app/(auth)/signup.tsx - Device setup → HTTP client: uses
apps/mobile/app/(app)/setup-device.tsx - Feeding control → HTTP client: uses
apps/mobile/app/(app)/control.tsx - Feeding control → Sensor state: uses
apps/mobile/app/(app)/control.tsx - HTTP client → Fastify API: HTTP requests
README.md - Dashboard and monitoring → Live updates: receives live readings
- Live updates → Sensor state: updates readings
apps/mobile/hooks/useWebSocket.ts - Socket server → Live updates: pushes WebSocket updates
README.md - Sensor API → Socket server: emits sensor alerts
apps/backend/src/modules/iot/iot.routes.ts - Sensor state → Local notifications: uses
apps/mobile/stores/sensorStore.ts