# harshm13/agrobridge-sih26132 architecture

> Architecture diagram of the GitHub repository harshm13/agrobridge-sih26132, 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/harshm13/agrobridge-sih26132
- Repository: https://github.com/harshm13/agrobridge-sih26132

## Overview

AgroBridge is a farmer-facing market-linkage and decision-support platform: farmers manage produce, assess markets and quality, compare buyer offers after transport costs, and explore logistics and transactions. The React app selects the user journey; a FastAPI backend exposes prediction, grading, pooling, and chatbot routers. The README describes broader capabilities, but many page and API implementations were not sampled, so their internal wiring is not inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/App.jsx) (App and navigation), [`backend/main.py`](https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/main.py) (FastAPI application), [`backend/api/chatbot.py`](https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/api/chatbot.py) (Chatbot endpoint), [`frontend/src/pages/FarmerOnboarding.jsx`](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/FarmerOnboarding.jsx) (Farmer onboarding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Farmer application"]
  node_app["App and navigation<br/>[App.jsx]"]
  node_onboarding["Farmer onboarding"]
  node_crops["My crops<br/>[MyCrops.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_support["Farmer support<br/>[Support.jsx]"]
end

subgraph group_decision["Selling decisions"]
  node_marketintel["Market intelligence"]
  node_quality["Crop quality<br/>[QualityCheck.jsx]"]
  node_opportunity["Opportunity engine"]
  node_marketplace["Buyer marketplace<br/>[Marketplace.jsx]"]
  node_buyerprofile["Buyer profiles<br/>[BuyerProfile.jsx]"]
  node_contract["Offer contract<br/>[ContractModal.jsx]"]
  node_logistics["Logistics<br/>[Logistics.jsx]"]
  node_transactions["Transactions and escrow<br/>[Transactions.jsx]"]
  node_copilot["AI selling copilot<br/>[ChatBox.jsx]"]
end

subgraph group_backend["API services"]
  node_api["FastAPI application<br/>[main.py]"]
  node_predictions["Price predictions<br/>[predictions.py]"]
  node_grading["Quality grading<br/>[grading.py]"]
  node_pooling["Transport pooling<br/>[pooling.py]"]
  node_chatbot["Chatbot endpoint<br/>[chatbot.py]"]
end

subgraph group_state["Persistence and ML"]
  node_database[("SQLite database<br/>[database.py]")]
  node_models["Data models<br/>[models.py]"]
  node_training["Price model training<br/>[train.py]"]
  node_predictionruntime["Prediction runtime<br/>[predict.py]"]
end

node_farmer(("Farmer"))
node_groq{{"Groq language model"}}

node_farmer -->|"uses"| node_app
node_app -->|"renders"| node_onboarding
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_crops
node_app -->|"renders"| node_marketintel
node_app -->|"renders"| node_quality
node_app -->|"renders"| node_marketplace
node_app -->|"renders"| node_logistics
node_app -->|"renders"| node_transactions
node_app -->|"renders"| node_copilot
node_app -->|"renders"| node_support
node_api -->|"registers router"| node_predictions
node_api -->|"registers router"| node_chatbot
node_api -->|"registers router"| node_grading
node_api -->|"registers router"| node_pooling
node_api -->|"creates tables"| node_database
node_chatbot -.->|"requests replies"| node_groq
node_farmer -->|"sends REST requests"| node_api

click node_app "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/App.jsx"
click node_onboarding "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/FarmerOnboarding.jsx"
click node_crops "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/MyCrops.jsx"
click node_dashboard "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/Dashboard.jsx"
click node_marketintel "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/MarketIntelligence.jsx"
click node_quality "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/QualityCheck.jsx"
click node_opportunity "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/components/OpportunityEngine.jsx"
click node_marketplace "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/Marketplace.jsx"
click node_buyerprofile "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/components/BuyerProfile.jsx"
click node_contract "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/components/ContractModal.jsx"
click node_logistics "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/Logistics.jsx"
click node_transactions "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/Transactions.jsx"
click node_copilot "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/components/ChatBox.jsx"
click node_support "https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/Support.jsx"
click node_api "https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/main.py"
click node_predictions "https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/api/predictions.py"
click node_grading "https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/api/grading.py"
click node_pooling "https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/api/pooling.py"
click node_chatbot "https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/api/chatbot.py"
click node_database "https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/db/database.py"
click node_models "https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/db/models.py"
click node_training "https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/ml/train.py"
click node_predictionruntime "https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/ml/predict.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_onboarding,node_crops,node_dashboard,node_support toneBlue
class node_marketintel,node_quality,node_opportunity,node_marketplace,node_buyerprofile,node_contract,node_logistics,node_transactions,node_copilot toneAmber
class node_api,node_predictions,node_grading,node_pooling,node_chatbot toneMint
class node_database,node_models,node_training,node_predictionruntime toneRose
class node_farmer,node_groq toneIndigo
```

## Components

### Farmer application

- [App and navigation](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Farmer onboarding](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/FarmerOnboarding.jsx): `frontend/src/pages/FarmerOnboarding.jsx`
- [My crops](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/MyCrops.jsx): `frontend/src/pages/MyCrops.jsx`
- [Dashboard](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Farmer support](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/Support.jsx): `frontend/src/pages/Support.jsx`

### Selling decisions

- [Market intelligence](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/MarketIntelligence.jsx): `frontend/src/pages/MarketIntelligence.jsx`
- [Crop quality](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/QualityCheck.jsx): `frontend/src/pages/QualityCheck.jsx`
- [Opportunity engine](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/components/OpportunityEngine.jsx): `frontend/src/components/OpportunityEngine.jsx`
- [Buyer marketplace](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/Marketplace.jsx): `frontend/src/pages/Marketplace.jsx`
- [Buyer profiles](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/components/BuyerProfile.jsx): `frontend/src/components/BuyerProfile.jsx`
- [Offer contract](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/components/ContractModal.jsx): `frontend/src/components/ContractModal.jsx`
- [Logistics](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/Logistics.jsx): `frontend/src/pages/Logistics.jsx`
- [Transactions and escrow](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/pages/Transactions.jsx): `frontend/src/pages/Transactions.jsx`
- [AI selling copilot](https://github.com/harshm13/agrobridge-sih26132/blob/main/frontend/src/components/ChatBox.jsx): `frontend/src/components/ChatBox.jsx`

### API services

- [FastAPI application](https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/main.py): `backend/main.py`
- [Price predictions](https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/api/predictions.py): `backend/api/predictions.py`
- [Quality grading](https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/api/grading.py): `backend/api/grading.py`
- [Transport pooling](https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/api/pooling.py): `backend/api/pooling.py`
- [Chatbot endpoint](https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/api/chatbot.py): `backend/api/chatbot.py`

### Persistence and ML

- [SQLite database](https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/db/database.py): `backend/db/database.py`
- [Data models](https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/db/models.py): `backend/db/models.py`
- [Price model training](https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/ml/train.py): `backend/ml/train.py`
- [Prediction runtime](https://github.com/harshm13/agrobridge-sih26132/blob/main/backend/ml/predict.py): `backend/ml/predict.py`

### Other components

- **Farmer**
- **Groq language model**

## Connections

- Farmer → App and navigation: uses
- App and navigation → Farmer onboarding: renders
- App and navigation → Dashboard: renders
- App and navigation → My crops: renders
- App and navigation → Market intelligence: renders
- App and navigation → Crop quality: renders
- App and navigation → Buyer marketplace: renders
- App and navigation → Logistics: renders
- App and navigation → Transactions and escrow: renders
- App and navigation → AI selling copilot: renders
- App and navigation → Farmer support: renders
- FastAPI application → Price predictions: registers router
- FastAPI application → Chatbot endpoint: registers router
- FastAPI application → Quality grading: registers router
- FastAPI application → Transport pooling: registers router
- FastAPI application → SQLite database: creates tables
- Chatbot endpoint → Groq language model: requests replies
- Farmer → FastAPI application: sends REST requests
