# hariomphulre/farmmate architecture

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

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

## Overview

Smart-and-Climate-Resilient-Agriculture is a farmer- and trader-facing agriculture platform. Users enter through role-specific web routes to manage fields and crops, inspect climate and hazard information, control irrigation, seek financial support, or access market features. Climate data has a distinct analysis path; crop disease and recommendation models are exposed by a separate ML service. The graph preserves documented capabilities, but several backend links and the Earth Engine data pipeline are not fully evidenced by the sampled excerpts, so uncertain connections are omitted.

Main entry points: [`client/src/App.jsx`](https://github.com/hariomphulre/farmmate/blob/main/client/src/App.jsx) (Route application), [`server/server.cjs`](https://github.com/hariomphulre/farmmate/blob/main/server/server.cjs) (Agriculture API), [`client/src/pages/ClimateAnalysis.jsx`](https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/ClimateAnalysis.jsx) (Climate analysis), [`client/src/pages/PlantDiseaseDetection.jsx`](https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/PlantDiseaseDetection.jsx) (Plant disease detection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Route application<br/>[App.jsx]"]
  node_authui["Sign-in and registration<br/>[Auth.jsx]"]
  node_dashboard["Farm dashboard<br/>[Dashboard.jsx]"]
  node_traderui["Trader workspace"]
  node_market["Market prices<br/>[MarketPrice.jsx]"]
end

subgraph group_farm["Farm operations"]
  node_fields["Field management<br/>[Fields.jsx]"]
  node_cropui["Crop management<br/>[CropManagement.jsx]"]
  node_waterui["Water management"]
  node_aidui["Financial aid<br/>[FinancialAid.jsx]"]
end

subgraph group_insights["Climate and AI"]
  node_climateui["Climate analysis"]
  node_climatehook["Climate data orchestration<br/>[useClimateData.js]"]
  node_climateapi["Live climate API<br/>[climateapi.js]"]
  node_climateservice["Climate and hazard data<br/>[climateService.js]"]
  node_climatefeatures["Climate indicators"]
  node_diseaseui["Plant disease detection"]
  node_ml["Prediction and disease API<br/>[app.py]"]
end

subgraph group_services["Backend services"]
  node_fieldservice["Field persistence<br/>[fieldService.js]"]
  node_cropservice["Crop lifecycle and inventory"]
  node_aidservice["Aid and support requests"]
  node_server["Agriculture API<br/>[server.cjs]"]
  node_authroutes["Authentication API<br/>[AuthRoutes.js]"]
end

subgraph group_external["External systems"]
  node_gee["Earth Engine jobs and datasets<br/>[jobs.py]"]
  node_climate_events["Climate-data event function<br/>[index.js]"]
  node_firebase[("Firebase Realtime Database")]
end

node_farmer(("Farmer"))
node_trader(("Trader"))

node_farmer -->|"uses"| node_app
node_trader -->|"uses"| node_app
node_app -->|"routes"| node_authui
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_fields
node_app -->|"routes"| node_cropui
node_app -->|"routes"| node_waterui
node_app -->|"routes"| node_climateui
node_app -->|"routes"| node_diseaseui
node_app -->|"routes"| node_aidui
node_app -->|"routes"| node_traderui
node_app -->|"routes"| node_market
node_authui -->|"authenticates"| node_authroutes
node_fields -->|"requests field operations"| node_server
node_server -->|"delegates field data"| node_fieldservice
node_fieldservice -.->|"reverse geocodes"| node_gee
node_cropui -->|"requests crop data"| node_cropservice
node_cropservice -->|"sends API requests"| node_server
node_waterui -->|"requests water data"| node_server
node_climateui -->|"loads climate data"| node_climatehook
node_climatehook -->|"fetches and summarizes"| node_climateapi
node_climateui -->|"requests climate features"| node_climateservice
node_climatefeatures -->|"loads analyses"| node_climateservice
node_diseaseui -->|"uploads images"| node_server
node_diseaseui -.->|"requests detection"| node_ml
node_aidui -->|"requests aid services"| node_aidservice
node_aidservice -->|"sends API requests"| node_server
node_traderui -->|"opens market prices"| node_market
node_climate_events -->|"reads and writes"| node_firebase

click node_app "https://github.com/hariomphulre/farmmate/blob/main/client/src/App.jsx"
click node_authui "https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/Auth.jsx"
click node_dashboard "https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/Dashboard.jsx"
click node_fields "https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/Fields.jsx"
click node_fieldservice "https://github.com/hariomphulre/farmmate/blob/main/server/fieldService.js"
click node_cropui "https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/CropManagement.jsx"
click node_cropservice "https://github.com/hariomphulre/farmmate/blob/main/client/src/services/cropManagementService.js"
click node_waterui "https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/WaterManagement.jsx"
click node_climateui "https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/ClimateAnalysis.jsx"
click node_climatehook "https://github.com/hariomphulre/farmmate/blob/main/client/src/hooks/useClimateData.js"
click node_climateapi "https://github.com/hariomphulre/farmmate/blob/main/client/src/services/climateapi.js"
click node_climateservice "https://github.com/hariomphulre/farmmate/blob/main/client/src/services/climateService.js"
click node_climatefeatures "https://github.com/hariomphulre/farmmate/tree/main/client/src/components/climate"
click node_gee "https://github.com/hariomphulre/farmmate/blob/main/Google_Earth_Engine/jobs.py"
click node_diseaseui "https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/PlantDiseaseDetection.jsx"
click node_ml "https://github.com/hariomphulre/farmmate/blob/main/ml-service/app.py"
click node_aidui "https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/FinancialAid.jsx"
click node_aidservice "https://github.com/hariomphulre/farmmate/blob/main/client/src/services/financialAidService.js"
click node_server "https://github.com/hariomphulre/farmmate/blob/main/server/server.cjs"
click node_authroutes "https://github.com/hariomphulre/farmmate/blob/main/server/AuthRoutes.js"
click node_traderui "https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/Trader/TraderDashboard.jsx"
click node_market "https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/Trader/MarketPrice.jsx"
click node_climate_events "https://github.com/hariomphulre/farmmate/blob/main/functions/index.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_authui,node_dashboard,node_traderui,node_market toneBlue
class node_fields,node_cropui,node_waterui,node_aidui toneAmber
class node_climateui,node_climatehook,node_climateapi,node_climateservice,node_climatefeatures,node_diseaseui,node_ml toneMint
class node_fieldservice,node_cropservice,node_aidservice,node_server,node_authroutes toneRose
class node_gee,node_climate_events,node_firebase,node_farmer,node_trader toneIndigo
```

## Components

### Web application

- [Route application](https://github.com/hariomphulre/farmmate/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Sign-in and registration](https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/Auth.jsx): `client/src/pages/Auth.jsx`
- [Farm dashboard](https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [Trader workspace](https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/Trader/TraderDashboard.jsx): `client/src/pages/Trader/TraderDashboard.jsx`
- [Market prices](https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/Trader/MarketPrice.jsx): `client/src/pages/Trader/MarketPrice.jsx`

### Farm operations

- [Field management](https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/Fields.jsx): `client/src/pages/Fields.jsx`
- [Crop management](https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/CropManagement.jsx): `client/src/pages/CropManagement.jsx`
- [Water management](https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/WaterManagement.jsx): `client/src/pages/WaterManagement.jsx`
- [Financial aid](https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/FinancialAid.jsx): `client/src/pages/FinancialAid.jsx`

### Climate and AI

- [Climate analysis](https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/ClimateAnalysis.jsx): `client/src/pages/ClimateAnalysis.jsx`
- [Climate data orchestration](https://github.com/hariomphulre/farmmate/blob/main/client/src/hooks/useClimateData.js): `client/src/hooks/useClimateData.js`
- [Live climate API](https://github.com/hariomphulre/farmmate/blob/main/client/src/services/climateapi.js): `client/src/services/climateapi.js`
- [Climate and hazard data](https://github.com/hariomphulre/farmmate/blob/main/client/src/services/climateService.js): `client/src/services/climateService.js`
- [Climate indicators](https://github.com/hariomphulre/farmmate/tree/main/client/src/components/climate): `client/src/components/climate`
- [Plant disease detection](https://github.com/hariomphulre/farmmate/blob/main/client/src/pages/PlantDiseaseDetection.jsx): `client/src/pages/PlantDiseaseDetection.jsx`
- [Prediction and disease API](https://github.com/hariomphulre/farmmate/blob/main/ml-service/app.py): `ml-service/app.py`

### Backend services

- [Field persistence](https://github.com/hariomphulre/farmmate/blob/main/server/fieldService.js): `server/fieldService.js`
- [Crop lifecycle and inventory](https://github.com/hariomphulre/farmmate/blob/main/client/src/services/cropManagementService.js): `client/src/services/cropManagementService.js`
- [Aid and support requests](https://github.com/hariomphulre/farmmate/blob/main/client/src/services/financialAidService.js): `client/src/services/financialAidService.js`
- [Agriculture API](https://github.com/hariomphulre/farmmate/blob/main/server/server.cjs): `server/server.cjs`
- [Authentication API](https://github.com/hariomphulre/farmmate/blob/main/server/AuthRoutes.js): `server/AuthRoutes.js`

### External systems

- [Earth Engine jobs and datasets](https://github.com/hariomphulre/farmmate/blob/main/Google_Earth_Engine/jobs.py): `Google_Earth_Engine/jobs.py`
- [Climate-data event function](https://github.com/hariomphulre/farmmate/blob/main/functions/index.js): `functions/index.js`
- **Firebase Realtime Database**

### Other components

- **Farmer**
- **Trader**

## Connections

- Farmer → Route application: uses
- Trader → Route application: uses
- Route application → Sign-in and registration: routes
- Route application → Farm dashboard: routes
- Route application → Field management: routes
- Route application → Crop management: routes
- Route application → Water management: routes
- Route application → Climate analysis: routes
- Route application → Plant disease detection: routes
- Route application → Financial aid: routes
- Route application → Trader workspace: routes
- Route application → Market prices: routes
- Sign-in and registration → Authentication API: authenticates
- Field management → Agriculture API: requests field operations
- Agriculture API → Field persistence: delegates field data
- Field persistence → Earth Engine jobs and datasets: reverse geocodes
- Crop management → Crop lifecycle and inventory: requests crop data
- Crop lifecycle and inventory → Agriculture API: sends API requests
- Water management → Agriculture API: requests water data
- Climate analysis → Climate data orchestration: loads climate data
- Climate data orchestration → Live climate API: fetches and summarizes
- Climate analysis → Climate and hazard data: requests climate features
- Climate indicators → Climate and hazard data: loads analyses
- Plant disease detection → Agriculture API: uploads images
- Plant disease detection → Prediction and disease API: requests detection
- Financial aid → Aid and support requests: requests aid services
- Aid and support requests → Agriculture API: sends API requests
- Trader workspace → Market prices: opens market prices
- Climate-data event function → Firebase Realtime Database: reads and writes
