# jeet8499/farmmate architecture

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

- Interactive diagram: https://gitdiagram.com/jeet8499/farmmate
- Repository: https://github.com/jeet8499/farmmate

## Overview

This repository is a smart-agriculture web application with farmer and trader experiences, climate and field analysis, crop and disease features, irrigation, and financial-aid support. The main user flow is browser entry and routing into authentication or a product area; shared field state and services support data-backed screens. The sampled code confirms routing, shared field loading, climate-service use, and selected server capabilities. Many listed product areas have no sampled implementation excerpts, so their internal links are left unverified rather than inferred.

Main entry points: [`client/src/App.jsx`](https://github.com/jeet8499/farmmate/blob/main/client/src/App.jsx) (Application router), [`client/src/services/climateService.js`](https://github.com/jeet8499/farmmate/blob/main/client/src/services/climateService.js) (Climate data service), [`client/src/services/dataService.js`](https://github.com/jeet8499/farmmate/blob/main/client/src/services/dataService.js) (Field data service), [`server/server.cjs`](https://github.com/jeet8499/farmmate/blob/main/server/server.cjs) (Application server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Web application"]
  node_app["Application router<br/>[App.jsx]"]
  node_auth["Authentication<br/>[Auth.jsx]"]
  node_navbar["Farmer navigation<br/>[Navbar.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_assistant["AI assistant<br/>[AIAssistant.jsx]"]
  node_appstate["Shared field state<br/>[AppContext.jsx]"]
  node_config["API configuration<br/>[config.js]"]
  node_dataservice["Field data service<br/>[dataService.js]"]
end

subgraph group_climate["Climate analysis"]
  node_climatepage["Climate overview"]
  node_fire["Fire analysis<br/>[FireAnalysis.jsx]"]
  node_rainfall["Rainfall analysis"]
  node_soil["Soil analysis"]
  node_vegetation["Vegetation analysis"]
  node_waterclimate["Water analysis"]
  node_climateservice["Climate data service<br/>[climateService.js]"]
end

subgraph group_farm["Farm operations"]
  node_crop["Crop management<br/>[CropManagement.jsx]"]
  node_disease["Disease detection"]
  node_waterops["Water management"]
  node_financial["Financial aid<br/>[FinancialAid.jsx]"]
end

subgraph group_trader["Trader tools"]
  node_traderconnections["Trader connections<br/>[Connections.jsx]"]
  node_connectiondata["Connection records<br/>[connectiondata.js]"]
end

subgraph group_backend["Backend services"]
  node_traderoutes["Trader API<br/>[Trader.js]"]
  node_authroutes["Authentication API<br/>[AuthRoutes.js]"]
  node_server["Application server<br/>[server.cjs]"]
  node_db[("Postgres database")]
  node_gee["Earth Engine datasets"]
  node_ml["ML service<br/>[app.py]"]
end

node_user(("Farmer or trader"))

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_auth
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_climatepage
node_app -->|"routes to"| node_crop
node_app -->|"routes to"| node_disease
node_app -->|"routes to"| node_waterops
node_app -->|"routes to"| node_financial
node_app -->|"routes to"| node_fire
node_app -->|"routes to"| node_rainfall
node_app -->|"routes to"| node_soil
node_app -->|"routes to"| node_vegetation
node_app -->|"routes to"| node_waterclimate
node_app -->|"routes to"| node_assistant
node_app -->|"routes to"| node_traderconnections
node_appstate -->|"loads fields"| node_dataservice
node_fire -->|"uses data"| node_climateservice
node_rainfall -->|"uses data"| node_climateservice
node_soil -->|"uses data"| node_climateservice
node_vegetation -->|"uses data"| node_climateservice
node_waterclimate -->|"uses data"| node_climateservice
node_climateservice -->|"loads API config"| node_config
node_dataservice -->|"uses endpoints"| node_config
node_assistant -->|"uses context"| node_appstate
node_assistant -->|"uses data"| node_dataservice
node_traderoutes -->|"reads and writes"| node_db
node_server -->|"registers routes"| node_authroutes
node_server -->|"registers routes"| node_traderoutes
node_user -.->|"navigates"| node_navbar
node_dataservice -.->|"requests field APIs"| node_server
node_disease -.->|"submits detections"| node_server
node_fire -.->|"may use datasets"| node_gee
node_disease -.->|"may request inference"| node_ml
node_traderconnections -.->|"may use records"| node_connectiondata

click node_app "https://github.com/jeet8499/farmmate/blob/main/client/src/App.jsx"
click node_auth "https://github.com/jeet8499/farmmate/blob/main/client/src/pages/Auth.jsx"
click node_navbar "https://github.com/jeet8499/farmmate/blob/main/client/src/components/layout/Navbar.jsx"
click node_dashboard "https://github.com/jeet8499/farmmate/blob/main/client/src/pages/Dashboard.jsx"
click node_assistant "https://github.com/jeet8499/farmmate/blob/main/client/src/pages/AIAssistant.jsx"
click node_appstate "https://github.com/jeet8499/farmmate/blob/main/client/src/context/AppContext.jsx"
click node_config "https://github.com/jeet8499/farmmate/blob/main/client/src/config.js"
click node_dataservice "https://github.com/jeet8499/farmmate/blob/main/client/src/services/dataService.js"
click node_climatepage "https://github.com/jeet8499/farmmate/blob/main/client/src/pages/ClimateAnalysis.jsx"
click node_fire "https://github.com/jeet8499/farmmate/blob/main/client/src/components/climate/FireAnalysis.jsx"
click node_rainfall "https://github.com/jeet8499/farmmate/blob/main/client/src/components/climate/RainfallAnalysis.jsx"
click node_soil "https://github.com/jeet8499/farmmate/blob/main/client/src/components/climate/SoilLandAnalysis.jsx"
click node_vegetation "https://github.com/jeet8499/farmmate/blob/main/client/src/components/climate/VegetationAnalysis.jsx"
click node_waterclimate "https://github.com/jeet8499/farmmate/blob/main/client/src/components/climate/WaterIrrigationAnalysis.jsx"
click node_climateservice "https://github.com/jeet8499/farmmate/blob/main/client/src/services/climateService.js"
click node_crop "https://github.com/jeet8499/farmmate/blob/main/client/src/pages/CropManagement.jsx"
click node_disease "https://github.com/jeet8499/farmmate/blob/main/client/src/pages/PlantDiseaseDetection.jsx"
click node_waterops "https://github.com/jeet8499/farmmate/blob/main/client/src/pages/WaterManagement.jsx"
click node_financial "https://github.com/jeet8499/farmmate/blob/main/client/src/pages/FinancialAid.jsx"
click node_traderconnections "https://github.com/jeet8499/farmmate/blob/main/client/src/components/Trader/Connections.jsx"
click node_connectiondata "https://github.com/jeet8499/farmmate/blob/main/client/src/components/Trader/connectiondata.js"
click node_traderoutes "https://github.com/jeet8499/farmmate/blob/main/server/TraderRoutes/Trader.js"
click node_authroutes "https://github.com/jeet8499/farmmate/blob/main/server/AuthRoutes.js"
click node_server "https://github.com/jeet8499/farmmate/blob/main/server/server.cjs"
click node_gee "https://github.com/jeet8499/farmmate/tree/main/Google_Earth_Engine"
click node_ml "https://github.com/jeet8499/farmmate/blob/main/ml-service/app.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_auth,node_navbar,node_dashboard,node_assistant,node_appstate,node_config,node_dataservice toneBlue
class node_climatepage,node_fire,node_rainfall,node_soil,node_vegetation,node_waterclimate,node_climateservice toneAmber
class node_crop,node_disease,node_waterops,node_financial toneMint
class node_traderconnections,node_connectiondata toneRose
class node_traderoutes,node_authroutes,node_server,node_db,node_gee,node_ml,node_user toneIndigo
```

## Components

### Web application

- [Application router](https://github.com/jeet8499/farmmate/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Authentication](https://github.com/jeet8499/farmmate/blob/main/client/src/pages/Auth.jsx): `client/src/pages/Auth.jsx`
- [Farmer navigation](https://github.com/jeet8499/farmmate/blob/main/client/src/components/layout/Navbar.jsx): `client/src/components/layout/Navbar.jsx`
- [Dashboard](https://github.com/jeet8499/farmmate/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [AI assistant](https://github.com/jeet8499/farmmate/blob/main/client/src/pages/AIAssistant.jsx): `client/src/pages/AIAssistant.jsx`
- [Shared field state](https://github.com/jeet8499/farmmate/blob/main/client/src/context/AppContext.jsx): `client/src/context/AppContext.jsx`
- [API configuration](https://github.com/jeet8499/farmmate/blob/main/client/src/config.js): `client/src/config.js`
- [Field data service](https://github.com/jeet8499/farmmate/blob/main/client/src/services/dataService.js): `client/src/services/dataService.js`

### Climate analysis

- [Climate overview](https://github.com/jeet8499/farmmate/blob/main/client/src/pages/ClimateAnalysis.jsx): `client/src/pages/ClimateAnalysis.jsx`
- [Fire analysis](https://github.com/jeet8499/farmmate/blob/main/client/src/components/climate/FireAnalysis.jsx): `client/src/components/climate/FireAnalysis.jsx`
- [Rainfall analysis](https://github.com/jeet8499/farmmate/blob/main/client/src/components/climate/RainfallAnalysis.jsx): `client/src/components/climate/RainfallAnalysis.jsx`
- [Soil analysis](https://github.com/jeet8499/farmmate/blob/main/client/src/components/climate/SoilLandAnalysis.jsx): `client/src/components/climate/SoilLandAnalysis.jsx`
- [Vegetation analysis](https://github.com/jeet8499/farmmate/blob/main/client/src/components/climate/VegetationAnalysis.jsx): `client/src/components/climate/VegetationAnalysis.jsx`
- [Water analysis](https://github.com/jeet8499/farmmate/blob/main/client/src/components/climate/WaterIrrigationAnalysis.jsx): `client/src/components/climate/WaterIrrigationAnalysis.jsx`
- [Climate data service](https://github.com/jeet8499/farmmate/blob/main/client/src/services/climateService.js): `client/src/services/climateService.js`

### Farm operations

- [Crop management](https://github.com/jeet8499/farmmate/blob/main/client/src/pages/CropManagement.jsx): `client/src/pages/CropManagement.jsx`
- [Disease detection](https://github.com/jeet8499/farmmate/blob/main/client/src/pages/PlantDiseaseDetection.jsx): `client/src/pages/PlantDiseaseDetection.jsx`
- [Water management](https://github.com/jeet8499/farmmate/blob/main/client/src/pages/WaterManagement.jsx): `client/src/pages/WaterManagement.jsx`
- [Financial aid](https://github.com/jeet8499/farmmate/blob/main/client/src/pages/FinancialAid.jsx): `client/src/pages/FinancialAid.jsx`

### Trader tools

- [Trader connections](https://github.com/jeet8499/farmmate/blob/main/client/src/components/Trader/Connections.jsx): `client/src/components/Trader/Connections.jsx`
- [Connection records](https://github.com/jeet8499/farmmate/blob/main/client/src/components/Trader/connectiondata.js): `client/src/components/Trader/connectiondata.js`

### Backend services

- [Trader API](https://github.com/jeet8499/farmmate/blob/main/server/TraderRoutes/Trader.js): `server/TraderRoutes/Trader.js`
- [Authentication API](https://github.com/jeet8499/farmmate/blob/main/server/AuthRoutes.js): `server/AuthRoutes.js`
- [Application server](https://github.com/jeet8499/farmmate/blob/main/server/server.cjs): `server/server.cjs`
- **Postgres database**
- [Earth Engine datasets](https://github.com/jeet8499/farmmate/tree/main/Google_Earth_Engine): `Google_Earth_Engine`
- [ML service](https://github.com/jeet8499/farmmate/blob/main/ml-service/app.py): `ml-service/app.py`

### Other components

- **Farmer or trader**

## Connections

- Farmer or trader → Application router: opens (evidence: `client/src/App.jsx`)
- Application router → Authentication: routes to (evidence: `client/src/App.jsx`)
- Application router → Dashboard: routes to (evidence: `client/src/App.jsx`)
- Application router → Climate overview: routes to (evidence: `client/src/App.jsx`)
- Application router → Crop management: routes to (evidence: `client/src/App.jsx`)
- Application router → Disease detection: routes to (evidence: `client/src/App.jsx`)
- Application router → Water management: routes to (evidence: `client/src/App.jsx`)
- Application router → Financial aid: routes to (evidence: `client/src/App.jsx`)
- Application router → Fire analysis: routes to (evidence: `client/src/App.jsx`)
- Application router → Rainfall analysis: routes to (evidence: `client/src/App.jsx`)
- Application router → Soil analysis: routes to (evidence: `client/src/App.jsx`)
- Application router → Vegetation analysis: routes to (evidence: `client/src/App.jsx`)
- Application router → Water analysis: routes to (evidence: `client/src/App.jsx`)
- Application router → AI assistant: routes to (evidence: `client/src/App.jsx`)
- Application router → Trader connections: routes to (evidence: `client/src/App.jsx`)
- Shared field state → Field data service: loads fields (evidence: `client/src/context/AppContext.jsx`)
- Fire analysis → Climate data service: uses data (evidence: `client/src/components/climate/FireAnalysis.jsx`)
- Rainfall analysis → Climate data service: uses data (evidence: `client/src/components/climate/RainfallAnalysis.jsx`)
- Soil analysis → Climate data service: uses data (evidence: `client/src/components/climate/SoilLandAnalysis.jsx`)
- Vegetation analysis → Climate data service: uses data (evidence: `client/src/components/climate/VegetationAnalysis.jsx`)
- Water analysis → Climate data service: uses data (evidence: `client/src/components/climate/WaterIrrigationAnalysis.jsx`)
- Climate data service → API configuration: loads API config (evidence: `client/src/services/climateService.js`)
- Field data service → API configuration: uses endpoints (evidence: `client/src/services/dataService.js`)
- AI assistant → Shared field state: uses context (evidence: `client/src/pages/AIAssistant.jsx`)
- AI assistant → Field data service: uses data (evidence: `client/src/pages/AIAssistant.jsx`)
- Trader API → Postgres database: reads and writes (evidence: `server/TraderRoutes/Trader.js`)
- Application server → Authentication API: registers routes (evidence: `server/server.cjs`)
- Application server → Trader API: registers routes (evidence: `server/server.cjs`)
- Farmer or trader → Farmer navigation: navigates
- Field data service → Application server: requests field APIs
- Disease detection → Application server: submits detections
- Fire analysis → Earth Engine datasets: may use datasets
- Disease detection → ML service: may request inference
- Trader connections → Connection records: may use records
