# kishoremuddana/farm2home architecture

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

- Interactive diagram: https://gitdiagram.com/kishoremuddana/farm2home
- Repository: https://github.com/kishoremuddana/farm2home

## Overview

Farm2Home is a grocery marketplace with customer shopping and ordering, seller product submissions, officer inspections, and admin management. A customer browses category products, adds items to a locally stored cart or buys directly, selects an address and payment mode, places an order, then views or cancels it. The Flask application provides the HTTP API and accesses MySQL; browser scripts implement role-specific workflows. The excerpts show selected API calls and SQL, but the README is empty and most backend routes and page wiring were not sampled, so uncertain connections are omitted.

Main entry points: [`backend/app.py`](https://github.com/kishoremuddana/farm2home/blob/master/backend/app.py) (Flask API), [`frontend/js/checkout.js`](https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/checkout.js) (Checkout), [`frontend/js/product.js`](https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/product.js) (Product catalog), [`frontend/js/admin.js`](https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/admin.js) (Admin console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer shopping"]
  node_storefront["Storefront"]
  node_catalog["Product catalog<br/>[product.js]"]
  node_cart["Cart and wishlist<br/>[cart.js]"]
  node_checkout["Checkout<br/>[checkout.js]"]
  node_orders["Order history<br/>[myorders.js]"]
  node_profile["Profile and addresses<br/>[userProfile.js]"]
  node_identity["Login and registration<br/>[login.js]"]
end

subgraph group_operations["Marketplace operations"]
  node_seller["Seller dashboard"]
  node_officer["Inspection dashboard"]
  node_admin["Admin console<br/>[admin.js]"]
end

subgraph group_backend["Backend services"]
  node_api["Flask API<br/>[app.py]"]
end

subgraph group_state["Persistence"]
  node_mysql[("MySQL")]
  node_uploads[("Product uploads")]
end

node_shopper(("Customer"))

node_shopper -->|"browses"| node_storefront
node_storefront -.->|"loads scripts"| node_catalog
node_catalog -->|"fetches products"| node_api
node_catalog -->|"adds items"| node_cart
node_shopper -->|"checks out"| node_checkout
node_cart -->|"opens checkout"| node_checkout
node_checkout -->|"places order"| node_api
node_checkout -->|"opens profile"| node_profile
node_orders -->|"loads orders"| node_api
node_profile -->|"manages profile"| node_api
node_identity -.->|"authenticates"| node_api
node_seller -->|"submits products"| node_api
node_officer -->|"submits reports"| node_api
node_admin -->|"manages marketplace"| node_api
node_api -->|"queries records"| node_mysql
node_api -->|"saves images"| node_uploads
node_admin -->|"reviews inspections"| node_api

click node_storefront "https://github.com/kishoremuddana/farm2home/tree/master/frontend/pages"
click node_catalog "https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/product.js"
click node_cart "https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/cart.js"
click node_checkout "https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/checkout.js"
click node_orders "https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/myorders.js"
click node_profile "https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/userProfile.js"
click node_identity "https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/login.js"
click node_seller "https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/seller-dashboard.js"
click node_officer "https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/officer-dashboard.js"
click node_admin "https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/admin.js"
click node_api "https://github.com/kishoremuddana/farm2home/blob/master/backend/app.py"
click node_uploads "https://github.com/kishoremuddana/farm2home/tree/master/uploads"

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_storefront,node_catalog,node_cart,node_checkout,node_orders,node_profile,node_identity toneBlue
class node_seller,node_officer,node_admin toneAmber
class node_api toneMint
class node_mysql,node_uploads toneRose
class node_shopper toneIndigo
```

## Components

### Customer shopping

- [Storefront](https://github.com/kishoremuddana/farm2home/tree/master/frontend/pages): `frontend/pages`
- [Product catalog](https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/product.js): `frontend/js/product.js`
- [Cart and wishlist](https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/cart.js): `frontend/js/cart.js`
- [Checkout](https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/checkout.js): `frontend/js/checkout.js`
- [Order history](https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/myorders.js): `frontend/js/myorders.js`
- [Profile and addresses](https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/userProfile.js): `frontend/js/userProfile.js`
- [Login and registration](https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/login.js): `frontend/js/login.js`

### Marketplace operations

- [Seller dashboard](https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/seller-dashboard.js): `frontend/js/seller-dashboard.js`
- [Inspection dashboard](https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/officer-dashboard.js): `frontend/js/officer-dashboard.js`
- [Admin console](https://github.com/kishoremuddana/farm2home/blob/master/frontend/js/admin.js): `frontend/js/admin.js`

### Backend services

- [Flask API](https://github.com/kishoremuddana/farm2home/blob/master/backend/app.py): `backend/app.py`

### Persistence

- **MySQL**
- [Product uploads](https://github.com/kishoremuddana/farm2home/tree/master/uploads): `uploads`

### Other components

- **Customer**

## Connections

- Customer → Storefront: browses
- Storefront → Product catalog: loads scripts
- Product catalog → Flask API: fetches products (evidence: `frontend/js/product.js`)
- Product catalog → Cart and wishlist: adds items (evidence: `frontend/js/product.js`)
- Customer → Checkout: checks out
- Cart and wishlist → Checkout: opens checkout (evidence: `frontend/js/cart.js`)
- Checkout → Flask API: places order (evidence: `frontend/js/checkout.js`)
- Checkout → Profile and addresses: opens profile (evidence: `frontend/js/checkout.js`)
- Order history → Flask API: loads orders (evidence: `frontend/js/myorders.js`)
- Profile and addresses → Flask API: manages profile (evidence: `frontend/js/userProfile.js`)
- Login and registration → Flask API: authenticates
- Seller dashboard → Flask API: submits products (evidence: `frontend/js/seller-dashboard.js`)
- Inspection dashboard → Flask API: submits reports (evidence: `frontend/js/officer-dashboard.js`)
- Admin console → Flask API: manages marketplace (evidence: `frontend/js/admin.js`)
- Flask API → MySQL: queries records (evidence: `backend/app.py`)
- Flask API → Product uploads: saves images (evidence: `backend/app.py`)
- Admin console → Flask API: reviews inspections (evidence: `frontend/js/admin.js`)
