# kyle891204/growmate-physicalcomputing architecture

> Architecture diagram of the GitHub repository kyle891204/growmate-physicalcomputing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kyle891204/growmate-physicalcomputing
- Repository: https://github.com/kyle891204/growmate-physicalcomputing

## Overview

growMate is a smart-plant system combining a web app, FastAPI service, Gemini-based plant persona, persistent care and sensor records, and Raspberry Pi display/hardware control. The user workflow is to view plant conditions and care suggestions, take an action or chat, then see the updated state or response. The README documents the frontend/backend/Gemini relationship; excerpts show frontend actions and backend persistence, sensor endpoints, and Pi polling. Some frontend feature pages and API wiring are unsampled, so those relationships are not asserted.

Main entry points: [`frontend-next/lib/api`](https://github.com/kyle891204/growmate-physicalcomputing/tree/main/frontend-next/lib/api) (API client modules), [`backend/main.py`](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/main.py) (FastAPI endpoints), [`backend/database.py`](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/database.py) (Database access), [`raspberry/send_sensors.py`](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/raspberry/send_sensors.py) (Pi polling agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Plant web app"]
  node_home["Plant dashboard<br/>[page.js]"]
  node_chat["Plant chat<br/>[page.js]"]
  node_diary["Care diary<br/>[page.js]"]
  node_profile["Plant profile<br/>[page.js]"]
  node_settings["Care settings<br/>[page.js]"]
  node_sensor_settings["Sensor settings<br/>[page.js]"]
  node_api["API client modules"]
  node_mock["Mock data"]
end

subgraph group_service["Backend service"]
  node_backend["FastAPI endpoints<br/>[main.py]"]
  node_persona["Gemini persona chat<br/>[main.py]"]
  node_sensor_service["Sensor and mood service<br/>[main.py]"]
  node_care_actions["Care actions<br/>[main.py]"]
end

subgraph group_state["Plant data"]
  node_database["Database access<br/>[database.py]"]
  node_models["Plant and care records<br/>[models.py]"]
  node_store[("SQLite or MySQL")]
end

subgraph group_device["Raspberry Pi"]
  node_pi_agent["Pi polling agent<br/>[send_sensors.py]"]
  node_face["LCD face display<br/>[face.py]"]
end

node_user(("Plant caretaker"))
node_gemini["Google Gemini"]

node_user -->|"views and acts"| node_home
node_user -->|"sends messages"| node_chat
node_user -.->|"reviews care"| node_diary
node_user -->|"edits profile"| node_profile
node_user -->|"edits settings"| node_settings
node_user -.->|"configures sensors"| node_sensor_settings
node_home -->|"requests care data"| node_api
node_chat -->|"streams chat"| node_api
node_profile -.->|"loads profile"| node_api
node_settings -->|"reads and updates"| node_api
node_diary -.->|"loads diary"| node_api
node_sensor_settings -.->|"updates thresholds"| node_api
node_api -.->|"HTTP requests"| node_backend
node_api -->|"uses when offline"| node_mock
node_backend -->|"routes chat"| node_persona
node_persona -->|"generates replies"| node_gemini
node_backend -->|"serves readings"| node_sensor_service
node_backend -->|"handles actions"| node_care_actions
node_backend -->|"uses sessions"| node_database
node_backend -->|"queries records"| node_models
node_models -->|"uses base"| node_database
node_database -->|"persists records"| node_store
node_pi_agent -->|"polls readings and mood"| node_sensor_service
node_pi_agent -->|"updates display"| node_face

click node_home "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/frontend-next/app/page.js"
click node_chat "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/frontend-next/app/chat/page.js"
click node_diary "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/frontend-next/app/diary/page.js"
click node_profile "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/frontend-next/app/profile/page.js"
click node_settings "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/frontend-next/app/settings/page.js"
click node_sensor_settings "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/frontend-next/app/settings/sensors/page.js"
click node_api "https://github.com/kyle891204/growmate-physicalcomputing/tree/main/frontend-next/lib/api"
click node_mock "https://github.com/kyle891204/growmate-physicalcomputing/tree/main/frontend-next/lib/data"
click node_backend "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/main.py"
click node_persona "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/main.py"
click node_sensor_service "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/main.py"
click node_care_actions "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/main.py"
click node_database "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/database.py"
click node_models "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/models.py"
click node_pi_agent "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/raspberry/send_sensors.py"
click node_face "https://github.com/kyle891204/growmate-physicalcomputing/blob/main/raspberry/face.py"

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_home,node_chat,node_diary,node_profile,node_settings,node_sensor_settings,node_api,node_mock toneBlue
class node_backend,node_persona,node_sensor_service,node_care_actions toneAmber
class node_database,node_models,node_store toneMint
class node_pi_agent,node_face toneRose
class node_user,node_gemini toneIndigo
```

## Components

### Plant web app

- [Plant dashboard](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/frontend-next/app/page.js): `frontend-next/app/page.js`
- [Plant chat](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/frontend-next/app/chat/page.js): `frontend-next/app/chat/page.js`
- [Care diary](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/frontend-next/app/diary/page.js): `frontend-next/app/diary/page.js`
- [Plant profile](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/frontend-next/app/profile/page.js): `frontend-next/app/profile/page.js`
- [Care settings](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/frontend-next/app/settings/page.js): `frontend-next/app/settings/page.js`
- [Sensor settings](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/frontend-next/app/settings/sensors/page.js): `frontend-next/app/settings/sensors/page.js`
- [API client modules](https://github.com/kyle891204/growmate-physicalcomputing/tree/main/frontend-next/lib/api): `frontend-next/lib/api`
- [Mock data](https://github.com/kyle891204/growmate-physicalcomputing/tree/main/frontend-next/lib/data): `frontend-next/lib/data`

### Backend service

- [FastAPI endpoints](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/main.py): `backend/main.py`
- [Gemini persona chat](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/main.py): `backend/main.py`
- [Sensor and mood service](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/main.py): `backend/main.py`
- [Care actions](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/main.py): `backend/main.py`

### Plant data

- [Database access](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/database.py): `backend/database.py`
- [Plant and care records](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/backend/models.py): `backend/models.py`
- **SQLite or MySQL**

### Raspberry Pi

- [Pi polling agent](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/raspberry/send_sensors.py): `raspberry/send_sensors.py`
- [LCD face display](https://github.com/kyle891204/growmate-physicalcomputing/blob/main/raspberry/face.py): `raspberry/face.py`

### Other components

- **Plant caretaker**
- **Google Gemini**

## Connections

- Plant caretaker → Plant dashboard: views and acts (evidence: `frontend-next/app/page.js`)
- Plant caretaker → Plant chat: sends messages (evidence: `frontend-next/app/chat/page.js`)
- Plant caretaker → Care diary: reviews care
- Plant caretaker → Plant profile: edits profile (evidence: `frontend-next/app/profile/page.js`)
- Plant caretaker → Care settings: edits settings (evidence: `frontend-next/app/settings/page.js`)
- Plant caretaker → Sensor settings: configures sensors
- Plant dashboard → API client modules: requests care data (evidence: `frontend-next/app/page.js`)
- Plant chat → API client modules: streams chat (evidence: `frontend-next/app/chat/page.js`)
- Plant profile → API client modules: loads profile
- Care settings → API client modules: reads and updates (evidence: `frontend-next/app/settings/page.js`)
- Care diary → API client modules: loads diary
- Sensor settings → API client modules: updates thresholds
- API client modules → FastAPI endpoints: HTTP requests
- API client modules → Mock data: uses when offline (evidence: `frontend-next/lib/api/client.js`)
- FastAPI endpoints → Gemini persona chat: routes chat (evidence: `README.md`)
- Gemini persona chat → Google Gemini: generates replies (evidence: `README.md`)
- FastAPI endpoints → Sensor and mood service: serves readings (evidence: `backend/main.py`)
- FastAPI endpoints → Care actions: handles actions (evidence: `backend/main.py`)
- FastAPI endpoints → Database access: uses sessions (evidence: `backend/main.py`)
- FastAPI endpoints → Plant and care records: queries records (evidence: `backend/main.py`)
- Plant and care records → Database access: uses base (evidence: `backend/models.py`)
- Database access → SQLite or MySQL: persists records (evidence: `backend/database.py`)
- Pi polling agent → Sensor and mood service: polls readings and mood (evidence: `raspberry/send_sensors.py`)
- Pi polling agent → LCD face display: updates display (evidence: `raspberry/send_sensors.py`)
