How dankehidayat/selene works
Selene collects energy and climate telemetry from IoT sensors, stores readings for analysis, and presents live dashboards and analytics through a web app. The primary documented production workflow runs through the backend monolith, which also handles authentication, notifications, and firmware management; a standalone ingestor and domain-split services are alternate or evolving deployments. The graph includes those documented capabilities, while some subsystem links rely on README descriptions because their implementation files were not sampled.
Main entry points: index.ts Fastify backend · auth.ts Authentication routes · registry.ts Parser registry · timescale.ts Readings store
Components 30
Telemetry ingestion
- Monolith MQTT client
apps/backend/src/mqtt.ts - Parser registry
packages/sensors/src/parsers/registry.ts - Energy parser
packages/sensors/src/parsers/energy.ts - Climate parser
packages/sensors/src/parsers/climate.ts - Readings store
apps/backend/src/timescale.ts
Monolith API
- User and settings store
apps/backend/src/db.ts - Fastify backend
apps/backend/src/index.ts - Authentication routes
apps/backend/src/routes/auth.ts - Auth and tokens
apps/backend/src/auth.ts - Two-factor auth
apps/backend/src/totp.ts - Email delivery
apps/backend/src/mail.ts - Analytics queries
apps/backend/src/timescale.ts - Firmware management
apps/backend/src/routes/firmware.ts - Notifications
apps/backend/src/routes/notifications.ts
Web application
- React application
apps/frontend/src/main.tsx - Page router
apps/frontend/src/router.tsx - Dashboard and charts
apps/frontend/src/pages/Dashboard.tsx - Analytics and logs
apps/frontend/src/pages/Analytics.tsx - API client
apps/frontend/src/services/api.ts
Domain services
- Standalone ingestor
services/ingestor/src/index.ts - Analytics service
services/analytics/src/routes.ts - Analytics data access
services/analytics/src/db.ts - Fuzzy analytics
packages/shared/src/analytics/fuzzy.ts - Auth service
services/auth/src/routes/auth.ts - Session management
services/auth/src/sessions.ts - Energy and climate services
services/energy/src/index.ts - Firmware service
services/firmware/src/index.ts
Other components
- ESP32 sensors
- MQTT broker
- Web user
Connections 32
- ESP32 sensors → MQTT broker: publishes telemetry
- MQTT broker → Monolith MQTT client: delivers MQTT
- Monolith MQTT client → Parser registry: dispatches payloads
- Parser registry → Energy parser: selects parser
packages/sensors/src/parsers/registry.ts - Parser registry → Climate parser: selects parser
packages/sensors/src/parsers/registry.ts - Parser registry → Readings store: inserts readings
- Web user → React application: uses dashboard
- React application → Page router: renders routes
apps/frontend/src/main.tsx - Page router → Dashboard and charts: routes to
apps/frontend/src/router.tsx - Page router → Analytics and logs: routes to
apps/frontend/src/router.tsx - Dashboard and charts → API client: requests data
- Analytics and logs → API client: requests analytics
- API client → Fastify backend: calls API
- Fastify backend → Authentication routes: registers routes
- Authentication routes → User and settings store: reads and writes
apps/backend/src/routes/auth.ts - Authentication routes → Auth and tokens: uses tokens
apps/backend/src/routes/auth.ts - Authentication routes → Two-factor auth: uses TOTP
apps/backend/src/routes/auth.ts - Authentication routes → Email delivery: sends reset email
apps/backend/src/routes/auth.ts - Fastify backend → Analytics queries: serves analytics
- Fastify backend → Firmware management: registers routes
- Fastify backend → Notifications: registers routes
- Fastify backend → Readings store: queries readings
- Standalone ingestor → MQTT broker: subscribes MQTT
- Standalone ingestor → Parser registry: uses registry
services/ingestor/src/index.ts - Standalone ingestor → Readings store: writes readings
- Analytics service → Analytics data access: queries readings
services/analytics/src/routes.ts - Analytics service → Fuzzy analytics: runs fuzzy analysis
services/analytics/src/routes.ts - Analytics service → Analytics data access: loads ranges
services/analytics/src/routes.ts - Auth service → Session management: issues sessions
services/auth/src/routes/auth.ts - Auth service → User and settings store: uses auth database
- Energy and climate services → Readings store: uses readings
- Firmware service → MQTT broker: sends MQTT commands