How commerry/web-factorybox works
FactoryBox is an IoT monitoring platform: users register and manage devices, devices publish sensor readings over MQTT, and the platform stores readings, evaluates alerts, and serves dashboard/history views with real-time updates. The graph includes documented areas whose source wiring was not sampled; those relationships are marked dashed and unevidenced rather than asserted as inspected calls.
Main entry points: mqtt.service.ts MQTT ingestion · auth.controller.ts Authentication · database.ts Prisma database · index.ts API route registry
Components 21
Web application
- Dashboard and history
frontend/src/pages/dashboard - Device views
frontend/src/pages/devices - Admin and settings
frontend/src/pages/admin - Live updates
frontend/src/composables/useWebSocket.ts - API clients
frontend/src/api
Backend API
- Express application
backend/src/app.ts - API route registry
backend/src/routes/index.ts - Authentication routes
backend/src/routes/auth.routes.ts - Alert routes
backend/src/routes/alert.routes.ts - Notification routes
backend/src/routes/notification.routes.ts - Alert management
backend/src/controllers/alert.controller.ts - Notifications
backend/src/controllers/notification.controller.ts
Device data and realtime
- MQTT ingestion
backend/src/services/mqtt.service.ts - Alert evaluation
backend/src/services/alert.service.ts - WebSocket service
backend/src/services/websocket.service.ts
Identity and persistence
- Authentication
backend/src/controllers/auth.controller.ts - Prisma database
backend/src/config/database.ts - Email delivery
backend/src/services/email.service.ts
Other components
- Dashboard user
- ESP device
- Device simulator
simulator/simulator.js
Connections 28
- Dashboard user → Dashboard and history: views
- Dashboard user → Device views: manages devices
- Dashboard user → Admin and settings: administers plans
- Dashboard and history → API clients: requests data
- Device views → API clients: requests device data
- Admin and settings → API clients: requests administration
- WebSocket service → Live updates: pushes updates
- API clients → Express application: calls API
- ESP device → MQTT ingestion: publishes readings
- Device simulator → MQTT ingestion: simulates publishing
- Express application → API route registry: mounts
backend/src/app.ts - API route registry → Authentication routes: registers
backend/src/routes/index.ts - API route registry → Alert routes: registers
backend/src/routes/index.ts - API route registry → Notification routes: registers
backend/src/routes/index.ts - Authentication routes → Authentication: dispatches
backend/src/routes/auth.routes.ts - Alert routes → Alert management: dispatches
backend/src/routes/alert.routes.ts - Alert routes → Authentication: authenticates
backend/src/routes/alert.routes.ts - Notification routes → Notifications: dispatches
backend/src/routes/notification.routes.ts - Notification routes → Authentication: authenticates
backend/src/routes/notification.routes.ts - Authentication → Prisma database: reads and writes
backend/src/controllers/auth.controller.ts - Authentication → Email delivery: sends verification
backend/src/controllers/auth.controller.ts - MQTT ingestion → Prisma database: stores readings
backend/src/services/mqtt.service.ts - MQTT ingestion → Alert evaluation: checks alerts
backend/src/services/mqtt.service.ts - MQTT ingestion → WebSocket service: emits device events
- MQTT ingestion → Notifications: emits alert notifications
- Alert evaluation → Prisma database: reads alert rules
backend/src/services/alert.service.ts - Alert management → Prisma database: reads and writes
backend/src/controllers/alert.controller.ts - Notifications → Prisma database: reads and writes
backend/src/controllers/notification.controller.ts