# saidurga144/agripredict architecture

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

- Interactive diagram: https://gitdiagram.com/saidurga144/agripredict
- Repository: https://github.com/saidurga144/agripredict

## Overview

AgriPredict is a farmer-facing agricultural advisory app: users enter farm and crop conditions for yield forecasts, or submit plant images for disease diagnosis; the app also offers weather, analytics, and agricultural chat. The frontend handles authentication and role-based navigation, while a FastAPI backend exposes prediction, disease, and chat capabilities. Evidence is strongest for frontend routing, context behavior, and disease-engine setup; several feature-to-backend connections are not visible in the excerpts and are omitted rather than assumed.

Main entry points: [`frontend/src/App.jsx`](https://github.com/saidurga144/agripredict/blob/main/frontend/src/App.jsx) (App routing), [`frontend/src/context/WeatherContext.jsx`](https://github.com/saidurga144/agripredict/blob/main/frontend/src/context/WeatherContext.jsx) (Weather context), [`frontend/src/components/FarmerDashboard.jsx`](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/FarmerDashboard.jsx) (Farmer dashboard), [`frontend/src/components/Login.jsx`](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/Login.jsx) (Login and signup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["App routing<br/>[App.jsx]"]
  node_landing["Landing page<br/>[LandingPage.jsx]"]
  node_farmer_dash["Farmer dashboard"]
  node_officer_dash["Officer dashboard"]
  node_dashboard["Dashboard home<br/>[DashboardHome.jsx]"]
  node_analytics["Analytics"]
  node_weather_view["Weather dashboard"]
  node_chat_ui["Agricultural chat<br/>[Chatbot.jsx]"]
  node_disease_ui["Disease detector"]
  node_prediction_result["Prediction result"]
end

subgraph group_identity["Identity and preferences"]
  node_login["Login and signup<br/>[Login.jsx]"]
  node_firebase["Firebase client<br/>[firebase.js]"]
  node_language["Language context"]
  node_translations["Translations<br/>[translations.js]"]
end

subgraph group_advisory["Farm advisory features"]
  node_weather_context["Weather context<br/>[WeatherContext.jsx]"]
  node_location_popup["Location prompt<br/>[LocationPopup.jsx]"]
end

subgraph group_services["Backend services"]
  node_backend["FastAPI endpoints<br/>[main.py]"]
  node_disease_engine["Disease analysis engine<br/>[disease_engine.py]"]
end

node_farmer(("Farmer"))
node_weather_service["OpenWeather API"]
node_groq["Groq AI"]

node_farmer -->|"opens app"| node_landing
node_app -->|"renders"| node_landing
node_app -->|"renders"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_farmer_dash
node_app -->|"routes to"| node_officer_dash
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_weather_view
node_app -->|"routes to"| node_chat_ui
node_app -->|"routes to"| node_disease_ui
node_farmer_dash -->|"renders"| node_prediction_result
node_login -->|"uses auth"| node_firebase
node_app -->|"provides context"| node_language
node_language -->|"reads strings"| node_translations
node_weather_context -->|"renders"| node_location_popup
node_weather_context -->|"fetches forecasts"| node_weather_service
node_backend -->|"uses engine"| node_disease_engine
node_disease_engine -->|"requests analysis"| node_groq

click node_app "https://github.com/saidurga144/agripredict/blob/main/frontend/src/App.jsx"
click node_landing "https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/LandingPage.jsx"
click node_farmer_dash "https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/FarmerDashboard.jsx"
click node_officer_dash "https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/OfficerDashboard.jsx"
click node_dashboard "https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/DashboardHome.jsx"
click node_analytics "https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/AnalyticsDashboard.jsx"
click node_weather_view "https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/WeatherDashboard.jsx"
click node_chat_ui "https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/Chatbot.jsx"
click node_disease_ui "https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/PlantDiseaseDetector.jsx"
click node_prediction_result "https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/PredictionResult.jsx"
click node_login "https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/Login.jsx"
click node_firebase "https://github.com/saidurga144/agripredict/blob/main/frontend/src/firebase.js"
click node_language "https://github.com/saidurga144/agripredict/blob/main/frontend/src/context/LanguageContext.jsx"
click node_translations "https://github.com/saidurga144/agripredict/blob/main/frontend/src/utils/translations.js"
click node_weather_context "https://github.com/saidurga144/agripredict/blob/main/frontend/src/context/WeatherContext.jsx"
click node_location_popup "https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/LocationPopup.jsx"
click node_backend "https://github.com/saidurga144/agripredict/blob/main/backend/main.py"
click node_disease_engine "https://github.com/saidurga144/agripredict/blob/main/backend/utils/disease_engine.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_app,node_landing,node_farmer_dash,node_officer_dash,node_dashboard,node_analytics,node_weather_view,node_chat_ui,node_disease_ui,node_prediction_result toneBlue
class node_login,node_firebase,node_language,node_translations toneAmber
class node_weather_context,node_location_popup,node_weather_service toneMint
class node_backend,node_disease_engine toneRose
class node_farmer,node_groq toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/saidurga144/agripredict/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Landing page](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/LandingPage.jsx): `frontend/src/components/LandingPage.jsx`
- [Farmer dashboard](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/FarmerDashboard.jsx): `frontend/src/components/FarmerDashboard.jsx`
- [Officer dashboard](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/OfficerDashboard.jsx): `frontend/src/components/OfficerDashboard.jsx`
- [Dashboard home](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/DashboardHome.jsx): `frontend/src/components/DashboardHome.jsx`
- [Analytics](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/AnalyticsDashboard.jsx): `frontend/src/components/AnalyticsDashboard.jsx`
- [Weather dashboard](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/WeatherDashboard.jsx): `frontend/src/components/WeatherDashboard.jsx`
- [Agricultural chat](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/Chatbot.jsx): `frontend/src/components/Chatbot.jsx`
- [Disease detector](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/PlantDiseaseDetector.jsx): `frontend/src/components/PlantDiseaseDetector.jsx`
- [Prediction result](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/PredictionResult.jsx): `frontend/src/components/PredictionResult.jsx`

### Identity and preferences

- [Login and signup](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/Login.jsx): `frontend/src/components/Login.jsx`
- [Firebase client](https://github.com/saidurga144/agripredict/blob/main/frontend/src/firebase.js): `frontend/src/firebase.js`
- [Language context](https://github.com/saidurga144/agripredict/blob/main/frontend/src/context/LanguageContext.jsx): `frontend/src/context/LanguageContext.jsx`
- [Translations](https://github.com/saidurga144/agripredict/blob/main/frontend/src/utils/translations.js): `frontend/src/utils/translations.js`

### Farm advisory features

- [Weather context](https://github.com/saidurga144/agripredict/blob/main/frontend/src/context/WeatherContext.jsx): `frontend/src/context/WeatherContext.jsx`
- [Location prompt](https://github.com/saidurga144/agripredict/blob/main/frontend/src/components/LocationPopup.jsx): `frontend/src/components/LocationPopup.jsx`

### Backend services

- [FastAPI endpoints](https://github.com/saidurga144/agripredict/blob/main/backend/main.py): `backend/main.py`
- [Disease analysis engine](https://github.com/saidurga144/agripredict/blob/main/backend/utils/disease_engine.py): `backend/utils/disease_engine.py`

### Other components

- **Farmer**
- **OpenWeather API**
- **Groq AI**

## Connections

- Farmer → Landing page: opens app
- App routing → Landing page: renders (evidence: `frontend/src/App.jsx`)
- App routing → Login and signup: renders (evidence: `frontend/src/App.jsx`)
- App routing → Dashboard home: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Farmer dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Officer dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Analytics: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Weather dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Agricultural chat: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Disease detector: routes to (evidence: `frontend/src/App.jsx`)
- Farmer dashboard → Prediction result: renders (evidence: `frontend/src/components/FarmerDashboard.jsx`)
- Login and signup → Firebase client: uses auth (evidence: `frontend/src/components/Login.jsx`)
- App routing → Language context: provides context (evidence: `frontend/src/App.jsx`)
- Language context → Translations: reads strings (evidence: `frontend/src/context/LanguageContext.jsx`)
- Weather context → Location prompt: renders (evidence: `frontend/src/context/WeatherContext.jsx`)
- Weather context → OpenWeather API: fetches forecasts (evidence: `frontend/src/context/WeatherContext.jsx`)
- FastAPI endpoints → Disease analysis engine: uses engine (evidence: `backend/main.py`)
- Disease analysis engine → Groq AI: requests analysis (evidence: `backend/utils/disease_engine.py`)
