# harshvardhan226510/sih-2026-project architecture

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

- Interactive diagram: https://gitdiagram.com/harshvardhan226510/sih-2026-project
- Repository: https://github.com/harshvardhan226510/sih-2026-project

## Overview

WeatherGPT is a weather information and decision-support application. Its central workflow ingests official weather alerts, normalizes and stores them, then serves them to an offline-capable dashboard that synchronizes local data. It also provides meteorological research analytics and aviation/marine views, with a separate farmer dashboard for forecasts and crop advice. The alert and research paths are supported by README documentation and sampled code; unsampled feature wiring is kept broad, and the farmer dashboard is shown as a separate API-backed workflow.

Main entry points: [`src/features/alerts/server/services/ingestion.js`](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/services/ingestion.js) (Alert Ingestion), [`src/features/alerts/server/controllers/alertController.js`](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/controllers/alertController.js) (Alert Handlers), [`src/App.jsx`](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/App.jsx) (React App), [`farmer-dashboard/server/src/server.js`](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/farmer-dashboard/server/src/server.js) (Farmer API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_app["React App<br/>[App.jsx]"]
end

subgraph group_alerts["Weather Alerts"]
  node_alertui["Alert Dashboard<br/>[AlertDashboard.jsx]"]
  node_alertapi["Alert API<br/>[alertApi.js]"]
  node_localsync["Offline Sync<br/>[syncService.js]"]
  node_localdb[("IndexedDB Copy<br/>[alertDb.js]")]
  node_alertserver["Alert Server<br/>[app.js]"]
  node_alertcontroller["Alert Handlers<br/>[alertController.js]"]
  node_scheduler["Ingestion Scheduler<br/>[scheduler.js]"]
  node_ingestion["Alert Ingestion<br/>[ingestion.js]"]
  node_normalize["Normalize And Process<br/>[normalization.js]"]
  node_alertrepo["Alert Repository<br/>[alertRepository.js]"]
  node_alertstore[("Alert Database<br/>[connection.js]")]
  node_push["Push Delivery<br/>[webPush.js]"]
end

subgraph group_research["Research Analytics"]
  node_researchui["Research Dashboard"]
  node_researchquery["Research Query API<br/>[researchQuery.js]"]
  node_queryservice["Query Orchestrator"]
  node_analytics["Analytics Services"]
  node_weatheradapter["Weather Adapter"]
end

subgraph group_farmer["Farmer Dashboard"]
  node_farmerui["Farmer Dashboard<br/>[main.jsx]"]
  node_farmerapi["Farmer API<br/>[server.js]"]
  node_farmerweather["Weather Service<br/>[weatherService.js]"]
  node_advisory["Crop Advisory<br/>[advisoryRules.js]"]
  node_farmerrepo["Farm Repository"]
end

subgraph group_other["Specialized Weather"]
  node_aviation["Aviation And Marine<br/>[index.js]"]
  node_chatbot["Weather Chatbot<br/>[Module1View.jsx]"]
  node_chatfunction["Chat Handler<br/>[index.ts]"]
end

node_user(("Weather User"))
node_imd{{"IMD CAP Feed"}}
node_openmeteo{{"Open-Meteo"}}

node_user -->|"opens"| node_app
node_app -->|"shows alerts"| node_alertui
node_alertui -->|"requests alerts"| node_alertapi
node_alertapi -->|"calls API"| node_alertserver
node_alertserver -->|"dispatches"| node_alertcontroller
node_alertcontroller -->|"reads alerts"| node_alertrepo
node_alertcontroller -->|"requests sync data"| node_localsync
node_localsync -->|"updates copy"| node_localdb
node_alertui -->|"loads cached data"| node_localdb
node_scheduler -->|"starts ingestion"| node_ingestion
node_alertcontroller -->|"triggers ingestion"| node_ingestion
node_ingestion -->|"fetches CAP"| node_imd
node_ingestion -->|"normalizes and processes"| node_normalize
node_ingestion -->|"persists changes"| node_alertrepo
node_alertrepo -->|"reads and writes"| node_alertstore
node_ingestion -.->|"delivers alerts"| node_push
node_alertcontroller -->|"serves push status"| node_push
node_user -->|"asks research question"| node_researchui
node_researchui -->|"submits query"| node_researchquery
node_researchquery -->|"processes query"| node_queryservice
node_queryservice -->|"runs analytics"| node_analytics
node_analytics -->|"requests weather data"| node_weatheradapter
node_weatheradapter -->|"fetches data"| node_openmeteo
node_app -->|"offers weather views"| node_aviation
node_user -->|"uses farm advice"| node_farmerui
node_farmerui -->|"requests forecast"| node_farmerapi
node_farmerapi -->|"fetches weather"| node_farmerweather
node_farmerweather -->|"fetches forecast"| node_openmeteo
node_farmerapi -->|"generates advice"| node_advisory
node_farmerapi -->|"loads crops"| node_farmerrepo
node_app -->|"offers chat"| node_chatbot
node_chatbot -->|"sends questions"| node_chatfunction

click node_app "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/App.jsx"
click node_alertui "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/AlertDashboard.jsx"
click node_alertapi "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/services/alertApi.js"
click node_localsync "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/services/syncService.js"
click node_localdb "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/services/alertDb.js"
click node_alertserver "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/app.js"
click node_alertcontroller "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/controllers/alertController.js"
click node_scheduler "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/jobs/scheduler.js"
click node_ingestion "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/services/ingestion.js"
click node_normalize "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/services/normalization.js"
click node_alertrepo "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/repositories/alertRepository.js"
click node_alertstore "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/db/connection.js"
click node_push "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/services/webPush.js"
click node_researchui "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/research-analytics/ResearchDashboard.tsx"
click node_researchquery "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/research-analytics/server/routes/researchQuery.js"
click node_queryservice "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/research-analytics/server/services/researchQueryService.js"
click node_analytics "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/research-analytics/server/services/historicalService.js"
click node_weatheradapter "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/research-analytics/server/adapters/openMeteoAdapter.js"
click node_aviation "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/aviation-marine/server/routes/index.js"
click node_farmerui "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/farmer-dashboard/src/main.jsx"
click node_farmerapi "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/farmer-dashboard/server/src/server.js"
click node_farmerweather "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/farmer-dashboard/server/src/weatherService.js"
click node_advisory "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/farmer-dashboard/server/src/advisoryRules.js"
click node_farmerrepo "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/farmer-dashboard/server/src/farmerRepository.js"
click node_chatbot "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/chatbot/Module1View.jsx"
click node_chatfunction "https://github.com/harshvardhan226510/sih-2026-project/blob/develop/supabase/functions/chat-handler/index.ts"

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_app,node_user toneBlue
class node_alertui,node_alertapi,node_localsync,node_localdb,node_alertserver,node_alertcontroller,node_scheduler,node_ingestion,node_normalize,node_alertrepo,node_alertstore,node_push toneAmber
class node_researchui,node_researchquery,node_queryservice,node_analytics,node_weatheradapter toneMint
class node_farmerui,node_farmerapi,node_farmerweather,node_advisory,node_farmerrepo toneRose
class node_aviation,node_chatbot,node_chatfunction,node_imd,node_openmeteo toneIndigo
```

## Components

### Application

- [React App](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/App.jsx): `src/App.jsx`

### Weather Alerts

- [Alert Dashboard](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/AlertDashboard.jsx): `src/features/alerts/AlertDashboard.jsx`
- [Alert API](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/services/alertApi.js): `src/features/alerts/services/alertApi.js`
- [Offline Sync](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/services/syncService.js): `src/features/alerts/services/syncService.js`
- [IndexedDB Copy](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/services/alertDb.js): `src/features/alerts/services/alertDb.js`
- [Alert Server](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/app.js): `src/features/alerts/server/app.js`
- [Alert Handlers](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/controllers/alertController.js): `src/features/alerts/server/controllers/alertController.js`
- [Ingestion Scheduler](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/jobs/scheduler.js): `src/features/alerts/server/jobs/scheduler.js`
- [Alert Ingestion](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/services/ingestion.js): `src/features/alerts/server/services/ingestion.js`
- [Normalize And Process](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/services/normalization.js): `src/features/alerts/server/services/normalization.js`
- [Alert Repository](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/repositories/alertRepository.js): `src/features/alerts/server/repositories/alertRepository.js`
- [Alert Database](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/db/connection.js): `src/features/alerts/server/db/connection.js`
- [Push Delivery](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/alerts/server/services/webPush.js): `src/features/alerts/server/services/webPush.js`

### Research Analytics

- [Research Dashboard](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/research-analytics/ResearchDashboard.tsx): `src/features/research-analytics/ResearchDashboard.tsx`
- [Research Query API](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/research-analytics/server/routes/researchQuery.js): `src/features/research-analytics/server/routes/researchQuery.js`
- [Query Orchestrator](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/research-analytics/server/services/researchQueryService.js): `src/features/research-analytics/server/services/researchQueryService.js`
- [Analytics Services](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/research-analytics/server/services/historicalService.js): `src/features/research-analytics/server/services/historicalService.js`
- [Weather Adapter](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/research-analytics/server/adapters/openMeteoAdapter.js): `src/features/research-analytics/server/adapters/openMeteoAdapter.js`

### Farmer Dashboard

- [Farmer Dashboard](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/farmer-dashboard/src/main.jsx): `farmer-dashboard/src/main.jsx`
- [Farmer API](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/farmer-dashboard/server/src/server.js): `farmer-dashboard/server/src/server.js`
- [Weather Service](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/farmer-dashboard/server/src/weatherService.js): `farmer-dashboard/server/src/weatherService.js`
- [Crop Advisory](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/farmer-dashboard/server/src/advisoryRules.js): `farmer-dashboard/server/src/advisoryRules.js`
- [Farm Repository](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/farmer-dashboard/server/src/farmerRepository.js): `farmer-dashboard/server/src/farmerRepository.js`

### Specialized Weather

- [Aviation And Marine](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/aviation-marine/server/routes/index.js): `src/features/aviation-marine/server/routes/index.js`
- [Weather Chatbot](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/src/features/chatbot/Module1View.jsx): `src/features/chatbot/Module1View.jsx`
- [Chat Handler](https://github.com/harshvardhan226510/sih-2026-project/blob/develop/supabase/functions/chat-handler/index.ts): `supabase/functions/chat-handler/index.ts`

### Other components

- **Weather User**
- **IMD CAP Feed**
- **Open-Meteo**

## Connections

- Weather User → React App: opens
- React App → Alert Dashboard: shows alerts
- Alert Dashboard → Alert API: requests alerts
- Alert API → Alert Server: calls API
- Alert Server → Alert Handlers: dispatches
- Alert Handlers → Alert Repository: reads alerts
- Alert Handlers → Offline Sync: requests sync data
- Offline Sync → IndexedDB Copy: updates copy
- Alert Dashboard → IndexedDB Copy: loads cached data
- Ingestion Scheduler → Alert Ingestion: starts ingestion
- Alert Handlers → Alert Ingestion: triggers ingestion
- Alert Ingestion → IMD CAP Feed: fetches CAP
- Alert Ingestion → Normalize And Process: normalizes and processes
- Alert Ingestion → Alert Repository: persists changes
- Alert Repository → Alert Database: reads and writes
- Alert Ingestion → Push Delivery: delivers alerts
- Alert Handlers → Push Delivery: serves push status
- Weather User → Research Dashboard: asks research question
- Research Dashboard → Research Query API: submits query
- Research Query API → Query Orchestrator: processes query
- Query Orchestrator → Analytics Services: runs analytics
- Analytics Services → Weather Adapter: requests weather data
- Weather Adapter → Open-Meteo: fetches data
- React App → Aviation And Marine: offers weather views
- Weather User → Farmer Dashboard: uses farm advice
- Farmer Dashboard → Farmer API: requests forecast
- Farmer API → Weather Service: fetches weather
- Weather Service → Open-Meteo: fetches forecast
- Farmer API → Crop Advisory: generates advice
- Farmer API → Farm Repository: loads crops
- React App → Weather Chatbot: offers chat
- Weather Chatbot → Chat Handler: sends questions
