# maypencs/growsight architecture

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

- Interactive diagram: https://gitdiagram.com/maypencs/growsight
- Repository: https://github.com/maypencs/growsight
- Video tour (about a minute): https://gitdiagram.com/maypencs/growsight/video

## Overview

GrowSight is a local-first plant monitoring and growth-prediction application. The main workflow is entering conditions or ingesting sensor readings, evaluating them against plant profiles, and returning growth forecasts and diagnostic tips; garden views combine stored plant history into attention summaries. Camera snapshots form a separate monitoring path: configured cameras are polled or receive uploads, vision estimates canopy cover per plant zone, and those measurements are stored alongside readings. The API is the central runtime orchestrator. Relationships involving unsampled routes are included only where documented; the sampled excerpts do not expose every API handler.

Main entry points: [`growsight/app.py`](https://github.com/maypencs/growsight/blob/main/growsight/app.py) (Camera API), [`growsight/static/app.js`](https://github.com/maypencs/growsight/blob/main/growsight/static/app.js) (Web interface), [`growsight/model.py`](https://github.com/maypencs/growsight/blob/main/growsight/model.py) (Growth model), [`growsight/db.py`](https://github.com/maypencs/growsight/blob/main/growsight/db.py) (SQLite store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_web_ui["Web interface<br/>[app.js]"]
  node_web_page["Web page<br/>[index.html]"]
  node_api["FastAPI service<br/>[app.py]"]
end

subgraph group_prediction["Prediction"]
  node_profiles["Plant profiles<br/>[profiles.py]"]
  node_growth_model["Growth model<br/>[model.py]"]
end

subgraph group_garden["Garden data"]
  node_garden_api["Plant and garden API<br/>[app.py]"]
  node_sensor_ingest["Reading ingest<br/>[app.py]"]
  node_sqlite[("SQLite store<br/>[db.py]")]
end

subgraph group_cameras["Camera monitoring"]
  node_camera_api["Camera API<br/>[app.py]"]
  node_camera_poller["Camera poller<br/>[app.py]"]
  node_vision["Canopy vision<br/>[vision.py]"]
end

node_gardener(("Grower"))
node_sensor(("Sensor sender"))
node_camera_source(("Camera source"))

node_gardener -->|"opens"| node_web_page
node_web_page -->|"loads"| node_web_ui
node_web_ui -->|"requests"| node_api
node_sensor -->|"posts readings"| node_sensor_ingest
node_sensor_ingest -->|"stores readings"| node_sqlite
node_gardener -->|"requests forecasts"| node_api
node_api -->|"predicts"| node_growth_model
node_growth_model -->|"uses ranges"| node_profiles
node_api -->|"routes plant data"| node_garden_api
node_garden_api -->|"reads and writes"| node_sqlite
node_garden_api -->|"forecasts plant"| node_growth_model
node_camera_source -->|"sends snapshots"| node_camera_api
node_web_ui -->|"uploads photos"| node_camera_api
node_camera_api -->|"polls camera"| node_camera_poller
node_camera_poller -->|"fetches and analyzes"| node_vision
node_camera_api -->|"processes snapshots"| node_vision
node_camera_api -->|"stores canopy readings"| node_sqlite

click node_web_ui "https://github.com/maypencs/growsight/blob/main/growsight/static/app.js"
click node_web_page "https://github.com/maypencs/growsight/blob/main/growsight/static/index.html"
click node_api "https://github.com/maypencs/growsight/blob/main/growsight/app.py"
click node_profiles "https://github.com/maypencs/growsight/blob/main/growsight/profiles.py"
click node_growth_model "https://github.com/maypencs/growsight/blob/main/growsight/model.py"
click node_garden_api "https://github.com/maypencs/growsight/blob/main/growsight/app.py"
click node_sensor_ingest "https://github.com/maypencs/growsight/blob/main/growsight/app.py"
click node_sqlite "https://github.com/maypencs/growsight/blob/main/growsight/db.py"
click node_camera_api "https://github.com/maypencs/growsight/blob/main/growsight/app.py"
click node_camera_poller "https://github.com/maypencs/growsight/blob/main/growsight/app.py"
click node_vision "https://github.com/maypencs/growsight/blob/main/growsight/vision.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_web_ui,node_web_page,node_api toneBlue
class node_profiles,node_growth_model toneAmber
class node_garden_api,node_sensor_ingest,node_sqlite toneMint
class node_camera_api,node_camera_poller,node_vision toneRose
class node_gardener,node_sensor,node_camera_source toneIndigo
```

## Components

### User interface

- [Web interface](https://github.com/maypencs/growsight/blob/main/growsight/static/app.js): `growsight/static/app.js`
- [Web page](https://github.com/maypencs/growsight/blob/main/growsight/static/index.html): `growsight/static/index.html`
- [FastAPI service](https://github.com/maypencs/growsight/blob/main/growsight/app.py): `growsight/app.py`

### Prediction

- [Plant profiles](https://github.com/maypencs/growsight/blob/main/growsight/profiles.py): `growsight/profiles.py`
- [Growth model](https://github.com/maypencs/growsight/blob/main/growsight/model.py): `growsight/model.py`

### Garden data

- [Plant and garden API](https://github.com/maypencs/growsight/blob/main/growsight/app.py): `growsight/app.py`
- [Reading ingest](https://github.com/maypencs/growsight/blob/main/growsight/app.py): `growsight/app.py`
- [SQLite store](https://github.com/maypencs/growsight/blob/main/growsight/db.py): `growsight/db.py`

### Camera monitoring

- [Camera API](https://github.com/maypencs/growsight/blob/main/growsight/app.py): `growsight/app.py`
- [Camera poller](https://github.com/maypencs/growsight/blob/main/growsight/app.py): `growsight/app.py`
- [Canopy vision](https://github.com/maypencs/growsight/blob/main/growsight/vision.py): `growsight/vision.py`

### Other components

- **Grower**
- **Sensor sender**
- **Camera source**

## Connections

- Grower → Web page: opens (evidence: `README.md`)
- Web page → Web interface: loads (evidence: `README.md`)
- Web interface → FastAPI service: requests (evidence: `growsight/static/app.js`)
- Sensor sender → Reading ingest: posts readings (evidence: `README.md`)
- Reading ingest → SQLite store: stores readings (evidence: `growsight/app.py`)
- Grower → FastAPI service: requests forecasts (evidence: `README.md`)
- FastAPI service → Growth model: predicts (evidence: `growsight/app.py`)
- Growth model → Plant profiles: uses ranges (evidence: `growsight/model.py`)
- FastAPI service → Plant and garden API: routes plant data (evidence: `growsight/app.py`)
- Plant and garden API → SQLite store: reads and writes (evidence: `growsight/app.py`)
- Plant and garden API → Growth model: forecasts plant (evidence: `growsight/app.py`)
- Camera source → Camera API: sends snapshots (evidence: `README.md`)
- Web interface → Camera API: uploads photos (evidence: `growsight/static/app.js`)
- Camera API → Camera poller: polls camera (evidence: `growsight/app.py`)
- Camera poller → Canopy vision: fetches and analyzes (evidence: `growsight/app.py`)
- Camera API → Canopy vision: processes snapshots (evidence: `growsight/app.py`)
- Camera API → SQLite store: stores canopy readings (evidence: `growsight/app.py`)
