# vv3705029/greencart architecture

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

- Interactive diagram: https://gitdiagram.com/vv3705029/greencart
- Repository: https://github.com/vv3705029/greencart

## Overview

GreenCart is a grocery e-commerce application. Shoppers browse products, manage a cart and delivery address, and place cash-on-delivery orders; sellers sign in to manage products and orders. The React app centralizes client state and API access in AppContext, while Express routes dispatch requests to controllers and MongoDB models. The README also describes wishlist and user-management capabilities, but the sampled source does not establish their implementation or connections. Edges reflect shown imports, calls, route mounts, or documented capabilities; unsampled details are left unconnected.

Main entry points: [`client/src/App.js`](https://github.com/vv3705029/greencart/blob/main/client/src/App.js) (App routes), [`server/server.js`](https://github.com/vv3705029/greencart/blob/main/server/server.js) (Express server), [`client/src/context/AppContext.js`](https://github.com/vv3705029/greencart/blob/main/client/src/context/AppContext.js) (App context), [`server/routes/userRoute.js`](https://github.com/vv3705029/greencart/blob/main/server/routes/userRoute.js) (User API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shopper_ui["Shopper experience"]
  node_navbar["Navigation<br/>[Navbar.js]"]
  node_login["User login<br/>[Login.js]"]
  node_home["Home page<br/>[Home.js]"]
  node_catalog["Product catalog<br/>[AllProducts.js]"]
  node_category["Category view<br/>[ProductCategory.js]"]
  node_product_detail["Product details<br/>[ProductDetails.js]"]
  node_product_card["Product card<br/>[Productcard.js]"]
  node_cart["Cart and checkout<br/>[Cart.js]"]
  node_address["Address entry<br/>[AddAddress.js]"]
  node_order_history["Order history<br/>[MyOrders.js]"]
end

subgraph group_seller_ui["Seller console"]
  node_seller_login["Seller login<br/>[SellerLogin.js]"]
  node_seller_layout["Seller workspace<br/>[SellerLayout.js]"]
  node_product_admin["Product management<br/>[AddProduct.js]"]
  node_product_list["Seller product list<br/>[ProductList.js]"]
  node_seller_orders["Seller orders<br/>[Orders.js]"]
end

subgraph group_client_core["Client state and routing"]
  node_app["App routes<br/>[App.js]"]
  node_context["App context<br/>[AppContext.js]"]
end

subgraph group_server["API and domain"]
  node_api_server["Express server<br/>[server.js]"]
  node_user_api["User API<br/>[userRoute.js]"]
  node_user_controller["User authentication<br/>[UserController.js]"]
  node_user_auth["User auth guard<br/>[authUser.js]"]
  node_seller_api["Seller API<br/>[sellerRoute.js]"]
  node_seller_controller["Seller authentication"]
  node_seller_auth["Seller auth guard<br/>[authSeller.js]"]
  node_product_api["Product API<br/>[productRoute.js]"]
  node_product_controller["Product operations"]
  node_product_model[("Product records<br/>[Product.js]")]
  node_cart_api["Cart API<br/>[cartRoute.js]"]
  node_cart_controller["Cart operations<br/>[cartController.js]"]
  node_address_api["Address API<br/>[addressRoute.js]"]
  node_address_controller["Address operations"]
  node_address_model[("Address records<br/>[Address.js]")]
  node_order_api["Order API<br/>[orderRoute.js]"]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_app
node_app -->|"renders"| node_navbar
node_app -->|"renders"| node_login
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_category
node_app -->|"routes to"| node_product_detail
node_app -->|"routes to"| node_cart
node_app -->|"routes to"| node_address
node_app -->|"routes to"| node_order_history
node_app -->|"routes to"| node_seller_login
node_app -->|"routes to"| node_seller_layout
node_app -->|"routes to"| node_product_admin
node_app -->|"routes to"| node_product_list
node_app -->|"routes to"| node_seller_orders
node_catalog -->|"renders"| node_product_card
node_category -->|"renders"| node_product_card
node_app -->|"reads state"| node_context
node_context -->|"requests auth"| node_user_api
node_context -->|"checks seller"| node_seller_api
node_context -->|"loads products"| node_product_api
node_context -->|"syncs cart"| node_cart_api
node_cart -->|"loads addresses"| node_address_api
node_cart -->|"places order"| node_order_api
node_api_server -->|"mounts"| node_user_api
node_api_server -->|"mounts"| node_seller_api
node_api_server -->|"mounts"| node_product_api
node_api_server -->|"mounts"| node_cart_api
node_api_server -->|"mounts"| node_address_api
node_api_server -->|"mounts"| node_order_api
node_user_api -->|"dispatches"| node_user_controller
node_user_api -->|"guards"| node_user_auth
node_seller_api -->|"dispatches"| node_seller_controller
node_seller_api -->|"guards"| node_seller_auth
node_product_api -->|"dispatches"| node_product_controller
node_product_api -->|"guards"| node_seller_auth
node_product_controller -->|"reads and writes"| node_product_model
node_cart_api -->|"dispatches"| node_cart_controller
node_cart_api -->|"guards"| node_user_auth
node_address_api -->|"dispatches"| node_address_controller
node_address_api -->|"guards"| node_user_auth
node_address_controller -->|"reads and writes"| node_address_model
node_order_api -->|"guards"| node_user_auth

click node_app "https://github.com/vv3705029/greencart/blob/main/client/src/App.js"
click node_context "https://github.com/vv3705029/greencart/blob/main/client/src/context/AppContext.js"
click node_navbar "https://github.com/vv3705029/greencart/blob/main/client/src/components/Navbar.js"
click node_login "https://github.com/vv3705029/greencart/blob/main/client/src/components/Login.js"
click node_home "https://github.com/vv3705029/greencart/blob/main/client/src/pages/Home.js"
click node_catalog "https://github.com/vv3705029/greencart/blob/main/client/src/pages/AllProducts.js"
click node_category "https://github.com/vv3705029/greencart/blob/main/client/src/pages/ProductCategory.js"
click node_product_detail "https://github.com/vv3705029/greencart/blob/main/client/src/pages/ProductDetails.js"
click node_product_card "https://github.com/vv3705029/greencart/blob/main/client/src/components/Productcard.js"
click node_cart "https://github.com/vv3705029/greencart/blob/main/client/src/pages/Cart.js"
click node_address "https://github.com/vv3705029/greencart/blob/main/client/src/pages/AddAddress.js"
click node_order_history "https://github.com/vv3705029/greencart/blob/main/client/src/pages/MyOrders.js"
click node_seller_login "https://github.com/vv3705029/greencart/blob/main/client/src/components/seller/SellerLogin.js"
click node_seller_layout "https://github.com/vv3705029/greencart/blob/main/client/src/pages/seller/SellerLayout.js"
click node_product_admin "https://github.com/vv3705029/greencart/blob/main/client/src/pages/seller/AddProduct.js"
click node_product_list "https://github.com/vv3705029/greencart/blob/main/client/src/pages/seller/ProductList.js"
click node_seller_orders "https://github.com/vv3705029/greencart/blob/main/client/src/pages/seller/Orders.js"
click node_api_server "https://github.com/vv3705029/greencart/blob/main/server/server.js"
click node_user_api "https://github.com/vv3705029/greencart/blob/main/server/routes/userRoute.js"
click node_user_controller "https://github.com/vv3705029/greencart/blob/main/server/controllers/UserController.js"
click node_user_auth "https://github.com/vv3705029/greencart/blob/main/server/middlewares/authUser.js"
click node_seller_api "https://github.com/vv3705029/greencart/blob/main/server/routes/sellerRoute.js"
click node_seller_controller "https://github.com/vv3705029/greencart/blob/main/server/controllers/sellerController.js"
click node_seller_auth "https://github.com/vv3705029/greencart/blob/main/server/middlewares/authSeller.js"
click node_product_api "https://github.com/vv3705029/greencart/blob/main/server/routes/productRoute.js"
click node_product_controller "https://github.com/vv3705029/greencart/blob/main/server/controllers/productController.js"
click node_product_model "https://github.com/vv3705029/greencart/blob/main/server/models/Product.js"
click node_cart_api "https://github.com/vv3705029/greencart/blob/main/server/routes/cartRoute.js"
click node_cart_controller "https://github.com/vv3705029/greencart/blob/main/server/controllers/cartController.js"
click node_address_api "https://github.com/vv3705029/greencart/blob/main/server/routes/addressRoute.js"
click node_address_controller "https://github.com/vv3705029/greencart/blob/main/server/controllers/addressController.js"
click node_address_model "https://github.com/vv3705029/greencart/blob/main/server/models/Address.js"
click node_order_api "https://github.com/vv3705029/greencart/blob/main/server/routes/orderRoute.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_navbar,node_login,node_home,node_catalog,node_category,node_product_detail,node_product_card,node_cart,node_address,node_order_history toneBlue
class node_seller_login,node_seller_layout,node_product_admin,node_product_list,node_seller_orders toneAmber
class node_app,node_context toneMint
class node_api_server,node_user_api,node_user_controller,node_user_auth,node_seller_api,node_seller_controller,node_seller_auth,node_product_api,node_product_controller,node_product_model,node_cart_api,node_cart_controller,node_address_api,node_address_controller,node_address_model,node_order_api toneRose
class node_shopper toneIndigo
```

## Components

### Shopper experience

- [Navigation](https://github.com/vv3705029/greencart/blob/main/client/src/components/Navbar.js): `client/src/components/Navbar.js`
- [User login](https://github.com/vv3705029/greencart/blob/main/client/src/components/Login.js): `client/src/components/Login.js`
- [Home page](https://github.com/vv3705029/greencart/blob/main/client/src/pages/Home.js): `client/src/pages/Home.js`
- [Product catalog](https://github.com/vv3705029/greencart/blob/main/client/src/pages/AllProducts.js): `client/src/pages/AllProducts.js`
- [Category view](https://github.com/vv3705029/greencart/blob/main/client/src/pages/ProductCategory.js): `client/src/pages/ProductCategory.js`
- [Product details](https://github.com/vv3705029/greencart/blob/main/client/src/pages/ProductDetails.js): `client/src/pages/ProductDetails.js`
- [Product card](https://github.com/vv3705029/greencart/blob/main/client/src/components/Productcard.js): `client/src/components/Productcard.js`
- [Cart and checkout](https://github.com/vv3705029/greencart/blob/main/client/src/pages/Cart.js): `client/src/pages/Cart.js`
- [Address entry](https://github.com/vv3705029/greencart/blob/main/client/src/pages/AddAddress.js): `client/src/pages/AddAddress.js`
- [Order history](https://github.com/vv3705029/greencart/blob/main/client/src/pages/MyOrders.js): `client/src/pages/MyOrders.js`

### Seller console

- [Seller login](https://github.com/vv3705029/greencart/blob/main/client/src/components/seller/SellerLogin.js): `client/src/components/seller/SellerLogin.js`
- [Seller workspace](https://github.com/vv3705029/greencart/blob/main/client/src/pages/seller/SellerLayout.js): `client/src/pages/seller/SellerLayout.js`
- [Product management](https://github.com/vv3705029/greencart/blob/main/client/src/pages/seller/AddProduct.js): `client/src/pages/seller/AddProduct.js`
- [Seller product list](https://github.com/vv3705029/greencart/blob/main/client/src/pages/seller/ProductList.js): `client/src/pages/seller/ProductList.js`
- [Seller orders](https://github.com/vv3705029/greencart/blob/main/client/src/pages/seller/Orders.js): `client/src/pages/seller/Orders.js`

### Client state and routing

- [App routes](https://github.com/vv3705029/greencart/blob/main/client/src/App.js): `client/src/App.js`
- [App context](https://github.com/vv3705029/greencart/blob/main/client/src/context/AppContext.js): `client/src/context/AppContext.js`

### API and domain

- [Express server](https://github.com/vv3705029/greencart/blob/main/server/server.js): `server/server.js`
- [User API](https://github.com/vv3705029/greencart/blob/main/server/routes/userRoute.js): `server/routes/userRoute.js`
- [User authentication](https://github.com/vv3705029/greencart/blob/main/server/controllers/UserController.js): `server/controllers/UserController.js`
- [User auth guard](https://github.com/vv3705029/greencart/blob/main/server/middlewares/authUser.js): `server/middlewares/authUser.js`
- [Seller API](https://github.com/vv3705029/greencart/blob/main/server/routes/sellerRoute.js): `server/routes/sellerRoute.js`
- [Seller authentication](https://github.com/vv3705029/greencart/blob/main/server/controllers/sellerController.js): `server/controllers/sellerController.js`
- [Seller auth guard](https://github.com/vv3705029/greencart/blob/main/server/middlewares/authSeller.js): `server/middlewares/authSeller.js`
- [Product API](https://github.com/vv3705029/greencart/blob/main/server/routes/productRoute.js): `server/routes/productRoute.js`
- [Product operations](https://github.com/vv3705029/greencart/blob/main/server/controllers/productController.js): `server/controllers/productController.js`
- [Product records](https://github.com/vv3705029/greencart/blob/main/server/models/Product.js): `server/models/Product.js`
- [Cart API](https://github.com/vv3705029/greencart/blob/main/server/routes/cartRoute.js): `server/routes/cartRoute.js`
- [Cart operations](https://github.com/vv3705029/greencart/blob/main/server/controllers/cartController.js): `server/controllers/cartController.js`
- [Address API](https://github.com/vv3705029/greencart/blob/main/server/routes/addressRoute.js): `server/routes/addressRoute.js`
- [Address operations](https://github.com/vv3705029/greencart/blob/main/server/controllers/addressController.js): `server/controllers/addressController.js`
- [Address records](https://github.com/vv3705029/greencart/blob/main/server/models/Address.js): `server/models/Address.js`
- [Order API](https://github.com/vv3705029/greencart/blob/main/server/routes/orderRoute.js): `server/routes/orderRoute.js`

### Other components

- **Shopper**

## Connections

- Shopper → App routes: uses
- App routes → Navigation: renders (evidence: `client/src/App.js`)
- App routes → User login: renders (evidence: `client/src/App.js`)
- App routes → Home page: routes to (evidence: `client/src/App.js`)
- App routes → Product catalog: routes to (evidence: `client/src/App.js`)
- App routes → Category view: routes to (evidence: `client/src/App.js`)
- App routes → Product details: routes to (evidence: `client/src/App.js`)
- App routes → Cart and checkout: routes to (evidence: `client/src/App.js`)
- App routes → Address entry: routes to (evidence: `client/src/App.js`)
- App routes → Order history: routes to (evidence: `client/src/App.js`)
- App routes → Seller login: routes to (evidence: `client/src/App.js`)
- App routes → Seller workspace: routes to (evidence: `client/src/App.js`)
- App routes → Product management: routes to (evidence: `client/src/App.js`)
- App routes → Seller product list: routes to (evidence: `client/src/App.js`)
- App routes → Seller orders: routes to (evidence: `client/src/App.js`)
- Product catalog → Product card: renders (evidence: `client/src/pages/AllProducts.js`)
- Category view → Product card: renders (evidence: `client/src/pages/ProductCategory.js`)
- App routes → App context: reads state (evidence: `client/src/App.js`)
- App context → User API: requests auth (evidence: `client/src/context/AppContext.js`)
- App context → Seller API: checks seller (evidence: `client/src/context/AppContext.js`)
- App context → Product API: loads products (evidence: `client/src/context/AppContext.js`)
- App context → Cart API: syncs cart (evidence: `client/src/context/AppContext.js`)
- Cart and checkout → Address API: loads addresses (evidence: `client/src/pages/Cart.js`)
- Cart and checkout → Order API: places order (evidence: `client/src/pages/Cart.js`)
- Express server → User API: mounts (evidence: `server/server.js`)
- Express server → Seller API: mounts (evidence: `server/server.js`)
- Express server → Product API: mounts (evidence: `server/server.js`)
- Express server → Cart API: mounts (evidence: `server/server.js`)
- Express server → Address API: mounts (evidence: `server/server.js`)
- Express server → Order API: mounts (evidence: `server/server.js`)
- User API → User authentication: dispatches (evidence: `server/routes/userRoute.js`)
- User API → User auth guard: guards (evidence: `server/routes/userRoute.js`)
- Seller API → Seller authentication: dispatches (evidence: `server/routes/sellerRoute.js`)
- Seller API → Seller auth guard: guards (evidence: `server/routes/sellerRoute.js`)
- Product API → Product operations: dispatches (evidence: `server/routes/productRoute.js`)
- Product API → Seller auth guard: guards (evidence: `server/routes/productRoute.js`)
- Product operations → Product records: reads and writes (evidence: `server/controllers/productController.js`)
- Cart API → Cart operations: dispatches (evidence: `server/routes/cartRoute.js`)
- Cart API → User auth guard: guards (evidence: `server/routes/cartRoute.js`)
- Address API → Address operations: dispatches (evidence: `server/routes/addressRoute.js`)
- Address API → User auth guard: guards (evidence: `server/routes/addressRoute.js`)
- Address operations → Address records: reads and writes (evidence: `server/controllers/addressController.js`)
- Order API → User auth guard: guards (evidence: `server/routes/orderRoute.js`)
