# ayushidarode/cropkart architecture

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

- Interactive diagram: https://gitdiagram.com/ayushidarode/cropkart
- Repository: https://github.com/ayushidarode/cropkart

## Overview

CropKart is a farmer-to-buyer produce marketplace. Farmers publish crop listings; buyers discover and inspect crops, compare reference prices, negotiate, and request samples or bulk orders; farmers manage requests, and buyers can arrange transport and review completed orders. The React app uses a shared API client to reach an Express backend, whose sampled implementation keeps application data in memory. Major documented capabilities such as nearby discovery, dashboards, messaging, notifications, and assistant support are represented; backend details are concentrated in one source file, so internal handler wiring is not inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/App.jsx) (App routing), [`frontend/src/api.js`](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/api.js) (API client), [`backend/index.js`](https://github.com/ayushidarode/cropkart/blob/main/backend/index.js) (Express API), [`frontend/src/pages/CropDetailPage.jsx`](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/CropDetailPage.jsx) (Crop details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_app["App routing<br/>[App.jsx]"]
  node_auth["Auth context<br/>[AuthContext.jsx]"]
  node_client["API client<br/>[api.js]"]
  node_farmerdash["Farmer dashboard"]
  node_buyerdash["Buyer dashboard<br/>[BuyerDashboard.jsx]"]
  node_admindash["Admin dashboard<br/>[AdminDashboard.jsx]"]
end

subgraph group_discovery["Crop discovery"]
  node_market["Marketplace"]
  node_nearby["Nearby crops<br/>[NearbyPage.jsx]"]
  node_detail["Crop details<br/>[CropDetailPage.jsx]"]
  node_profile["Farmer profile"]
end

subgraph group_commerce["Orders and engagement"]
  node_requests["Purchase requests<br/>[CropDetailPage.jsx]"]
  node_chat["Negotiation chat"]
  node_favorites["Favorites<br/>[FavoritesPage.jsx]"]
end

subgraph group_services["Backend services"]
  node_server["Express API<br/>[index.js]"]
  node_state[("In-memory state<br/>[index.js]")]
  node_uploads[("Image uploads")]
  node_marketdata["Market insights<br/>[index.js]"]
  node_messaging["Messaging service<br/>[index.js]"]
  node_notifications["Notifications<br/>[index.js]"]
  node_reviews["Reviews<br/>[index.js]"]
  node_assistant["Crop assistant<br/>[index.js]"]
end

node_farmer(("Farmer"))
node_buyer(("Buyer"))
node_admin(("Admin"))

node_farmer -->|"uses"| node_app
node_buyer -->|"uses"| node_app
node_admin -->|"uses"| node_app
node_app -->|"provides session"| node_auth
node_app -->|"routes to"| node_market
node_app -->|"routes to"| node_nearby
node_app -->|"routes to"| node_detail
node_app -->|"routes to"| node_farmerdash
node_app -->|"routes to"| node_buyerdash
node_app -->|"routes to"| node_admindash
node_app -->|"routes to"| node_favorites
node_market -->|"requests crops"| node_client
node_nearby -->|"requests nearby crops"| node_client
node_detail -->|"loads crop data"| node_client
node_detail -->|"initiates orders"| node_requests
node_requests -->|"submits requests"| node_client
node_chat -->|"sends and loads messages"| node_client
node_farmerdash -->|"manages listings and requests"| node_client
node_buyerdash -->|"manages orders"| node_client
node_favorites -->|"uses favorites API"| node_client
node_client -->|"calls API"| node_server
node_auth -->|"authenticates through"| node_client
node_server -->|"reads and updates"| node_state
node_server -->|"stores images"| node_uploads
node_server -->|"serves price insights"| node_marketdata
node_server -->|"handles message routes"| node_messaging
node_server -->|"serves notifications"| node_notifications
node_server -->|"handles reviews"| node_reviews
node_server -->|"handles assistant queries"| node_assistant
node_detail -->|"loads comparison"| node_marketdata
node_farmerdash -->|"queries assistant"| node_assistant
node_buyerdash -->|"queries assistant"| node_assistant

click node_app "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/App.jsx"
click node_auth "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/AuthContext.jsx"
click node_client "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/api.js"
click node_farmerdash "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/FarmerDashboard.jsx"
click node_buyerdash "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/BuyerDashboard.jsx"
click node_admindash "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/AdminDashboard.jsx"
click node_market "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/MarketplacePage.jsx"
click node_nearby "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/NearbyPage.jsx"
click node_detail "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/CropDetailPage.jsx"
click node_profile "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/FarmerProfilePage.jsx"
click node_requests "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/CropDetailPage.jsx"
click node_chat "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/components/NegotiationChat.jsx"
click node_favorites "https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/FavoritesPage.jsx"
click node_server "https://github.com/ayushidarode/cropkart/blob/main/backend/index.js"
click node_state "https://github.com/ayushidarode/cropkart/blob/main/backend/index.js"
click node_uploads "https://github.com/ayushidarode/cropkart/tree/main/backend/public/uploads"
click node_marketdata "https://github.com/ayushidarode/cropkart/blob/main/backend/index.js"
click node_messaging "https://github.com/ayushidarode/cropkart/blob/main/backend/index.js"
click node_notifications "https://github.com/ayushidarode/cropkart/blob/main/backend/index.js"
click node_reviews "https://github.com/ayushidarode/cropkart/blob/main/backend/index.js"
click node_assistant "https://github.com/ayushidarode/cropkart/blob/main/backend/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_auth,node_client,node_farmerdash,node_buyerdash,node_admindash toneBlue
class node_market,node_nearby,node_detail,node_profile toneAmber
class node_requests,node_chat,node_favorites toneMint
class node_server,node_state,node_uploads,node_marketdata,node_messaging,node_notifications,node_reviews,node_assistant toneRose
class node_farmer,node_buyer,node_admin toneIndigo
```

## Components

### Web experience

- [App routing](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth context](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/AuthContext.jsx): `frontend/src/AuthContext.jsx`
- [API client](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Farmer dashboard](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/FarmerDashboard.jsx): `frontend/src/pages/FarmerDashboard.jsx`
- [Buyer dashboard](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/BuyerDashboard.jsx): `frontend/src/pages/BuyerDashboard.jsx`
- [Admin dashboard](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/AdminDashboard.jsx): `frontend/src/pages/AdminDashboard.jsx`

### Crop discovery

- [Marketplace](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/MarketplacePage.jsx): `frontend/src/pages/MarketplacePage.jsx`
- [Nearby crops](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/NearbyPage.jsx): `frontend/src/pages/NearbyPage.jsx`
- [Crop details](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/CropDetailPage.jsx): `frontend/src/pages/CropDetailPage.jsx`
- [Farmer profile](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/FarmerProfilePage.jsx): `frontend/src/pages/FarmerProfilePage.jsx`

### Orders and engagement

- [Purchase requests](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/CropDetailPage.jsx): `frontend/src/pages/CropDetailPage.jsx`
- [Negotiation chat](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/components/NegotiationChat.jsx): `frontend/src/components/NegotiationChat.jsx`
- [Favorites](https://github.com/ayushidarode/cropkart/blob/main/frontend/src/pages/FavoritesPage.jsx): `frontend/src/pages/FavoritesPage.jsx`

### Backend services

- [Express API](https://github.com/ayushidarode/cropkart/blob/main/backend/index.js): `backend/index.js`
- [In-memory state](https://github.com/ayushidarode/cropkart/blob/main/backend/index.js): `backend/index.js`
- [Image uploads](https://github.com/ayushidarode/cropkart/tree/main/backend/public/uploads): `backend/public/uploads`
- [Market insights](https://github.com/ayushidarode/cropkart/blob/main/backend/index.js): `backend/index.js`
- [Messaging service](https://github.com/ayushidarode/cropkart/blob/main/backend/index.js): `backend/index.js`
- [Notifications](https://github.com/ayushidarode/cropkart/blob/main/backend/index.js): `backend/index.js`
- [Reviews](https://github.com/ayushidarode/cropkart/blob/main/backend/index.js): `backend/index.js`
- [Crop assistant](https://github.com/ayushidarode/cropkart/blob/main/backend/index.js): `backend/index.js`

### Other components

- **Farmer**
- **Buyer**
- **Admin**

## Connections

- Farmer → App routing: uses
- Buyer → App routing: uses
- Admin → App routing: uses
- App routing → Auth context: provides session
- App routing → Marketplace: routes to
- App routing → Nearby crops: routes to
- App routing → Crop details: routes to
- App routing → Farmer dashboard: routes to
- App routing → Buyer dashboard: routes to
- App routing → Admin dashboard: routes to
- App routing → Favorites: routes to
- Marketplace → API client: requests crops
- Nearby crops → API client: requests nearby crops
- Crop details → API client: loads crop data
- Crop details → Purchase requests: initiates orders
- Purchase requests → API client: submits requests
- Negotiation chat → API client: sends and loads messages
- Farmer dashboard → API client: manages listings and requests
- Buyer dashboard → API client: manages orders
- Favorites → API client: uses favorites API
- API client → Express API: calls API
- Auth context → API client: authenticates through
- Express API → In-memory state: reads and updates
- Express API → Image uploads: stores images
- Express API → Market insights: serves price insights
- Express API → Messaging service: handles message routes
- Express API → Notifications: serves notifications
- Express API → Reviews: handles reviews
- Express API → Crop assistant: handles assistant queries
- Crop details → Market insights: loads comparison
- Farmer dashboard → Crop assistant: queries assistant
- Buyer dashboard → Crop assistant: queries assistant
