# suriyanandhimalai555-prog/avg_mart architecture

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

- Interactive diagram: https://gitdiagram.com/suriyanandhimalai555-prog/avg_mart
- Repository: https://github.com/suriyanandhimalai555-prog/avg_mart

## Overview

AVG Mart is a multi-role ecommerce application: customers browse products, manage a cart, check out and follow orders, while admins, branch staff, sellers and marketers manage catalog, stock and sales operations. The sampled code shows React route composition and an Express API, with PostgreSQL-backed order and catalog work plus S3 media and payment/shipping integrations. Several UI-to-API calls and unsampled operational handlers are not shown, so those links are omitted or marked unverified rather than inferred as confirmed calls.

Main entry points: [`client/src/App.jsx`](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/App.jsx) (React route app), [`server/server.js`](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/server.js) (HTTP route registration), [`server/config/db.js`](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/config/db.js) (PostgreSQL pool), [`server/controllers/productController.js`](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/productController.js) (Product and review API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_app["React route app<br/>[App.jsx]"]
  node_catalog_ui["Product browsing<br/>[AllProducts.jsx]"]
  node_product_detail["Product detail"]
  node_cart_ui["Cart<br/>[Cart.jsx]"]
  node_checkout_ui["Checkout<br/>[Checkout.jsx]"]
  node_account_ui["Account and orders<br/>[Profile.jsx]"]
  node_signup_ui["Customer signup<br/>[Signup.jsx]"]
end

subgraph group_commerce["Commerce services"]
  node_product_api["Product and review API"]
  node_review_api["Review handling"]
  node_auth_api["Authentication<br/>[authController.js]"]
  node_cart_api["Cart handling<br/>[cartController.js]"]
  node_payment_api["Orders and payment"]
  node_api_routes["HTTP route registration<br/>[server.js]"]
end

subgraph group_operations["Marketplace operations"]
  node_admin_ui["Admin catalog and orders<br/>[AddProducts.jsx]"]
  node_branch_ui["Branch stock and orders<br/>[BranchOrders.jsx]"]
  node_seller_ui["Seller workspace<br/>[SellerProduct.jsx]"]
  node_seller_api["Seller services"]
  node_stock_api["Stock operations<br/>[stockController.js]"]
end

subgraph group_platform["Data and integrations"]
  node_db[("PostgreSQL pool<br/>[db.js]")]
  node_s3["S3 media storage<br/>[s3.js]"]
  node_auth_middleware["Token authorization<br/>[authMiddleware.js]"]
end

node_customer(("Customer"))
node_razorpay["Razorpay"]
node_shypfy["Shypfy shipping"]

node_customer -->|"opens"| node_app
node_app -->|"routes to"| node_catalog_ui
node_app -->|"routes to"| node_product_detail
node_app -->|"routes to"| node_cart_ui
node_app -->|"routes to"| node_checkout_ui
node_app -->|"routes to"| node_account_ui
node_app -->|"routes to"| node_signup_ui
node_app -->|"routes to"| node_admin_ui
node_app -->|"routes to"| node_branch_ui
node_app -->|"routes to"| node_seller_ui
node_api_routes -->|"mounts routes"| node_product_api
node_api_routes -->|"mounts routes"| node_auth_api
node_api_routes -->|"mounts routes"| node_seller_api
node_api_routes -->|"mounts routes"| node_stock_api
node_product_api -->|"routes reviews"| node_review_api
node_product_api -->|"protects writes"| node_auth_middleware
node_seller_api -->|"protects endpoints"| node_auth_middleware
node_product_api -->|"queries"| node_db
node_review_api -->|"reads and writes"| node_db
node_review_api -->|"uploads images"| node_s3
node_seller_api -->|"queries"| node_db
node_seller_api -->|"uploads documents"| node_s3
node_auth_api -->|"uses user models"| node_db
node_cart_api -->|"queries"| node_db
node_payment_api -->|"queries and writes"| node_db
node_payment_api -.->|"creates payment orders"| node_razorpay
node_payment_api -->|"creates and tracks shipments"| node_shypfy
node_checkout_ui -.->|"submits checkout"| node_api_routes
node_catalog_ui -.->|"loads catalog"| node_api_routes
node_account_ui -.->|"requests account data"| node_api_routes
node_admin_ui -.->|"manages catalog"| node_api_routes
node_branch_ui -.->|"manages stock"| node_api_routes
node_seller_ui -.->|"manages listings"| node_api_routes

click node_app "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/App.jsx"
click node_catalog_ui "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/AllProducts.jsx"
click node_product_detail "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/ProductDetailView.jsx"
click node_cart_ui "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/Cart.jsx"
click node_checkout_ui "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/Checkout.jsx"
click node_account_ui "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/Profile.jsx"
click node_signup_ui "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/Signup.jsx"
click node_product_api "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/productController.js"
click node_review_api "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/reviewController.js"
click node_auth_api "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/authController.js"
click node_cart_api "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/cartController.js"
click node_payment_api "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/paymentController.js"
click node_api_routes "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/server.js"
click node_admin_ui "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/admin/AddProducts.jsx"
click node_branch_ui "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/branchAdmin/BranchOrders.jsx"
click node_seller_ui "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/seller/SellerProduct.jsx"
click node_seller_api "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/sellerController.js"
click node_stock_api "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/stockController.js"
click node_db "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/config/db.js"
click node_s3 "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/config/s3.js"
click node_auth_middleware "https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/middleware/authMiddleware.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_catalog_ui,node_product_detail,node_cart_ui,node_checkout_ui,node_account_ui,node_signup_ui toneBlue
class node_product_api,node_review_api,node_auth_api,node_cart_api,node_payment_api,node_api_routes toneAmber
class node_admin_ui,node_branch_ui,node_seller_ui,node_seller_api,node_stock_api toneMint
class node_db,node_s3,node_auth_middleware toneRose
class node_customer,node_razorpay,node_shypfy toneIndigo
```

## Components

### Customer storefront

- [React route app](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Product browsing](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/AllProducts.jsx): `client/src/pages/AllProducts.jsx`
- [Product detail](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/ProductDetailView.jsx): `client/src/pages/ProductDetailView.jsx`
- [Cart](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/Cart.jsx): `client/src/pages/Cart.jsx`
- [Checkout](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/Checkout.jsx): `client/src/pages/Checkout.jsx`
- [Account and orders](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/Profile.jsx): `client/src/pages/Profile.jsx`
- [Customer signup](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/Signup.jsx): `client/src/pages/Signup.jsx`

### Commerce services

- [Product and review API](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/productController.js): `server/controllers/productController.js`
- [Review handling](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/reviewController.js): `server/controllers/reviewController.js`
- [Authentication](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [Cart handling](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/cartController.js): `server/controllers/cartController.js`
- [Orders and payment](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/paymentController.js): `server/controllers/paymentController.js`
- [HTTP route registration](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/server.js): `server/server.js`

### Marketplace operations

- [Admin catalog and orders](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/admin/AddProducts.jsx): `client/src/pages/admin/AddProducts.jsx`
- [Branch stock and orders](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/branchAdmin/BranchOrders.jsx): `client/src/pages/branchAdmin/BranchOrders.jsx`
- [Seller workspace](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/client/src/pages/seller/SellerProduct.jsx): `client/src/pages/seller/SellerProduct.jsx`
- [Seller services](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/sellerController.js): `server/controllers/sellerController.js`
- [Stock operations](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/controllers/stockController.js): `server/controllers/stockController.js`

### Data and integrations

- [PostgreSQL pool](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/config/db.js): `server/config/db.js`
- [S3 media storage](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/config/s3.js): `server/config/s3.js`
- [Token authorization](https://github.com/suriyanandhimalai555-prog/avg_mart/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`

### Other components

- **Customer**
- **Razorpay**
- **Shypfy shipping**

## Connections

- Customer → React route app: opens (evidence: `client/src/App.jsx`)
- React route app → Product browsing: routes to (evidence: `client/src/App.jsx`)
- React route app → Product detail: routes to (evidence: `client/src/App.jsx`)
- React route app → Cart: routes to (evidence: `client/src/App.jsx`)
- React route app → Checkout: routes to (evidence: `client/src/App.jsx`)
- React route app → Account and orders: routes to (evidence: `client/src/App.jsx`)
- React route app → Customer signup: routes to (evidence: `client/src/App.jsx`)
- React route app → Admin catalog and orders: routes to (evidence: `client/src/App.jsx`)
- React route app → Branch stock and orders: routes to (evidence: `client/src/App.jsx`)
- React route app → Seller workspace: routes to (evidence: `client/src/App.jsx`)
- HTTP route registration → Product and review API: mounts routes (evidence: `server/server.js`)
- HTTP route registration → Authentication: mounts routes (evidence: `server/server.js`)
- HTTP route registration → Seller services: mounts routes (evidence: `server/server.js`)
- HTTP route registration → Stock operations: mounts routes (evidence: `server/server.js`)
- Product and review API → Review handling: routes reviews (evidence: `server/routes/productRoutes.js`)
- Product and review API → Token authorization: protects writes (evidence: `server/routes/productRoutes.js`)
- Seller services → Token authorization: protects endpoints (evidence: `server/routes/sellerRoutes.js`)
- Product and review API → PostgreSQL pool: queries (evidence: `server/controllers/productController.js`)
- Review handling → PostgreSQL pool: reads and writes (evidence: `server/controllers/reviewController.js`)
- Review handling → S3 media storage: uploads images (evidence: `server/controllers/reviewController.js`)
- Seller services → PostgreSQL pool: queries (evidence: `server/controllers/sellerController.js`)
- Seller services → S3 media storage: uploads documents (evidence: `server/controllers/sellerController.js`)
- Authentication → PostgreSQL pool: uses user models (evidence: `server/controllers/authController.js`)
- Cart handling → PostgreSQL pool: queries (evidence: `server/controllers/cartController.js`)
- Orders and payment → PostgreSQL pool: queries and writes (evidence: `server/controllers/paymentController.js`)
- Orders and payment → Razorpay: creates payment orders (evidence: `server/controllers/paymentController.js`)
- Orders and payment → Shypfy shipping: creates and tracks shipments (evidence: `server/controllers/paymentController.js`)
- Checkout → HTTP route registration: submits checkout
- Product browsing → HTTP route registration: loads catalog
- Account and orders → HTTP route registration: requests account data
- Admin catalog and orders → HTTP route registration: manages catalog
- Branch stock and orders → HTTP route registration: manages stock
- Seller workspace → HTTP route registration: manages listings
