# kentarveyvalenzuela-dotcom/smart-home-app architecture

> Architecture diagram of the GitHub repository kentarveyvalenzuela-dotcom/smart-home-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kentarveyvalenzuela-dotcom/smart-home-app
- Repository: https://github.com/kentarveyvalenzuela-dotcom/smart-home-app

## Overview

This repository appears to implement a Flutter smart-home and energy-monitoring app, backed by a Python API and ESP32 firmware. The intended user flow is authentication, device selection, live monitoring, then review of logs or alerts and adjustment of settings. The tree identifies these domain stages, but the README is empty and Flutter source excerpts were not provided; links between those stages are therefore shown as unverified. Backend internals and native desktop runner components are represented only where the tree or source index supports them.

Main entry points: [`as_flutter_project/lib/services/api_service.dart`](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/api_service.dart) (API client), [`as_flutter_project/lib/screens/monitor_page.dart`](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/monitor_page.dart) (Monitor screen), [`as_flutter_project/windows/runner/flutter_window.cpp`](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/windows/runner/flutter_window.cpp) (Windows Flutter host), [`as_flutter_project/lib/screens/auth_page.dart`](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/auth_page.dart) (Authentication screens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Flutter client"]
  node_auth_ui["Authentication screens<br/>[auth_page.dart]"]
  node_device_ui["Device screen<br/>[device_page.dart]"]
  node_monitor_ui["Monitor screen<br/>[monitor_page.dart]"]
  node_home_ui["Home dashboard<br/>[home_screen.dart]"]
  node_logs_ui["Logs screen<br/>[logs_page.dart]"]
  node_settings_ui["Settings screen<br/>[settings_page.dart]"]
  node_notification_ui["Notifications screen"]
end

subgraph group_services["App services"]
  node_auth_service["Authentication<br/>[auth_service.dart]"]
  node_api_service["API client<br/>[api_service.dart]"]
  node_device_service["Device management"]
  node_sensor_service["Sensor data"]
  node_energy_service["Energy monitoring"]
  node_mqtt_service["MQTT messaging<br/>[mqtt_service.dart]"]
  node_alert_service["Alert handling<br/>[alert_service.dart]"]
  node_log_service["Activity logs<br/>[log_service.dart]"]
  node_notification_service["Push notifications"]
end

subgraph group_backend["Backend and devices"]
  node_backend_api["Backend API<br/>[main.py]"]
  node_database_schema[("Relational schema<br/>[001_initial.sql]")]
  node_firmware["ESP32 firmware"]
end

subgraph group_native["Platform hosts"]
  node_desktop_host["Windows Flutter host<br/>[flutter_window.cpp]"]
  node_win32_window["Windows window layer<br/>[win32_window.cpp]"]
  node_windows_registrant["Windows plugin registration"]
  node_linux_host["Linux app host<br/>[my_application.cc]"]
  node_linux_registrant["Linux plugin registration"]
  node_macos_registrant["macOS plugin registration"]
end

node_user(("App user"))

node_user -.->|"uses"| node_auth_ui
node_user -.->|"uses"| node_home_ui
node_user -.->|"selects device"| node_device_ui
node_user -.->|"views readings"| node_monitor_ui
node_user -.->|"reviews history"| node_logs_ui
node_user -.->|"changes settings"| node_settings_ui
node_user -.->|"views alerts"| node_notification_ui
node_auth_ui -.->|"authenticates"| node_auth_service
node_device_ui -.->|"manages devices"| node_device_service
node_monitor_ui -.->|"requests readings"| node_sensor_service
node_monitor_ui -.->|"shows energy"| node_energy_service
node_logs_ui -.->|"loads history"| node_log_service
node_notification_ui -.->|"loads alerts"| node_notification_service
node_auth_service -.->|"uses API"| node_api_service
node_device_service -.->|"uses API"| node_api_service
node_sensor_service -.->|"uses API"| node_api_service
node_energy_service -.->|"uses API"| node_api_service
node_log_service -.->|"uses API"| node_api_service
node_api_service -.->|"sends requests"| node_backend_api
node_backend_api -.->|"uses schema"| node_database_schema
node_mqtt_service -.->|"exchanges messages"| node_firmware
node_desktop_host -->|"extends window"| node_win32_window
node_desktop_host -.->|"registers plugins"| node_windows_registrant
node_linux_host -.->|"registers plugins"| node_linux_registrant

click node_auth_ui "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/auth_page.dart"
click node_device_ui "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/device_page.dart"
click node_monitor_ui "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/monitor_page.dart"
click node_home_ui "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/home_screen.dart"
click node_logs_ui "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/logs_page.dart"
click node_settings_ui "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/settings_page.dart"
click node_notification_ui "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/notification_page.dart"
click node_auth_service "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/auth_service.dart"
click node_api_service "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/api_service.dart"
click node_device_service "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/device_service.dart"
click node_sensor_service "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/sensor_service.dart"
click node_energy_service "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/energy_monitor_service.dart"
click node_mqtt_service "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/mqtt_service.dart"
click node_alert_service "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/alert_service.dart"
click node_log_service "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/log_service.dart"
click node_notification_service "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/notification_service.dart"
click node_backend_api "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/backend/app/main.py"
click node_database_schema "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/backend/migrations/001_initial.sql"
click node_firmware "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/scripts/esp32_energy_monitor.ino"
click node_desktop_host "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/windows/runner/flutter_window.cpp"
click node_win32_window "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/windows/runner/win32_window.cpp"
click node_windows_registrant "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/windows/flutter/generated_plugin_registrant.cc"
click node_linux_host "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/linux/runner/my_application.cc"
click node_linux_registrant "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/linux/flutter/generated_plugin_registrant.h"
click node_macos_registrant "https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/macos/Flutter/GeneratedPluginRegistrant.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth_ui,node_device_ui,node_monitor_ui,node_home_ui,node_logs_ui,node_settings_ui,node_notification_ui,node_user toneBlue
class node_auth_service,node_api_service,node_device_service,node_sensor_service,node_energy_service,node_mqtt_service,node_alert_service,node_log_service,node_notification_service toneAmber
class node_backend_api,node_database_schema,node_firmware toneMint
class node_desktop_host,node_win32_window,node_windows_registrant,node_linux_host,node_linux_registrant,node_macos_registrant toneRose
```

## Components

### Flutter client

- [Authentication screens](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/auth_page.dart): `as_flutter_project/lib/screens/auth_page.dart`
- [Device screen](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/device_page.dart): `as_flutter_project/lib/screens/device_page.dart`
- [Monitor screen](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/monitor_page.dart): `as_flutter_project/lib/screens/monitor_page.dart`
- [Home dashboard](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/home_screen.dart): `as_flutter_project/lib/screens/home_screen.dart`
- [Logs screen](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/logs_page.dart): `as_flutter_project/lib/screens/logs_page.dart`
- [Settings screen](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/settings_page.dart): `as_flutter_project/lib/screens/settings_page.dart`
- [Notifications screen](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/screens/notification_page.dart): `as_flutter_project/lib/screens/notification_page.dart`

### App services

- [Authentication](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/auth_service.dart): `as_flutter_project/lib/services/auth_service.dart`
- [API client](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/api_service.dart): `as_flutter_project/lib/services/api_service.dart`
- [Device management](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/device_service.dart): `as_flutter_project/lib/services/device_service.dart`
- [Sensor data](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/sensor_service.dart): `as_flutter_project/lib/services/sensor_service.dart`
- [Energy monitoring](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/energy_monitor_service.dart): `as_flutter_project/lib/services/energy_monitor_service.dart`
- [MQTT messaging](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/mqtt_service.dart): `as_flutter_project/lib/services/mqtt_service.dart`
- [Alert handling](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/alert_service.dart): `as_flutter_project/lib/services/alert_service.dart`
- [Activity logs](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/log_service.dart): `as_flutter_project/lib/services/log_service.dart`
- [Push notifications](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/lib/services/notification_service.dart): `as_flutter_project/lib/services/notification_service.dart`

### Backend and devices

- [Backend API](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/backend/app/main.py): `as_flutter_project/backend/app/main.py`
- [Relational schema](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/backend/migrations/001_initial.sql): `as_flutter_project/backend/migrations/001_initial.sql`
- [ESP32 firmware](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/scripts/esp32_energy_monitor.ino): `as_flutter_project/scripts/esp32_energy_monitor.ino`

### Platform hosts

- [Windows Flutter host](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/windows/runner/flutter_window.cpp): `as_flutter_project/windows/runner/flutter_window.cpp`
- [Windows window layer](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/windows/runner/win32_window.cpp): `as_flutter_project/windows/runner/win32_window.cpp`
- [Windows plugin registration](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/windows/flutter/generated_plugin_registrant.cc): `as_flutter_project/windows/flutter/generated_plugin_registrant.cc`
- [Linux app host](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/linux/runner/my_application.cc): `as_flutter_project/linux/runner/my_application.cc`
- [Linux plugin registration](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/linux/flutter/generated_plugin_registrant.h): `as_flutter_project/linux/flutter/generated_plugin_registrant.h`
- [macOS plugin registration](https://github.com/kentarveyvalenzuela-dotcom/smart-home-app/blob/main/as_flutter_project/macos/Flutter/GeneratedPluginRegistrant.swift): `as_flutter_project/macos/Flutter/GeneratedPluginRegistrant.swift`

### Other components

- **App user**

## Connections

- App user → Authentication screens: uses
- App user → Home dashboard: uses
- App user → Device screen: selects device
- App user → Monitor screen: views readings
- App user → Logs screen: reviews history
- App user → Settings screen: changes settings
- App user → Notifications screen: views alerts
- Authentication screens → Authentication: authenticates
- Device screen → Device management: manages devices
- Monitor screen → Sensor data: requests readings
- Monitor screen → Energy monitoring: shows energy
- Logs screen → Activity logs: loads history
- Notifications screen → Push notifications: loads alerts
- Authentication → API client: uses API
- Device management → API client: uses API
- Sensor data → API client: uses API
- Energy monitoring → API client: uses API
- Activity logs → API client: uses API
- API client → Backend API: sends requests
- Backend API → Relational schema: uses schema
- MQTT messaging → ESP32 firmware: exchanges messages
- Windows Flutter host → Windows window layer: extends window
- Windows Flutter host → Windows plugin registration: registers plugins
- Linux app host → Linux plugin registration: registers plugins (evidence: `as_flutter_project/linux/runner/my_application.cc`)
