# vedantlitecoder0135/shopnexa architecture

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

- Interactive diagram: https://gitdiagram.com/vedantlitecoder0135/shopnexa
- Repository: https://github.com/vedantlitecoder0135/shopnexa

## Overview

Shopnexa is a commerce storefront and administration platform: shoppers discover products, build a retailer-aware cart, check out through payment, and track orders; administrators manage catalog, orders, shipping, and analytics. The sampled code shows React routing and shared auth/cart state, an Express API, Supabase-backed order handling, and server-sent event broadcasts. The README also describes offline orders and multiple payment modes. Those capabilities are represented where the tree supports them, but unsampled implementation details and several frontend-to-backend route mappings remain unverified.

Main entry points: [`shopnexa-frontend/src/App.jsx`](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/App.jsx) (Route application), [`shopnexa-frontend/src/api/axios.js`](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/api/axios.js) (API client), [`shopnexa-backend/src/server.js`](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/server.js) (Backend API), [`shopnexa-frontend/src/context/cartContext.jsx`](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/context/cartContext.jsx) (Cart state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shopper["Shopping experience"]
  node_storefront["Storefront<br/>[Storefront.jsx]"]
  node_details["Product details<br/>[ProductDetails.jsx]"]
  node_retailers["Retailer estimates<br/>[retailers.js]"]
  node_cart["Cart state<br/>[cartContext.jsx]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_payment["Payment<br/>[Payment.jsx]"]
  node_offline["Offline orders<br/>[OfflineOrders.jsx]"]
end

subgraph group_commerce["Commerce services"]
  node_orders["Order handling<br/>[orderController.js]"]
  node_storage[("Supabase data<br/>[supabaseClient.js]")]
  node_delivery["Delivery service<br/>[deliveryService.js]"]
  node_events["Event bus<br/>[eventBus.js]"]
  node_stripe["Stripe endpoints<br/>[stripeRoutes.js]"]
  node_postgres[("Postgres pool<br/>[db.js]")]
end

subgraph group_operations["Operations and analytics"]
  node_metrics["Admin metrics<br/>[adminRoutes.js]"]
  node_admin_guard["Admin authorization<br/>[adminOnly.js]"]
  node_dashboard["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_analytics["Analytics<br/>[Analytics.jsx]"]
  node_manage_orders["Order management<br/>[ManageOrders.jsx]"]
end

subgraph group_platform["Application platform"]
  node_app["Route application<br/>[App.jsx]"]
  node_auth["Auth state<br/>[authContext.jsx]"]
  node_http["API client<br/>[axios.js]"]
  node_api["Backend API<br/>[server.js]"]
  node_routes["Route registry<br/>[index.js]"]
  node_sse["Live event stream<br/>[server.js]"]
end

node_shopper(("Shopper"))
node_admin(("Administrator"))

node_shopper -->|"browses"| node_app
node_admin -->|"opens console"| node_app
node_app -->|"routes to"| node_storefront
node_app -->|"routes to"| node_details
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_manage_orders
node_app -->|"checks access"| node_auth
node_auth -->|"requests auth"| node_http
node_storefront -->|"loads products"| node_http
node_storefront -->|"adds products"| node_cart
node_details -->|"adds products"| node_cart
node_details -->|"estimates delivery"| node_retailers
node_cart -->|"estimates days"| node_retailers
node_checkout -->|"reads cart"| node_cart
node_checkout -->|"uses retailer data"| node_retailers
node_checkout -->|"submits request"| node_http
node_payment -->|"reads cart"| node_cart
node_payment -.->|"payment integration"| node_stripe
node_offline -.->|"order workflow"| node_orders
node_http -->|"sends API requests"| node_api
node_api -->|"mounts routes"| node_routes
node_routes -->|"registers admin routes"| node_metrics
node_metrics -->|"applies guard"| node_admin_guard
node_metrics -->|"reads metrics"| node_storage
node_dashboard -->|"requests metrics"| node_http
node_analytics -->|"requests analytics"| node_http
node_manage_orders -->|"requests orders"| node_http
node_orders -->|"reads and writes"| node_storage
node_orders -->|"sends confirmation"| node_delivery
node_orders -->|"emits updates"| node_events
node_api -->|"listens for events"| node_events
node_api -->|"broadcasts events"| node_sse
node_api -->|"closes pool"| node_postgres

click node_app "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/App.jsx"
click node_auth "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/context/authContext.jsx"
click node_http "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/api/axios.js"
click node_api "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/server.js"
click node_routes "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/routes/index.js"
click node_storefront "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/Storefront.jsx"
click node_details "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/ProductDetails.jsx"
click node_retailers "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/data/retailers.js"
click node_cart "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/context/cartContext.jsx"
click node_checkout "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/Checkout.jsx"
click node_payment "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/Payment.jsx"
click node_offline "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/OfflineOrders.jsx"
click node_orders "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/controllers/orderController.js"
click node_storage "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/config/supabaseClient.js"
click node_delivery "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/services/deliveryService.js"
click node_events "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/events/eventBus.js"
click node_sse "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/server.js"
click node_metrics "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/routes/adminRoutes.js"
click node_admin_guard "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/middleware/adminOnly.js"
click node_dashboard "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/AdminDashboard.jsx"
click node_analytics "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/Analytics.jsx"
click node_manage_orders "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/ManageOrders.jsx"
click node_stripe "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/routes/stripeRoutes.js"
click node_postgres "https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/config/db.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_storefront,node_details,node_retailers,node_cart,node_checkout,node_payment,node_offline toneBlue
class node_orders,node_storage,node_delivery,node_events,node_stripe,node_postgres toneAmber
class node_metrics,node_admin_guard,node_dashboard,node_analytics,node_manage_orders toneMint
class node_app,node_auth,node_http,node_api,node_routes,node_sse toneRose
class node_shopper,node_admin toneIndigo
```

## Components

### Shopping experience

- [Storefront](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/Storefront.jsx): `shopnexa-frontend/src/pages/Storefront.jsx`
- [Product details](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/ProductDetails.jsx): `shopnexa-frontend/src/pages/ProductDetails.jsx`
- [Retailer estimates](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/data/retailers.js): `shopnexa-frontend/src/data/retailers.js`
- [Cart state](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/context/cartContext.jsx): `shopnexa-frontend/src/context/cartContext.jsx`
- [Checkout](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/Checkout.jsx): `shopnexa-frontend/src/pages/Checkout.jsx`
- [Payment](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/Payment.jsx): `shopnexa-frontend/src/pages/Payment.jsx`
- [Offline orders](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/OfflineOrders.jsx): `shopnexa-frontend/src/pages/OfflineOrders.jsx`

### Commerce services

- [Order handling](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/controllers/orderController.js): `shopnexa-backend/src/controllers/orderController.js`
- [Supabase data](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/config/supabaseClient.js): `shopnexa-backend/src/config/supabaseClient.js`
- [Delivery service](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/services/deliveryService.js): `shopnexa-backend/src/services/deliveryService.js`
- [Event bus](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/events/eventBus.js): `shopnexa-backend/src/events/eventBus.js`
- [Stripe endpoints](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/routes/stripeRoutes.js): `shopnexa-backend/src/routes/stripeRoutes.js`
- [Postgres pool](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/config/db.js): `shopnexa-backend/config/db.js`

### Operations and analytics

- [Admin metrics](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/routes/adminRoutes.js): `shopnexa-backend/src/routes/adminRoutes.js`
- [Admin authorization](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/middleware/adminOnly.js): `shopnexa-backend/src/middleware/adminOnly.js`
- [Admin dashboard](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/AdminDashboard.jsx): `shopnexa-frontend/src/pages/AdminDashboard.jsx`
- [Analytics](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/Analytics.jsx): `shopnexa-frontend/src/pages/Analytics.jsx`
- [Order management](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/pages/ManageOrders.jsx): `shopnexa-frontend/src/pages/ManageOrders.jsx`

### Application platform

- [Route application](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/App.jsx): `shopnexa-frontend/src/App.jsx`
- [Auth state](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/context/authContext.jsx): `shopnexa-frontend/src/context/authContext.jsx`
- [API client](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-frontend/src/api/axios.js): `shopnexa-frontend/src/api/axios.js`
- [Backend API](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/server.js): `shopnexa-backend/src/server.js`
- [Route registry](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/routes/index.js): `shopnexa-backend/src/routes/index.js`
- [Live event stream](https://github.com/vedantlitecoder0135/shopnexa/blob/master/shopnexa-backend/src/server.js): `shopnexa-backend/src/server.js`

### Other components

- **Shopper**
- **Administrator**

## Connections

- Shopper → Route application: browses (evidence: `shopnexa-frontend/src/App.jsx`)
- Administrator → Route application: opens console (evidence: `shopnexa-frontend/src/App.jsx`)
- Route application → Storefront: routes to (evidence: `shopnexa-frontend/src/App.jsx`)
- Route application → Product details: routes to (evidence: `shopnexa-frontend/src/App.jsx`)
- Route application → Admin dashboard: routes to (evidence: `shopnexa-frontend/src/App.jsx`)
- Route application → Analytics: routes to (evidence: `shopnexa-frontend/src/App.jsx`)
- Route application → Order management: routes to (evidence: `shopnexa-frontend/src/App.jsx`)
- Route application → Auth state: checks access (evidence: `shopnexa-frontend/src/App.jsx`)
- Auth state → API client: requests auth (evidence: `shopnexa-frontend/src/context/authContext.jsx`)
- Storefront → API client: loads products (evidence: `shopnexa-frontend/src/pages/Storefront.jsx`)
- Storefront → Cart state: adds products (evidence: `shopnexa-frontend/src/pages/Storefront.jsx`)
- Product details → Cart state: adds products (evidence: `shopnexa-frontend/src/pages/ProductDetails.jsx`)
- Product details → Retailer estimates: estimates delivery (evidence: `shopnexa-frontend/src/pages/ProductDetails.jsx`)
- Cart state → Retailer estimates: estimates days (evidence: `shopnexa-frontend/src/context/cartContext.jsx`)
- Checkout → Cart state: reads cart (evidence: `shopnexa-frontend/src/pages/Checkout.jsx`)
- Checkout → Retailer estimates: uses retailer data (evidence: `shopnexa-frontend/src/pages/Checkout.jsx`)
- Checkout → API client: submits request (evidence: `shopnexa-frontend/src/pages/Checkout.jsx`)
- Payment → Cart state: reads cart (evidence: `shopnexa-frontend/src/pages/Payment.jsx`)
- Payment → Stripe endpoints: payment integration
- Offline orders → Order handling: order workflow
- API client → Backend API: sends API requests (evidence: `shopnexa-frontend/src/api/axios.js`)
- Backend API → Route registry: mounts routes (evidence: `shopnexa-backend/src/server.js`)
- Route registry → Admin metrics: registers admin routes (evidence: `shopnexa-backend/src/routes/index.js`)
- Admin metrics → Admin authorization: applies guard (evidence: `shopnexa-backend/src/routes/adminRoutes.js`)
- Admin metrics → Supabase data: reads metrics (evidence: `shopnexa-backend/src/routes/adminRoutes.js`)
- Admin dashboard → API client: requests metrics (evidence: `shopnexa-frontend/src/pages/AdminDashboard.jsx`)
- Analytics → API client: requests analytics (evidence: `shopnexa-frontend/src/pages/Analytics.jsx`)
- Order management → API client: requests orders (evidence: `shopnexa-frontend/src/pages/ManageOrders.jsx`)
- Order handling → Supabase data: reads and writes (evidence: `shopnexa-backend/src/controllers/orderController.js`)
- Order handling → Delivery service: sends confirmation (evidence: `shopnexa-backend/src/controllers/orderController.js`)
- Order handling → Event bus: emits updates (evidence: `shopnexa-backend/src/controllers/orderController.js`)
- Backend API → Event bus: listens for events (evidence: `shopnexa-backend/src/server.js`)
- Backend API → Live event stream: broadcasts events (evidence: `shopnexa-backend/src/server.js`)
- Backend API → Postgres pool: closes pool (evidence: `shopnexa-backend/src/server.js`)
