How atik0603/smart-greenhouse works
Smart Greenhouse is a web application for managing greenhouse locations, zones, devices, sensor readings, actuator states, and automation. Users configure locations and zones, provision and assign devices, inspect readings and overviews, and manage automation and actuator execution through the dashboard. The backend exposes these capabilities through FastAPI and persists application data in PostgreSQL; a background sampler is started when enabled. Edges reflect only relationships shown in the excerpts or SOURCE INDEX; unsampled route and integration details are not inferred.
Main entry points: api.ts API client · App.tsx Dashboard shell · models.py PostgreSQL data model · main.py FastAPI application
Components 26
Dashboard
- Dashboard shell
frontend/src/App.tsx - Overview dashboard
frontend/src/features/overview/OverviewPanel.tsx - Device management
frontend/src/components/devices/DeviceList.tsx - Location configuration
frontend/src/components/config/LocationConfigWizard.tsx - Automation panel
frontend/src/features/automation/StrategyPanel.tsx - Sensor readings
frontend/src/features/sensors/SensorReadingPanel.tsx - Execution log
frontend/src/features/actuators/ExecutionLog.tsx - API client
frontend/src/services/api.ts
API and orchestration
- FastAPI application
backend/src/main.py - Location endpoints
backend/src/interfaces/api/locations.py - Device endpoints
backend/src/interfaces/api/devices.py - Sampler runner
backend/src/interfaces/sampler_runner.py
Greenhouse capabilities
- Location and zone configuration
backend/src/application/locations/zone_service.py - Reading ingestion
backend/src/application/readings/service.py - Actuator state transitions
backend/src/application/devices/actuator_state_service.py - Automation evaluation
backend/src/application/automation/service.py - Overview assembly
backend/src/application/overview/facade.py
Persistence and adapters
- Device repository
backend/src/infrastructure/persistence/device_repository.py - Location repository
backend/src/infrastructure/persistence/location_repository.py - Reading repository
backend/src/infrastructure/persistence/reading_repository.py - Automation repository
backend/src/infrastructure/persistence/automation_repository.py - Actuator state repository
backend/src/infrastructure/persistence/actuator_state_repository.py - PostgreSQL data model
backend/src/infrastructure/persistence/models.py - Sensor adapters
backend/src/infrastructure/adapters/sensors - Actuator adapters
backend/src/infrastructure/adapters/actuators
Other components
- Greenhouse user
Connections 31
- Greenhouse user → Dashboard shell: uses
frontend/src/App.tsx - Dashboard shell → Overview dashboard: renders
frontend/src/App.tsx - Dashboard shell → Device management: renders
frontend/src/App.tsx - Dashboard shell → Location configuration: renders
frontend/src/App.tsx - Dashboard shell → Automation panel: renders
frontend/src/App.tsx - Dashboard shell → Execution log: renders
frontend/src/App.tsx - Device management → API client: requests data
frontend/src/components/devices/DeviceList.tsx - Overview dashboard → API client: requests overview
frontend/src/features/overview/OverviewPanel.tsx - Location configuration → API client: requests configuration
- Sensor readings → API client: requests readings
frontend/src/features/sensors/SensorReadingPanel.tsx - Automation panel → API client: requests automation
frontend/src/features/automation/StrategyPanel.tsx - Execution log → API client: requests history
frontend/src/features/actuators/ExecutionLog.tsx - API client → FastAPI application: HTTP requests
frontend/src/services/api.ts - FastAPI application → Location endpoints: registers router
backend/src/main.py - FastAPI application → Device endpoints: registers router
backend/src/main.py - FastAPI application → Sampler runner: starts when enabled
backend/src/main.py - Location endpoints → Location and zone configuration: uses configuration services
backend/src/interfaces/api/locations.py - Location endpoints → Location repository: uses repository
backend/src/interfaces/api/locations.py - Location and zone configuration → Location repository: validates and writes zones
backend/src/application/locations/zone_service.py - Device endpoints → Device repository: uses device storage
- Reading ingestion → Device repository: loads device
backend/src/application/readings/service.py - Reading ingestion → Sensor adapters: selects adapter
backend/src/application/readings/service.py - Reading ingestion → Reading repository: saves readings
backend/src/application/readings/service.py - Actuator state transitions → Device repository: loads actuator
backend/src/application/devices/actuator_state_service.py - Actuator state transitions → Actuator state repository: reads and saves state
backend/src/application/devices/actuator_state_service.py - Automation evaluation → Automation repository: loads and stores strategy
backend/src/application/automation/service.py - Device repository → PostgreSQL data model: maps device rows
backend/src/infrastructure/persistence/device_repository.py - Location repository → PostgreSQL data model: reads and writes rows
backend/src/infrastructure/persistence/location_repository.py - Reading repository → PostgreSQL data model: persists readings
backend/src/infrastructure/persistence/reading_repository.py - Automation repository → PostgreSQL data model: persists strategy
backend/src/infrastructure/persistence/automation_repository.py - Actuator state repository → PostgreSQL data model: persists state
backend/src/infrastructure/persistence/actuator_state_repository.py