# aryanniralacsda25a07014-design/suryawatch architecture

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

- Interactive diagram: https://gitdiagram.com/aryanniralacsda25a07014-design/suryawatch
- Repository: https://github.com/aryanniralacsda25a07014-design/suryawatch

## Overview

SuryaWatch is a rooftop-solar planning and monitoring application. Users can estimate system sizing, costs and savings, then register a system and submit inverter readings manually or from a display photo; Watch mode compares production with modeled sunlight and provides a diagnosis. The API is the backend entry point, with weather and solar models supporting planning and diagnosis, and scheduled checks sending actionable alerts. The README is empty, so the map relies on the source index and shown excerpts; frontend-to-API wiring and some route details are not shown.

Main entry points: [`backend/api.py`](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/api.py) (HTTP API), [`backend/watch.py`](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/watch.py) (Watch service), [`backend/weather.py`](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/weather.py) (Weather data), [`backend/daily_check.py`](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/daily_check.py) (Scheduled checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_webapp["Web app<br/>[app.js]"]
end

subgraph group_planning["Solar planning"]
  node_planner["Plan calculator<br/>[planner.py]"]
  node_weather["Weather data<br/>[weather.py]"]
  node_solar["Solar model<br/>[solar.py]"]
end

subgraph group_monitoring["System monitoring"]
  node_watch["Watch service<br/>[watch.py]"]
  node_reader["Photo reader<br/>[reader.py]"]
end

subgraph group_insights["Insights and alerts"]
  node_verdict["Daily diagnosis<br/>[verdict.py]"]
  node_assistant["Solar assistant<br/>[assistant.py]"]
  node_daily["Scheduled checks<br/>[daily_check.py]"]
  node_alerts["Email alerts<br/>[alerts.py]"]
end

subgraph group_platform["Backend platform"]
  node_http["HTTP API<br/>[api.py]"]
  node_store[("Application storage<br/>[store.py]")]
end

node_owner(("Solar owner"))
node_openmeteo["Open-Meteo"]
node_nasa["NASA POWER"]
node_bedrock["Amazon Bedrock"]
node_sns["Amazon SNS"]

node_owner -.->|"uses"| node_webapp
node_webapp -.->|"requests"| node_http
node_http -->|"calculates plans"| node_planner
node_http -->|"handles monitoring"| node_watch
node_http -->|"reads photos"| node_reader
node_http -->|"answers questions"| node_assistant
node_http -->|"loads sunlight"| node_weather
node_http -->|"models output"| node_solar
node_http -->|"saves plans"| node_store
node_planner -->|"loads climatology"| node_weather
node_weather -->|"fetches forecasts"| node_openmeteo
node_weather -->|"fetches climatology"| node_nasa
node_weather -->|"uses solar model"| node_solar
node_watch -->|"reads and writes"| node_store
node_watch -->|"uses solar model"| node_solar
node_watch -->|"loads conditions"| node_weather
node_watch -->|"builds diagnosis"| node_verdict
node_reader -->|"analyzes photos"| node_bedrock
node_assistant -->|"generates answers"| node_bedrock
node_daily -->|"gets day view"| node_watch
node_daily -->|"lists systems"| node_store
node_daily -->|"sends notifications"| node_alerts
node_daily -->|"requests summary"| node_assistant
node_alerts -->|"stores subscriptions"| node_store
node_alerts -->|"publishes email"| node_sns

click node_webapp "https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/frontend/app.js"
click node_http "https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/api.py"
click node_planner "https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/planner.py"
click node_weather "https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/weather.py"
click node_solar "https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/solar.py"
click node_watch "https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/watch.py"
click node_reader "https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/reader.py"
click node_verdict "https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/verdict.py"
click node_assistant "https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/assistant.py"
click node_daily "https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/daily_check.py"
click node_alerts "https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/alerts.py"
click node_store "https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/store.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_webapp toneBlue
class node_planner,node_weather,node_solar toneAmber
class node_watch,node_reader toneMint
class node_verdict,node_assistant,node_daily,node_alerts toneRose
class node_http,node_store,node_owner,node_openmeteo,node_nasa,node_bedrock,node_sns toneIndigo
```

## Components

### User experience

- [Web app](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/frontend/app.js): `frontend/app.js`

### Solar planning

- [Plan calculator](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/planner.py): `backend/planner.py`
- [Weather data](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/weather.py): `backend/weather.py`
- [Solar model](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/solar.py): `backend/solar.py`

### System monitoring

- [Watch service](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/watch.py): `backend/watch.py`
- [Photo reader](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/reader.py): `backend/reader.py`

### Insights and alerts

- [Daily diagnosis](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/verdict.py): `backend/verdict.py`
- [Solar assistant](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/assistant.py): `backend/assistant.py`
- [Scheduled checks](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/daily_check.py): `backend/daily_check.py`
- [Email alerts](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/alerts.py): `backend/alerts.py`

### Backend platform

- [HTTP API](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/api.py): `backend/api.py`
- [Application storage](https://github.com/aryanniralacsda25a07014-design/suryawatch/blob/main/backend/store.py): `backend/store.py`

### Other components

- **Solar owner**
- **Open-Meteo**
- **NASA POWER**
- **Amazon Bedrock**
- **Amazon SNS**

## Connections

- Solar owner → Web app: uses
- Web app → HTTP API: requests
- HTTP API → Plan calculator: calculates plans (evidence: `backend/api.py`)
- HTTP API → Watch service: handles monitoring (evidence: `backend/api.py`)
- HTTP API → Photo reader: reads photos (evidence: `backend/api.py`)
- HTTP API → Solar assistant: answers questions (evidence: `backend/api.py`)
- HTTP API → Weather data: loads sunlight (evidence: `backend/api.py`)
- HTTP API → Solar model: models output (evidence: `backend/api.py`)
- HTTP API → Application storage: saves plans (evidence: `backend/api.py`)
- Plan calculator → Weather data: loads climatology (evidence: `backend/planner.py`)
- Weather data → Open-Meteo: fetches forecasts (evidence: `backend/weather.py`)
- Weather data → NASA POWER: fetches climatology (evidence: `backend/weather.py`)
- Weather data → Solar model: uses solar model (evidence: `backend/weather.py`)
- Watch service → Application storage: reads and writes (evidence: `backend/watch.py`)
- Watch service → Solar model: uses solar model (evidence: `backend/watch.py`)
- Watch service → Weather data: loads conditions (evidence: `backend/watch.py`)
- Watch service → Daily diagnosis: builds diagnosis (evidence: `backend/watch.py`)
- Photo reader → Amazon Bedrock: analyzes photos (evidence: `backend/reader.py`)
- Solar assistant → Amazon Bedrock: generates answers (evidence: `backend/assistant.py`)
- Scheduled checks → Watch service: gets day view (evidence: `backend/daily_check.py`)
- Scheduled checks → Application storage: lists systems (evidence: `backend/daily_check.py`)
- Scheduled checks → Email alerts: sends notifications (evidence: `backend/daily_check.py`)
- Scheduled checks → Solar assistant: requests summary (evidence: `backend/daily_check.py`)
- Email alerts → Application storage: stores subscriptions (evidence: `backend/alerts.py`)
- Email alerts → Amazon SNS: publishes email (evidence: `backend/alerts.py`)
