# praveenkuamrs/ecommerce_ai architecture

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

- Interactive diagram: https://gitdiagram.com/praveenkuamrs/ecommerce_ai
- Repository: https://github.com/praveenkuamrs/ecommerce_ai

## Overview

ApexStore is a React storefront and administration console backed by an Express/Prisma e-commerce API. Customers browse products, authenticate, manage a cart and addresses, check out, and view orders; administrators manage catalog, fulfillment, users, and dashboard data. The README documents transactional stock protection, server-validated pricing, local image uploads, and payment handling. Source excerpts show frontend providers and page routing plus selected backend calls; unsampled domain links are shown only where the README supports them, with uncertain wiring left out.

Main entry points: [`frontend/src/routes/AppRoutes.jsx`](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/routes/AppRoutes.jsx) (App routing), [`backend/src/services`](https://github.com/praveenkuamrs/ecommerce_ai/tree/main/backend/src/services) (Commerce services), [`frontend/src/api`](https://github.com/praveenkuamrs/ecommerce_ai/tree/main/frontend/src/api) (API clients), [`frontend/src/pages/checkout/CheckoutPage.jsx`](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/pages/checkout/CheckoutPage.jsx) (Checkout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer experience"]
  node_app_routes["App routing<br/>[AppRoutes.jsx]"]
  node_shop_pages["Shop pages"]
  node_cart_page["Cart page<br/>[CartPage.jsx]"]
  node_checkout["Checkout<br/>[CheckoutPage.jsx]"]
  node_order_views["Order views"]
  node_profile["Profile<br/>[ProfilePage.jsx]"]
  node_cart_state["Cart state<br/>[CartContext.jsx]"]
  node_http_client["HTTP client<br/>[axios.js]"]
  node_api_clients["API clients"]
end

subgraph group_identity["Identity and access"]
  node_auth_state["Auth state<br/>[AuthContext.jsx]"]
  node_auth_pages["Sign-in pages"]
  node_auth_controller["Auth controller<br/>[authController.js]"]
  node_auth_service["Auth service<br/>[authService.js]"]
end

subgraph group_commerce["Commerce API"]
  node_api_routes["API routes"]
  node_commerce_controllers["Commerce controllers"]
  node_commerce_services["Commerce services"]
  node_pricing["Pricing logic<br/>[pricing.js]"]
  node_database[("MySQL database<br/>[prisma.js]")]
  node_payment["Payment handling<br/>[paymentService.js]"]
  node_mock_payment["Mock provider"]
  node_uploads["Image storage<br/>[fileStorage.js]"]
end

subgraph group_operations["Administration"]
  node_admin_pages["Admin console"]
  node_admin_api["Admin API routes<br/>[adminRoutes.js]"]
  node_admin_controller["Admin controller<br/>[adminController.js]"]
  node_admin_service["Admin service<br/>[adminService.js]"]
end

node_customer(("Customer"))

node_customer -->|"uses"| node_app_routes
node_app_routes -->|"routes to"| node_shop_pages
node_app_routes -->|"routes to"| node_cart_page
node_app_routes -->|"routes to"| node_checkout
node_app_routes -->|"routes to"| node_order_views
node_app_routes -->|"routes to"| node_profile
node_app_routes -->|"routes to"| node_auth_pages
node_cart_page -->|"uses"| node_cart_state
node_checkout -->|"uses"| node_cart_state
node_checkout -->|"requests addresses and orders"| node_api_clients
node_order_views -->|"requests order data"| node_api_clients
node_auth_pages -->|"authenticates through"| node_auth_state
node_auth_state -->|"calls auth API"| node_api_clients
node_cart_state -->|"calls cart API"| node_api_clients
node_api_clients -->|"uses"| node_http_client
node_http_client -.->|"sends requests"| node_api_routes
node_api_routes -->|"dispatches auth"| node_auth_controller
node_auth_controller -->|"calls"| node_auth_service
node_auth_service -->|"reads and writes"| node_database
node_api_routes -.->|"dispatches"| node_commerce_controllers
node_commerce_controllers -->|"calls"| node_commerce_services
node_commerce_services -.->|"reads and writes"| node_database
node_commerce_services -->|"uses pricing logic"| node_pricing
node_commerce_services -.->|"handles payments"| node_payment
node_payment -.->|"uses provider"| node_mock_payment
node_commerce_services -->|"manages product files"| node_uploads
node_app_routes -->|"routes to"| node_admin_pages
node_admin_pages -.->|"requests admin operations"| node_admin_api
node_admin_api -->|"dispatches"| node_admin_controller
node_admin_controller -.->|"delegates business logic"| node_admin_service
node_admin_service -.->|"reads and writes"| node_database

click node_app_routes "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/routes/AppRoutes.jsx"
click node_shop_pages "https://github.com/praveenkuamrs/ecommerce_ai/tree/main/frontend/src/pages/shop"
click node_cart_page "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/pages/cart/CartPage.jsx"
click node_checkout "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/pages/checkout/CheckoutPage.jsx"
click node_order_views "https://github.com/praveenkuamrs/ecommerce_ai/tree/main/frontend/src/pages/orders"
click node_profile "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/pages/profile/ProfilePage.jsx"
click node_cart_state "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/context/CartContext.jsx"
click node_auth_state "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/context/AuthContext.jsx"
click node_auth_pages "https://github.com/praveenkuamrs/ecommerce_ai/tree/main/frontend/src/pages/auth"
click node_http_client "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/api/axios.js"
click node_api_clients "https://github.com/praveenkuamrs/ecommerce_ai/tree/main/frontend/src/api"
click node_api_routes "https://github.com/praveenkuamrs/ecommerce_ai/tree/main/backend/src/routes"
click node_auth_controller "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/controllers/authController.js"
click node_auth_service "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/services/authService.js"
click node_commerce_controllers "https://github.com/praveenkuamrs/ecommerce_ai/tree/main/backend/src/controllers"
click node_commerce_services "https://github.com/praveenkuamrs/ecommerce_ai/tree/main/backend/src/services"
click node_pricing "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/utils/pricing.js"
click node_database "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/config/prisma.js"
click node_payment "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/services/paymentService.js"
click node_mock_payment "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/services/payment/mockPaymentProvider.js"
click node_uploads "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/utils/fileStorage.js"
click node_admin_pages "https://github.com/praveenkuamrs/ecommerce_ai/tree/main/frontend/src/pages/admin"
click node_admin_api "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/routes/adminRoutes.js"
click node_admin_controller "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/controllers/adminController.js"
click node_admin_service "https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/services/adminService.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_routes,node_shop_pages,node_cart_page,node_checkout,node_order_views,node_profile,node_cart_state,node_http_client,node_api_clients toneBlue
class node_auth_state,node_auth_pages,node_auth_controller,node_auth_service toneAmber
class node_api_routes,node_commerce_controllers,node_commerce_services,node_pricing,node_database,node_payment,node_mock_payment,node_uploads toneMint
class node_admin_pages,node_admin_api,node_admin_controller,node_admin_service toneRose
class node_customer toneIndigo
```

## Components

### Customer experience

- [App routing](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/routes/AppRoutes.jsx): `frontend/src/routes/AppRoutes.jsx`
- [Shop pages](https://github.com/praveenkuamrs/ecommerce_ai/tree/main/frontend/src/pages/shop): `frontend/src/pages/shop`
- [Cart page](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/pages/cart/CartPage.jsx): `frontend/src/pages/cart/CartPage.jsx`
- [Checkout](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/pages/checkout/CheckoutPage.jsx): `frontend/src/pages/checkout/CheckoutPage.jsx`
- [Order views](https://github.com/praveenkuamrs/ecommerce_ai/tree/main/frontend/src/pages/orders): `frontend/src/pages/orders`
- [Profile](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/pages/profile/ProfilePage.jsx): `frontend/src/pages/profile/ProfilePage.jsx`
- [Cart state](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/context/CartContext.jsx): `frontend/src/context/CartContext.jsx`
- [HTTP client](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/api/axios.js): `frontend/src/api/axios.js`
- [API clients](https://github.com/praveenkuamrs/ecommerce_ai/tree/main/frontend/src/api): `frontend/src/api`

### Identity and access

- [Auth state](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Sign-in pages](https://github.com/praveenkuamrs/ecommerce_ai/tree/main/frontend/src/pages/auth): `frontend/src/pages/auth`
- [Auth controller](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`
- [Auth service](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/services/authService.js): `backend/src/services/authService.js`

### Commerce API

- [API routes](https://github.com/praveenkuamrs/ecommerce_ai/tree/main/backend/src/routes): `backend/src/routes`
- [Commerce controllers](https://github.com/praveenkuamrs/ecommerce_ai/tree/main/backend/src/controllers): `backend/src/controllers`
- [Commerce services](https://github.com/praveenkuamrs/ecommerce_ai/tree/main/backend/src/services): `backend/src/services`
- [Pricing logic](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/utils/pricing.js): `backend/src/utils/pricing.js`
- [MySQL database](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/config/prisma.js): `backend/src/config/prisma.js`
- [Payment handling](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/services/paymentService.js): `backend/src/services/paymentService.js`
- [Mock provider](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/services/payment/mockPaymentProvider.js): `backend/src/services/payment/mockPaymentProvider.js`
- [Image storage](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/utils/fileStorage.js): `backend/src/utils/fileStorage.js`

### Administration

- [Admin console](https://github.com/praveenkuamrs/ecommerce_ai/tree/main/frontend/src/pages/admin): `frontend/src/pages/admin`
- [Admin API routes](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/routes/adminRoutes.js): `backend/src/routes/adminRoutes.js`
- [Admin controller](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/controllers/adminController.js): `backend/src/controllers/adminController.js`
- [Admin service](https://github.com/praveenkuamrs/ecommerce_ai/blob/main/backend/src/services/adminService.js): `backend/src/services/adminService.js`

### Other components

- **Customer**

## Connections

- Customer → App routing: uses (evidence: `frontend/src/routes/AppRoutes.jsx`)
- App routing → Shop pages: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- App routing → Cart page: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- App routing → Checkout: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- App routing → Order views: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- App routing → Profile: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- App routing → Sign-in pages: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Cart page → Cart state: uses (evidence: `frontend/src/pages/cart/CartPage.jsx`)
- Checkout → Cart state: uses (evidence: `frontend/src/pages/checkout/CheckoutPage.jsx`)
- Checkout → API clients: requests addresses and orders (evidence: `frontend/src/pages/checkout/CheckoutPage.jsx`)
- Order views → API clients: requests order data (evidence: `frontend/src/pages/orders/OrderDetailPage.jsx`)
- Sign-in pages → Auth state: authenticates through (evidence: `frontend/src/pages/auth/RegisterPage.jsx`)
- Auth state → API clients: calls auth API (evidence: `frontend/src/context/AuthContext.jsx`)
- Cart state → API clients: calls cart API (evidence: `frontend/src/context/CartContext.jsx`)
- API clients → HTTP client: uses (evidence: `frontend/src/api/authApi.js`)
- HTTP client → API routes: sends requests
- API routes → Auth controller: dispatches auth (evidence: `backend/src/routes/authRoutes.js`)
- Auth controller → Auth service: calls (evidence: `backend/src/controllers/authController.js`)
- Auth service → MySQL database: reads and writes (evidence: `backend/src/services/authService.js`)
- API routes → Commerce controllers: dispatches (evidence: `backend/src/routes/adminRoutes.js`)
- Commerce controllers → Commerce services: calls (evidence: `backend/src/controllers/productController.js`)
- Commerce services → MySQL database: reads and writes (evidence: `backend/src/services/authService.js`)
- Commerce services → Pricing logic: uses pricing logic (evidence: `backend/src/services/cartService.js`)
- Commerce services → Payment handling: handles payments (evidence: `README.md`)
- Payment handling → Mock provider: uses provider
- Commerce services → Image storage: manages product files (evidence: `backend/src/services/productService.js`)
- App routing → Admin console: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Admin console → Admin API routes: requests admin operations (evidence: `README.md`)
- Admin API routes → Admin controller: dispatches (evidence: `backend/src/routes/adminRoutes.js`)
- Admin controller → Admin service: delegates business logic (evidence: `backend/src/controllers/adminController.js`)
- Admin service → MySQL database: reads and writes
