# shekhar-commit/crop_disease_detection architecture

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

- Interactive diagram: https://gitdiagram.com/shekhar-commit/crop_disease_detection
- Repository: https://github.com/shekhar-commit/crop_disease_detection

## Overview

AgriDoc AI lets a farmer upload a crop image and receive a disease diagnosis and practical recovery plan in Hindi or English. The React app manages image selection, submits the image and language to the diagnosis API, displays the returned report, and stores recent scans in browser local storage. The Express endpoint builds a language-specific diagnostic prompt and requests analysis from Gemini. The excerpts show these main interactions; other UI behavior and styling are not fully sampled.

Main entry points: [`src/App.tsx`](https://github.com/shekhar-commit/crop_disease_detection/blob/master/src/App.tsx) (Diagnosis interface), [`server.ts`](https://github.com/shekhar-commit/crop_disease_detection/blob/master/server.ts) (Diagnosis endpoint), [`src/main.tsx`](https://github.com/shekhar-commit/crop_disease_detection/blob/master/src/main.tsx) (App bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Farmer app"]
  node_bootstrap["App bootstrap<br/>[main.tsx]"]
  node_diagnosis_ui["Diagnosis interface<br/>[App.tsx]"]
  node_scan_history[("Recent scans<br/>[App.tsx]")]
end

subgraph group_backend["Diagnosis service"]
  node_api["Diagnosis endpoint<br/>[server.ts]"]
end

subgraph group_ai["AI provider"]
  node_gemini["Gemini AI"]
end

node_farmer(("Farmer"))

node_bootstrap -->|"renders"| node_diagnosis_ui
node_farmer -->|"uploads image"| node_diagnosis_ui
node_diagnosis_ui -->|"posts image"| node_api
node_api -->|"requests analysis"| node_gemini
node_api -->|"returns report"| node_diagnosis_ui
node_diagnosis_ui -->|"stores scans"| node_scan_history

click node_bootstrap "https://github.com/shekhar-commit/crop_disease_detection/blob/master/src/main.tsx"
click node_diagnosis_ui "https://github.com/shekhar-commit/crop_disease_detection/blob/master/src/App.tsx"
click node_scan_history "https://github.com/shekhar-commit/crop_disease_detection/blob/master/src/App.tsx"
click node_api "https://github.com/shekhar-commit/crop_disease_detection/blob/master/server.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_bootstrap,node_diagnosis_ui,node_scan_history toneBlue
class node_api toneAmber
class node_gemini toneMint
class node_farmer toneIndigo
```

## Components

### Farmer app

- [App bootstrap](https://github.com/shekhar-commit/crop_disease_detection/blob/master/src/main.tsx): `src/main.tsx`
- [Diagnosis interface](https://github.com/shekhar-commit/crop_disease_detection/blob/master/src/App.tsx): `src/App.tsx`
- [Recent scans](https://github.com/shekhar-commit/crop_disease_detection/blob/master/src/App.tsx): `src/App.tsx`

### Diagnosis service

- [Diagnosis endpoint](https://github.com/shekhar-commit/crop_disease_detection/blob/master/server.ts): `server.ts`

### AI provider

- **Gemini AI**

### Other components

- **Farmer**

## Connections

- App bootstrap → Diagnosis interface: renders (evidence: `src/main.tsx`)
- Farmer → Diagnosis interface: uploads image (evidence: `src/App.tsx`)
- Diagnosis interface → Diagnosis endpoint: posts image (evidence: `src/App.tsx`)
- Diagnosis endpoint → Gemini AI: requests analysis (evidence: `server.ts`)
- Diagnosis endpoint → Diagnosis interface: returns report (evidence: `server.ts`)
- Diagnosis interface → Recent scans: stores scans (evidence: `src/App.tsx`)
