# kingofstates/agrishare architecture

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

- Interactive diagram: https://gitdiagram.com/kingofstates/agrishare
- Repository: https://github.com/kingofstates/agrishare

## Overview

AgriShare is a farmer-facing marketplace for finding nearby agricultural equipment to rent and publishing listings. The main browsing flow starts in the React app: farmers can set location, search or filter machinery, sort results, inspect listing details, estimate rental cost, and contact owners. Lenders use a listing form whose data is retained in browser storage. The README also describes GPS proximity, voice input, multilingual UI, and direct phone and WhatsApp actions. Several implementation details are unsampled, so the graph omits uncertain wiring.

Main entry points: [`src/App.jsx`](https://github.com/kingofstates/agrishare/blob/main/src/App.jsx) (App state and results), [`src/utils/translations.js`](https://github.com/kingofstates/agrishare/blob/main/src/utils/translations.js) (Translations), [`src/components/SearchBarAndFilters.jsx`](https://github.com/kingofstates/agrishare/blob/main/src/components/SearchBarAndFilters.jsx) (Search and filters), [`src/components/EquipmentDetailModal.jsx`](https://github.com/kingofstates/agrishare/blob/main/src/components/EquipmentDetailModal.jsx) (Details and estimator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application flow"]
  node_react_entry["React entry<br/>[main.jsx]"]
  node_app_state["App state and results<br/>[App.jsx]"]
end

subgraph group_marketplace["Marketplace experience"]
  node_navbar["Location and language<br/>[Navbar.jsx]"]
  node_search["Search and filters"]
  node_equipment_card["Equipment cards<br/>[EquipmentCard.jsx]"]
  node_equipment_detail["Details and estimator"]
  node_footer["Marketplace footer<br/>[Footer.jsx]"]
end

subgraph group_listing["Listing and data"]
  node_listing_form["Listing form"]
  node_equipment_catalog["Default equipment catalog<br/>[equipmentData.js]"]
  node_local_storage[("Browser listing storage<br/>[storage.js]")]
end

subgraph group_services["Shared services"]
  node_voice_button["Voice input control"]
  node_speech_service["Speech recognition<br/>[speech.js]"]
  node_distance_service["Distance and city lookup<br/>[distance.js]"]
  node_translations["Translations<br/>[translations.js]"]
end

node_farmer(("Farmer"))
node_gps["Browser geolocation"]
node_phone_dialer["Phone dialer"]
node_whatsapp["WhatsApp"]

node_farmer -->|"opens app"| node_react_entry
node_react_entry -->|"renders"| node_app_state
node_app_state -->|"renders"| node_navbar
node_app_state -->|"renders"| node_search
node_app_state -->|"renders results"| node_equipment_card
node_app_state -->|"renders selection"| node_equipment_detail
node_app_state -->|"opens listing flow"| node_listing_form
node_app_state -->|"renders"| node_footer
node_app_state -->|"loads and saves listings"| node_local_storage
node_app_state -->|"uses defaults"| node_equipment_catalog
node_app_state -->|"calculates proximity"| node_distance_service
node_farmer -->|"shares location"| node_gps
node_gps -->|"provides coordinates"| node_app_state
node_search -->|"accepts dictation"| node_voice_button
node_search -->|"uses categories"| node_equipment_catalog
node_search -->|"loads labels"| node_translations
node_listing_form -->|"accepts dictation"| node_voice_button
node_listing_form -->|"looks up city"| node_distance_service
node_voice_button -->|"starts recognition"| node_speech_service
node_equipment_card -->|"loads labels"| node_translations
node_equipment_detail -->|"loads labels"| node_translations
node_equipment_detail -->|"starts call"| node_phone_dialer
node_equipment_detail -->|"opens chat"| node_whatsapp
node_navbar -->|"loads labels"| node_translations
node_footer -->|"loads labels"| node_translations

click node_react_entry "https://github.com/kingofstates/agrishare/blob/main/src/main.jsx"
click node_app_state "https://github.com/kingofstates/agrishare/blob/main/src/App.jsx"
click node_navbar "https://github.com/kingofstates/agrishare/blob/main/src/components/Navbar.jsx"
click node_search "https://github.com/kingofstates/agrishare/blob/main/src/components/SearchBarAndFilters.jsx"
click node_equipment_card "https://github.com/kingofstates/agrishare/blob/main/src/components/EquipmentCard.jsx"
click node_equipment_detail "https://github.com/kingofstates/agrishare/blob/main/src/components/EquipmentDetailModal.jsx"
click node_footer "https://github.com/kingofstates/agrishare/blob/main/src/components/Footer.jsx"
click node_listing_form "https://github.com/kingofstates/agrishare/blob/main/src/components/AddEquipmentModal.jsx"
click node_equipment_catalog "https://github.com/kingofstates/agrishare/blob/main/src/data/equipmentData.js"
click node_local_storage "https://github.com/kingofstates/agrishare/blob/main/src/utils/storage.js"
click node_voice_button "https://github.com/kingofstates/agrishare/blob/main/src/components/VoiceInputButton.jsx"
click node_speech_service "https://github.com/kingofstates/agrishare/blob/main/src/utils/speech.js"
click node_distance_service "https://github.com/kingofstates/agrishare/blob/main/src/utils/distance.js"
click node_translations "https://github.com/kingofstates/agrishare/blob/main/src/utils/translations.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_react_entry,node_app_state,node_gps toneBlue
class node_navbar,node_search,node_equipment_card,node_equipment_detail,node_footer toneAmber
class node_listing_form,node_equipment_catalog,node_local_storage toneMint
class node_voice_button,node_speech_service,node_distance_service,node_translations toneRose
class node_farmer,node_phone_dialer,node_whatsapp toneIndigo
```

## Components

### Application flow

- [React entry](https://github.com/kingofstates/agrishare/blob/main/src/main.jsx): `src/main.jsx`
- [App state and results](https://github.com/kingofstates/agrishare/blob/main/src/App.jsx): `src/App.jsx`

### Marketplace experience

- [Location and language](https://github.com/kingofstates/agrishare/blob/main/src/components/Navbar.jsx): `src/components/Navbar.jsx`
- [Search and filters](https://github.com/kingofstates/agrishare/blob/main/src/components/SearchBarAndFilters.jsx): `src/components/SearchBarAndFilters.jsx`
- [Equipment cards](https://github.com/kingofstates/agrishare/blob/main/src/components/EquipmentCard.jsx): `src/components/EquipmentCard.jsx`
- [Details and estimator](https://github.com/kingofstates/agrishare/blob/main/src/components/EquipmentDetailModal.jsx): `src/components/EquipmentDetailModal.jsx`
- [Marketplace footer](https://github.com/kingofstates/agrishare/blob/main/src/components/Footer.jsx): `src/components/Footer.jsx`

### Listing and data

- [Listing form](https://github.com/kingofstates/agrishare/blob/main/src/components/AddEquipmentModal.jsx): `src/components/AddEquipmentModal.jsx`
- [Default equipment catalog](https://github.com/kingofstates/agrishare/blob/main/src/data/equipmentData.js): `src/data/equipmentData.js`
- [Browser listing storage](https://github.com/kingofstates/agrishare/blob/main/src/utils/storage.js): `src/utils/storage.js`

### Shared services

- [Voice input control](https://github.com/kingofstates/agrishare/blob/main/src/components/VoiceInputButton.jsx): `src/components/VoiceInputButton.jsx`
- [Speech recognition](https://github.com/kingofstates/agrishare/blob/main/src/utils/speech.js): `src/utils/speech.js`
- [Distance and city lookup](https://github.com/kingofstates/agrishare/blob/main/src/utils/distance.js): `src/utils/distance.js`
- [Translations](https://github.com/kingofstates/agrishare/blob/main/src/utils/translations.js): `src/utils/translations.js`

### Other components

- **Farmer**
- **Browser geolocation**
- **Phone dialer**
- **WhatsApp**

## Connections

- Farmer → React entry: opens app (evidence: `README.md`)
- React entry → App state and results: renders (evidence: `src/main.jsx`)
- App state and results → Location and language: renders (evidence: `src/App.jsx`)
- App state and results → Search and filters: renders (evidence: `src/App.jsx`)
- App state and results → Equipment cards: renders results (evidence: `src/App.jsx`)
- App state and results → Details and estimator: renders selection (evidence: `src/App.jsx`)
- App state and results → Listing form: opens listing flow (evidence: `README.md`)
- App state and results → Marketplace footer: renders (evidence: `src/App.jsx`)
- App state and results → Browser listing storage: loads and saves listings (evidence: `src/App.jsx`)
- App state and results → Default equipment catalog: uses defaults (evidence: `src/App.jsx`)
- App state and results → Distance and city lookup: calculates proximity (evidence: `src/App.jsx`)
- Farmer → Browser geolocation: shares location (evidence: `README.md`)
- Browser geolocation → App state and results: provides coordinates (evidence: `README.md`)
- Search and filters → Voice input control: accepts dictation (evidence: `src/components/SearchBarAndFilters.jsx`)
- Search and filters → Default equipment catalog: uses categories (evidence: `src/components/SearchBarAndFilters.jsx`)
- Search and filters → Translations: loads labels (evidence: `src/components/SearchBarAndFilters.jsx`)
- Listing form → Voice input control: accepts dictation (evidence: `src/components/AddEquipmentModal.jsx`)
- Listing form → Distance and city lookup: looks up city (evidence: `src/components/AddEquipmentModal.jsx`)
- Voice input control → Speech recognition: starts recognition (evidence: `src/components/VoiceInputButton.jsx`)
- Equipment cards → Translations: loads labels (evidence: `src/components/EquipmentCard.jsx`)
- Details and estimator → Translations: loads labels (evidence: `src/components/EquipmentDetailModal.jsx`)
- Details and estimator → Phone dialer: starts call (evidence: `README.md`)
- Details and estimator → WhatsApp: opens chat (evidence: `README.md`)
- Location and language → Translations: loads labels (evidence: `src/components/Navbar.jsx`)
- Marketplace footer → Translations: loads labels (evidence: `src/components/Footer.jsx`)
