# zaheerk19n/argovision-ai architecture

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

- Interactive diagram: https://gitdiagram.com/zaheerk19n/argovision-ai
- Repository: https://github.com/zaheerk19n/argovision-ai

## Overview

AgroVision AI is a crop-health platform: a farmer signs in, uploads a leaf image, receives a disease classification, and can review farm status, managed crops, alerts, and prior scans. The React client calls an Express API, which coordinates persistence and the documented ML and Gemini integrations. The frontend routing and several calls, plus the Express-to-ML request, are visible in excerpts; other service links and unsampled feature endpoints are based on the root README, not inspected implementation.

Main entry points: [`server/src/server.mjs`](https://github.com/zaheerk19n/argovision-ai/blob/main/server/src/server.mjs) (Express API), [`crop-frontend/src/App.jsx`](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/App.jsx) (App routing), [`crop-frontend/src/pages/Signup.jsx`](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Signup.jsx) (Signup flow), [`crop-frontend/src/pages/Predict.jsx`](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Predict.jsx) (Leaf upload)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App routing<br/>[App.jsx]"]
  node_signup["Signup flow<br/>[Signup.jsx]"]
  node_login["Login form<br/>[Login.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_predict["Leaf upload<br/>[Predict.jsx]"]
  node_chatbot["Advisor chat UI<br/>[Chatbot.jsx]"]
  node_dashboard["Farm dashboard<br/>[Dashboard.jsx]"]
  node_diseases["Disease library<br/>[Diseases.jsx]"]
  node_history["Scan history view<br/>[History.jsx]"]
  node_usercrops["Managed crops view<br/>[UserCrop.jsx]"]
  node_notifications["Notifications view<br/>[Notification.jsx]"]
  node_details["Account details<br/>[Details.jsx]"]
end

subgraph group_api["API and identity"]
  node_express["Express API<br/>[server.mjs]"]
  node_auth["JWT middleware<br/>[auth.mjs]"]
  node_userstore[("User model<br/>[User.js]")]
  node_mongodb[("MongoDB records")]
end

subgraph group_diagnosis["Diagnosis and advice"]
  node_ml["ML inference service<br/>[main.py]"]
  node_gemini["Gemini AI"]
end

subgraph group_farm["Farm records"]
  node_cropslist["Crop reference data<br/>[cropslist.js]"]
end

node_farmer(("Farmer"))

node_farmer -->|"uses"| node_app
node_app -->|"renders"| node_navbar
node_app -->|"routes to"| node_signup
node_app -->|"routes to"| node_predict
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_diseases
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_usercrops
node_app -->|"routes to"| node_notifications
node_app -->|"routes to"| node_details
node_signup -->|"renders"| node_login
node_signup -->|"submits credentials"| node_express
node_predict -->|"posts image"| node_express
node_predict -->|"renders"| node_chatbot
node_usercrops -->|"manages crops"| node_express
node_express -->|"authenticates requests"| node_auth
node_express -->|"queries users"| node_userstore
node_express -->|"persists records"| node_mongodb
node_express -->|"forwards image"| node_ml
node_ml -->|"returns diagnosis"| node_express
node_express -->|"requests advice"| node_gemini
node_dashboard -->|"requests metrics"| node_express
node_history -->|"requests scan log"| node_express
node_diseases -->|"requests catalog"| node_express
node_notifications -->|"requests alerts"| node_express
node_usercrops -.->|"uses crop data"| node_cropslist

click node_app "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/App.jsx"
click node_signup "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Signup.jsx"
click node_login "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/components/Login.jsx"
click node_navbar "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/components/Navbar.jsx"
click node_predict "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Predict.jsx"
click node_chatbot "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/components/Chatbot.jsx"
click node_dashboard "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Dashboard.jsx"
click node_diseases "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Diseases.jsx"
click node_history "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/History.jsx"
click node_usercrops "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/UserCrop.jsx"
click node_notifications "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Notification.jsx"
click node_details "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Details.jsx"
click node_express "https://github.com/zaheerk19n/argovision-ai/blob/main/server/src/server.mjs"
click node_auth "https://github.com/zaheerk19n/argovision-ai/blob/main/server/src/middleware/auth.mjs"
click node_userstore "https://github.com/zaheerk19n/argovision-ai/blob/main/server/src/models/User.js"
click node_ml "https://github.com/zaheerk19n/argovision-ai/blob/main/ml-service/app/main.py"
click node_cropslist "https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/data/cropslist.js"

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_signup,node_login,node_navbar,node_predict,node_chatbot,node_dashboard,node_diseases,node_history,node_usercrops,node_notifications,node_details toneBlue
class node_express,node_auth,node_userstore,node_mongodb toneAmber
class node_ml,node_gemini toneMint
class node_cropslist toneRose
class node_farmer toneIndigo
```

## Components

### Web client

- [App routing](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/App.jsx): `crop-frontend/src/App.jsx`
- [Signup flow](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Signup.jsx): `crop-frontend/src/pages/Signup.jsx`
- [Login form](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/components/Login.jsx): `crop-frontend/src/components/Login.jsx`
- [Navigation](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/components/Navbar.jsx): `crop-frontend/src/components/Navbar.jsx`
- [Leaf upload](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Predict.jsx): `crop-frontend/src/pages/Predict.jsx`
- [Advisor chat UI](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/components/Chatbot.jsx): `crop-frontend/src/components/Chatbot.jsx`
- [Farm dashboard](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Dashboard.jsx): `crop-frontend/src/pages/Dashboard.jsx`
- [Disease library](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Diseases.jsx): `crop-frontend/src/pages/Diseases.jsx`
- [Scan history view](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/History.jsx): `crop-frontend/src/pages/History.jsx`
- [Managed crops view](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/UserCrop.jsx): `crop-frontend/src/pages/UserCrop.jsx`
- [Notifications view](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Notification.jsx): `crop-frontend/src/pages/Notification.jsx`
- [Account details](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/pages/Details.jsx): `crop-frontend/src/pages/Details.jsx`

### API and identity

- [Express API](https://github.com/zaheerk19n/argovision-ai/blob/main/server/src/server.mjs): `server/src/server.mjs`
- [JWT middleware](https://github.com/zaheerk19n/argovision-ai/blob/main/server/src/middleware/auth.mjs): `server/src/middleware/auth.mjs`
- [User model](https://github.com/zaheerk19n/argovision-ai/blob/main/server/src/models/User.js): `server/src/models/User.js`
- **MongoDB records**

### Diagnosis and advice

- [ML inference service](https://github.com/zaheerk19n/argovision-ai/blob/main/ml-service/app/main.py): `ml-service/app/main.py`
- **Gemini AI**

### Farm records

- [Crop reference data](https://github.com/zaheerk19n/argovision-ai/blob/main/crop-frontend/src/data/cropslist.js): `crop-frontend/src/data/cropslist.js`

### Other components

- **Farmer**

## Connections

- Farmer → App routing: uses (evidence: `README.md`)
- App routing → Navigation: renders (evidence: `crop-frontend/src/App.jsx`)
- App routing → Signup flow: routes to (evidence: `crop-frontend/src/App.jsx`)
- App routing → Leaf upload: routes to (evidence: `crop-frontend/src/App.jsx`)
- App routing → Farm dashboard: routes to (evidence: `crop-frontend/src/App.jsx`)
- App routing → Disease library: routes to (evidence: `crop-frontend/src/App.jsx`)
- App routing → Scan history view: routes to (evidence: `crop-frontend/src/App.jsx`)
- App routing → Managed crops view: routes to (evidence: `crop-frontend/src/App.jsx`)
- App routing → Notifications view: routes to (evidence: `crop-frontend/src/App.jsx`)
- App routing → Account details: routes to (evidence: `crop-frontend/src/App.jsx`)
- Signup flow → Login form: renders (evidence: `crop-frontend/src/pages/Signup.jsx`)
- Signup flow → Express API: submits credentials (evidence: `crop-frontend/src/pages/Signup.jsx`)
- Leaf upload → Express API: posts image (evidence: `crop-frontend/src/pages/Predict.jsx`)
- Leaf upload → Advisor chat UI: renders (evidence: `crop-frontend/src/pages/Predict.jsx`)
- Managed crops view → Express API: manages crops (evidence: `crop-frontend/src/pages/UserCrop.jsx`)
- Express API → JWT middleware: authenticates requests (evidence: `server/src/server.mjs`)
- Express API → User model: queries users (evidence: `server/src/server.mjs`)
- Express API → MongoDB records: persists records (evidence: `README.md`)
- Express API → ML inference service: forwards image (evidence: `server/src/server.mjs`)
- ML inference service → Express API: returns diagnosis (evidence: `README.md`)
- Express API → Gemini AI: requests advice (evidence: `README.md`)
- Farm dashboard → Express API: requests metrics (evidence: `README.md`)
- Scan history view → Express API: requests scan log (evidence: `README.md`)
- Disease library → Express API: requests catalog (evidence: `README.md`)
- Notifications view → Express API: requests alerts (evidence: `README.md`)
- Managed crops view → Crop reference data: uses crop data
