# viharidas/sangley-admin-reseller-web-new architecture

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

- Interactive diagram: https://gitdiagram.com/viharidas/sangley-admin-reseller-web-new
- Repository: https://github.com/viharidas/sangley-admin-reseller-web-new

## Overview

SANGLEY combines a consumer storefront and checkout with a reseller business portal. Shoppers browse products, submit leads or place orders; the backend serves catalogue/content and commerce operations. Resellers authenticate, track attributed sales and commissions, while staff administer settings, rules, payouts, support and reporting. MongoDB is the shared persistence layer. The README contains no product documentation, so capability scope comes from the source index and excerpts; unsampled components are represented only where paths and roles are supported.

Main entry points: [`frontend/src/App.js`](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/App.js) (Storefront app), [`backend/server.py`](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/server.py) (HTTP API), [`backend/db.py`](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/db.py) (MongoDB), [`frontend/src/lib/store.js`](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/lib/store.js) (Store data & API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_storefront["Storefront app<br/>[App.js]"]
  node_home["Home &amp; content<br/>[Home.jsx]"]
  node_catalogue["Product catalogue<br/>[Shop.jsx]"]
  node_product["Product detail<br/>[Product.jsx]"]
  node_resellpage["Reseller landing<br/>[Resell.jsx]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_storestate["Store data &amp; API<br/>[store.js]"]
  node_productcard["Product card<br/>[ProductCard.jsx]"]
  node_elements["Store elements<br/>[Elements.jsx]"]
end

subgraph group_commerce["Commerce backend"]
  node_api["HTTP API<br/>[server.py]"]
  node_auth["Admin authentication<br/>[auth.py]"]
  node_commercecore["Orders &amp; commerce<br/>[commerce.py]"]
  node_admin["Catalogue administration<br/>[admin_routes.py]"]
end

subgraph group_portal["Reseller portal"]
  node_portalapp["Portal application<br/>[PortalApp.jsx]"]
  node_portal_auth_ui["Portal sign-in<br/>[Auth.jsx]"]
  node_portal_api["Portal API client<br/>[api.js]"]
  node_reseller_routes["Reseller services<br/>[reseller_routes.py]"]
  node_referrals["Referral attribution<br/>[referrals.py]"]
  node_portal_auth["Portal authentication<br/>[auth_routes.py]"]
  node_portal_security["Access control<br/>[security.py]"]
end

subgraph group_ops["Portal operations"]
  node_portal_admin["Business administration<br/>[admin_routes.py]"]
  node_finance_routes["Finance operations<br/>[finance_routes.py]"]
  node_financial["Commission &amp; payout ledger<br/>[financial.py]"]
  node_metrics["Sales metrics<br/>[metrics.py]"]
  node_settings["Business settings<br/>[settings.py]"]
  node_audit["Audit &amp; notifications<br/>[audit.py]"]
end

subgraph group_storage["Persistence"]
  node_db[("MongoDB<br/>[db.py]")]
end

node_shopper(("Shopper"))

node_shopper -->|"browses"| node_storefront
node_storefront -->|"routes to"| node_home
node_storefront -->|"routes to"| node_catalogue
node_storefront -->|"routes to"| node_product
node_storefront -->|"routes to"| node_resellpage
node_storefront -->|"routes to"| node_checkout
node_storefront -->|"provides data"| node_storestate
node_home -->|"reads content"| node_storestate
node_home -->|"renders"| node_productcard
node_home -->|"renders"| node_elements
node_catalogue -.->|"renders"| node_productcard
node_product -.->|"uses API"| node_storestate
node_checkout -.->|"submits via"| node_storestate
node_storestate -->|"sends requests"| node_api
node_api -->|"routes commerce"| node_commercecore
node_api -->|"routes admin"| node_admin
node_api -->|"routes portal auth"| node_portal_auth
node_api -->|"routes reseller"| node_reseller_routes
node_api -->|"routes business admin"| node_portal_admin
node_portalapp -.->|"renders"| node_portal_auth_ui
node_portal_auth_ui -->|"calls"| node_portal_api
node_portal_api -.->|"sends requests"| node_api
node_reseller_routes -->|"authenticates"| node_portal_security
node_portal_auth -->|"uses"| node_portal_security
node_reseller_routes -->|"queries metrics"| node_metrics
node_reseller_routes -->|"reads &amp; updates"| node_db
node_commercecore -->|"uses attribution"| node_referrals
node_commercecore -->|"persists orders"| node_db
node_admin -->|"manages catalogue"| node_db
node_admin -->|"requires admin"| node_auth
node_portal_admin -->|"builds reports"| node_metrics
node_portal_admin -->|"reads settings"| node_settings
node_portal_admin -->|"reads records"| node_db
node_finance_routes -->|"executes ledger actions"| node_financial
node_finance_routes -->|"gets summaries"| node_metrics
node_financial -->|"records changes"| node_audit
node_financial -->|"updates ledger"| node_db
node_settings -->|"loads settings"| node_db
node_audit -->|"writes audit logs"| node_db
node_metrics -->|"aggregates records"| node_db
node_portal_security -->|"checks permissions"| node_settings

click node_storefront "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/App.js"
click node_home "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/pages/Home.jsx"
click node_catalogue "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/pages/Shop.jsx"
click node_product "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/pages/Product.jsx"
click node_resellpage "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/pages/Resell.jsx"
click node_checkout "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/pages/Checkout.jsx"
click node_storestate "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/lib/store.js"
click node_productcard "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/components/ProductCard.jsx"
click node_elements "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/components/Elements.jsx"
click node_api "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/server.py"
click node_auth "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/auth.py"
click node_commercecore "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/commerce.py"
click node_admin "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/admin_routes.py"
click node_portalapp "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/portal/PortalApp.jsx"
click node_portal_auth_ui "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/portal/Auth.jsx"
click node_portal_api "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/portal/api.js"
click node_reseller_routes "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/reseller_routes.py"
click node_referrals "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/referrals.py"
click node_portal_auth "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/auth_routes.py"
click node_portal_security "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/security.py"
click node_portal_admin "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/admin_routes.py"
click node_finance_routes "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/finance_routes.py"
click node_financial "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/financial.py"
click node_metrics "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/metrics.py"
click node_settings "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/settings.py"
click node_audit "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/audit.py"
click node_db "https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/db.py"

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_home,node_catalogue,node_product,node_resellpage,node_checkout,node_storestate,node_productcard,node_elements toneBlue
class node_api,node_auth,node_commercecore,node_admin toneAmber
class node_portalapp,node_portal_auth_ui,node_portal_api,node_reseller_routes,node_referrals,node_portal_auth,node_portal_security toneMint
class node_portal_admin,node_finance_routes,node_financial,node_metrics,node_settings,node_audit toneRose
class node_db,node_shopper toneIndigo
```

## Components

### Storefront

- [Storefront app](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Home & content](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Product catalogue](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/pages/Shop.jsx): `frontend/src/pages/Shop.jsx`
- [Product detail](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/pages/Product.jsx): `frontend/src/pages/Product.jsx`
- [Reseller landing](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/pages/Resell.jsx): `frontend/src/pages/Resell.jsx`
- [Checkout](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/pages/Checkout.jsx): `frontend/src/pages/Checkout.jsx`
- [Store data & API](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/lib/store.js): `frontend/src/lib/store.js`
- [Product card](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/components/ProductCard.jsx): `frontend/src/components/ProductCard.jsx`
- [Store elements](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/components/Elements.jsx): `frontend/src/components/Elements.jsx`

### Commerce backend

- [HTTP API](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/server.py): `backend/server.py`
- [Admin authentication](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/auth.py): `backend/auth.py`
- [Orders & commerce](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/commerce.py): `backend/commerce.py`
- [Catalogue administration](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/admin_routes.py): `backend/admin_routes.py`

### Reseller portal

- [Portal application](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/portal/PortalApp.jsx): `frontend/src/portal/PortalApp.jsx`
- [Portal sign-in](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/portal/Auth.jsx): `frontend/src/portal/Auth.jsx`
- [Portal API client](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/frontend/src/portal/api.js): `frontend/src/portal/api.js`
- [Reseller services](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/reseller_routes.py): `backend/portal/reseller_routes.py`
- [Referral attribution](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/referrals.py): `backend/portal/referrals.py`
- [Portal authentication](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/auth_routes.py): `backend/portal/auth_routes.py`
- [Access control](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/security.py): `backend/portal/security.py`

### Portal operations

- [Business administration](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/admin_routes.py): `backend/portal/admin_routes.py`
- [Finance operations](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/finance_routes.py): `backend/portal/finance_routes.py`
- [Commission & payout ledger](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/financial.py): `backend/portal/financial.py`
- [Sales metrics](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/metrics.py): `backend/portal/metrics.py`
- [Business settings](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/settings.py): `backend/portal/settings.py`
- [Audit & notifications](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/portal/audit.py): `backend/portal/audit.py`

### Persistence

- [MongoDB](https://github.com/viharidas/sangley-admin-reseller-web-new/blob/main/backend/db.py): `backend/db.py`

### Other components

- **Shopper**

## Connections

- Shopper → Storefront app: browses (evidence: `frontend/src/App.js`)
- Storefront app → Home & content: routes to (evidence: `frontend/src/App.js`)
- Storefront app → Product catalogue: routes to (evidence: `frontend/src/App.js`)
- Storefront app → Product detail: routes to (evidence: `frontend/src/App.js`)
- Storefront app → Reseller landing: routes to (evidence: `frontend/src/App.js`)
- Storefront app → Checkout: routes to (evidence: `frontend/src/App.js`)
- Storefront app → Store data & API: provides data (evidence: `frontend/src/App.js`)
- Home & content → Store data & API: reads content (evidence: `frontend/src/pages/Home.jsx`)
- Home & content → Product card: renders (evidence: `frontend/src/pages/Home.jsx`)
- Home & content → Store elements: renders (evidence: `frontend/src/pages/Home.jsx`)
- Product catalogue → Product card: renders
- Product detail → Store data & API: uses API
- Checkout → Store data & API: submits via
- Store data & API → HTTP API: sends requests (evidence: `frontend/src/lib/store.js`)
- HTTP API → Orders & commerce: routes commerce (evidence: `backend/server.py`)
- HTTP API → Catalogue administration: routes admin (evidence: `backend/server.py`)
- HTTP API → Portal authentication: routes portal auth (evidence: `backend/server.py`)
- HTTP API → Reseller services: routes reseller (evidence: `backend/server.py`)
- HTTP API → Business administration: routes business admin (evidence: `backend/server.py`)
- Portal application → Portal sign-in: renders
- Portal sign-in → Portal API client: calls (evidence: `frontend/src/portal/Auth.jsx`)
- Portal API client → HTTP API: sends requests
- Reseller services → Access control: authenticates (evidence: `backend/portal/reseller_routes.py`)
- Portal authentication → Access control: uses (evidence: `backend/portal/auth_routes.py`)
- Reseller services → Sales metrics: queries metrics (evidence: `backend/portal/reseller_routes.py`)
- Reseller services → MongoDB: reads & updates (evidence: `backend/portal/reseller_routes.py`)
- Orders & commerce → Referral attribution: uses attribution (evidence: `backend/commerce.py`)
- Orders & commerce → MongoDB: persists orders (evidence: `backend/commerce.py`)
- Catalogue administration → MongoDB: manages catalogue (evidence: `backend/admin_routes.py`)
- Catalogue administration → Admin authentication: requires admin (evidence: `backend/admin_routes.py`)
- Business administration → Sales metrics: builds reports (evidence: `backend/portal/admin_routes.py`)
- Business administration → Business settings: reads settings (evidence: `backend/portal/admin_routes.py`)
- Business administration → MongoDB: reads records (evidence: `backend/portal/admin_routes.py`)
- Finance operations → Commission & payout ledger: executes ledger actions (evidence: `backend/portal/finance_routes.py`)
- Finance operations → Sales metrics: gets summaries (evidence: `backend/portal/finance_routes.py`)
- Commission & payout ledger → Audit & notifications: records changes (evidence: `backend/portal/financial.py`)
- Commission & payout ledger → MongoDB: updates ledger (evidence: `backend/portal/financial.py`)
- Business settings → MongoDB: loads settings (evidence: `backend/portal/settings.py`)
- Audit & notifications → MongoDB: writes audit logs (evidence: `backend/portal/audit.py`)
- Sales metrics → MongoDB: aggregates records (evidence: `backend/portal/metrics.py`)
- Access control → Business settings: checks permissions (evidence: `backend/portal/security.py`)
