# chandan-me/dhee-store architecture

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

- Interactive diagram: https://gitdiagram.com/chandan-me/dhee-store
- Repository: https://github.com/chandan-me/dhee-store

## Overview

Dhee Stores is a React storefront backed by FastAPI microservices, a JWT/RBAC API gateway, and separate MySQL databases. The principal workflow runs from sign-in or catalog browsing through cart checkout, payment, and order history; the order service verifies users and products and coordinates stock changes. Admin catalog/user controls and analytics are additional product branches. Edges follow the README and shown source references; unsampled gateway routing and other feature details are limited to documented behavior.

Main entry points: [`frontend/src/App.jsx`](https://github.com/chandan-me/dhee-store/blob/main/frontend/src/App.jsx) (App Coordinator), [`order_service/main.py`](https://github.com/chandan-me/dhee-store/blob/main/order_service/main.py) (Checkout & Orders API), [`user_service/main.py`](https://github.com/chandan-me/dhee-store/blob/main/user_service/main.py) (Identity & Account API), [`gateway_service/main.py`](https://github.com/chandan-me/dhee-store/blob/main/gateway_service/main.py) (JWT Gateway)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Storefront"]
  node_app["App Coordinator<br/>[App.jsx]"]
  node_authui["Sign-in &amp; Registration<br/>[AuthScreen.jsx]"]
  node_catalogui["Catalog &amp; Cart UI<br/>[ProductCard.jsx]"]
  node_cartui["Cart Page<br/>[CartPage.jsx]"]
  node_ordersui["Order History<br/>[OrdersPage.jsx]"]
  node_adminui["Admin Dashboard<br/>[AdminDashboard.jsx]"]
  node_profileui["Profile &amp; User Tools<br/>[ProfileModal.jsx]"]
  node_productmodal["Product Editor<br/>[ProductModal.jsx]"]
  node_usersmodal["User Directory<br/>[UsersModal.jsx]"]
  node_api["Gateway API Client<br/>[api.js]"]
end

subgraph group_edge["API Gateway"]
  node_gateway["JWT Gateway<br/>[main.py]"]
  node_jwt["JWT Utilities<br/>[auth.py]"]
end

subgraph group_identity["User Service"]
  node_users["Identity &amp; Account API<br/>[main.py]"]
  node_user_schema["User Schemas<br/>[schemas.py]"]
  node_user_model["User Model<br/>[models.py]"]
end

subgraph group_commerce["Commerce Services"]
  node_products["Catalog &amp; Inventory API<br/>[main.py]"]
  node_orders["Checkout &amp; Orders API<br/>[main.py]"]
end

subgraph group_persistence["Data Stores"]
  node_userdb[("Users MySQL<br/>[database.py]")]
  node_productdb[("Products MySQL<br/>[database.py]")]
  node_orderdb[("Orders MySQL<br/>[database.py]")]
end

node_shopper(("Shopper / Admin"))
node_razorpay["Razorpay"]

node_shopper -->|"uses storefront"| node_app
node_app -->|"renders"| node_authui
node_app -->|"renders"| node_catalogui
node_app -->|"renders"| node_cartui
node_app -->|"renders"| node_ordersui
node_app -->|"renders"| node_adminui
node_app -->|"renders"| node_profileui
node_app -->|"renders"| node_productmodal
node_app -->|"renders"| node_usersmodal
node_authui -->|"submits credentials"| node_app
node_app -->|"calls API client"| node_api
node_api -->|"sends API requests"| node_gateway
node_gateway -->|"validates tokens"| node_jwt
node_gateway -->|"proxies requests"| node_users
node_gateway -->|"proxies requests"| node_products
node_gateway -->|"proxies requests"| node_orders
node_users -->|"validates payloads"| node_user_schema
node_users -->|"queries users"| node_user_model
node_users -->|"uses database session"| node_userdb
node_user_model -->|"uses ORM base"| node_userdb
node_orders -->|"uses database session"| node_orderdb
node_orders -->|"verifies user"| node_users
node_orders -->|"checks and adjusts stock"| node_products
node_products -->|"uses database session"| node_productdb
node_products -->|"checks order references"| node_orders
node_users -->|"checks orders before deletion"| node_orders
node_orders -.->|"creates and verifies payments"| node_razorpay

click node_app "https://github.com/chandan-me/dhee-store/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/AuthScreen.jsx"
click node_catalogui "https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/ProductCard.jsx"
click node_cartui "https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/CartPage.jsx"
click node_ordersui "https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/OrdersPage.jsx"
click node_adminui "https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/AdminDashboard.jsx"
click node_profileui "https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/ProfileModal.jsx"
click node_productmodal "https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/ProductModal.jsx"
click node_usersmodal "https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/UsersModal.jsx"
click node_api "https://github.com/chandan-me/dhee-store/blob/main/frontend/src/services/api.js"
click node_gateway "https://github.com/chandan-me/dhee-store/blob/main/gateway_service/main.py"
click node_jwt "https://github.com/chandan-me/dhee-store/blob/main/gateway_service/auth.py"
click node_users "https://github.com/chandan-me/dhee-store/blob/main/user_service/main.py"
click node_user_schema "https://github.com/chandan-me/dhee-store/blob/main/user_service/schemas.py"
click node_user_model "https://github.com/chandan-me/dhee-store/blob/main/user_service/models.py"
click node_userdb "https://github.com/chandan-me/dhee-store/blob/main/user_service/database.py"
click node_products "https://github.com/chandan-me/dhee-store/blob/main/product_service/main.py"
click node_productdb "https://github.com/chandan-me/dhee-store/blob/main/product_service/database.py"
click node_orders "https://github.com/chandan-me/dhee-store/blob/main/order_service/main.py"
click node_orderdb "https://github.com/chandan-me/dhee-store/blob/main/order_service/database.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_app,node_authui,node_catalogui,node_cartui,node_ordersui,node_adminui,node_profileui,node_productmodal,node_usersmodal,node_api toneBlue
class node_gateway,node_jwt toneAmber
class node_users,node_user_schema,node_user_model toneMint
class node_products,node_orders toneRose
class node_userdb,node_productdb,node_orderdb,node_shopper,node_razorpay toneIndigo
```

## Components

### Storefront

- [App Coordinator](https://github.com/chandan-me/dhee-store/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign-in & Registration](https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/AuthScreen.jsx): `frontend/src/components/AuthScreen.jsx`
- [Catalog & Cart UI](https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/ProductCard.jsx): `frontend/src/components/ProductCard.jsx`
- [Cart Page](https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/CartPage.jsx): `frontend/src/components/CartPage.jsx`
- [Order History](https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/OrdersPage.jsx): `frontend/src/components/OrdersPage.jsx`
- [Admin Dashboard](https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/AdminDashboard.jsx): `frontend/src/components/AdminDashboard.jsx`
- [Profile & User Tools](https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/ProfileModal.jsx): `frontend/src/components/ProfileModal.jsx`
- [Product Editor](https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/ProductModal.jsx): `frontend/src/components/ProductModal.jsx`
- [User Directory](https://github.com/chandan-me/dhee-store/blob/main/frontend/src/components/UsersModal.jsx): `frontend/src/components/UsersModal.jsx`
- [Gateway API Client](https://github.com/chandan-me/dhee-store/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API Gateway

- [JWT Gateway](https://github.com/chandan-me/dhee-store/blob/main/gateway_service/main.py): `gateway_service/main.py`
- [JWT Utilities](https://github.com/chandan-me/dhee-store/blob/main/gateway_service/auth.py): `gateway_service/auth.py`

### User Service

- [Identity & Account API](https://github.com/chandan-me/dhee-store/blob/main/user_service/main.py): `user_service/main.py`
- [User Schemas](https://github.com/chandan-me/dhee-store/blob/main/user_service/schemas.py): `user_service/schemas.py`
- [User Model](https://github.com/chandan-me/dhee-store/blob/main/user_service/models.py): `user_service/models.py`

### Commerce Services

- [Catalog & Inventory API](https://github.com/chandan-me/dhee-store/blob/main/product_service/main.py): `product_service/main.py`
- [Checkout & Orders API](https://github.com/chandan-me/dhee-store/blob/main/order_service/main.py): `order_service/main.py`

### Data Stores

- [Users MySQL](https://github.com/chandan-me/dhee-store/blob/main/user_service/database.py): `user_service/database.py`
- [Products MySQL](https://github.com/chandan-me/dhee-store/blob/main/product_service/database.py): `product_service/database.py`
- [Orders MySQL](https://github.com/chandan-me/dhee-store/blob/main/order_service/database.py): `order_service/database.py`

### Other components

- **Shopper / Admin**
- **Razorpay**

## Connections

- Shopper / Admin → App Coordinator: uses storefront (evidence: `README.md`)
- App Coordinator → Sign-in & Registration: renders (evidence: `frontend/src/App.jsx`)
- App Coordinator → Catalog & Cart UI: renders (evidence: `frontend/src/App.jsx`)
- App Coordinator → Cart Page: renders (evidence: `frontend/src/App.jsx`)
- App Coordinator → Order History: renders (evidence: `frontend/src/App.jsx`)
- App Coordinator → Admin Dashboard: renders (evidence: `frontend/src/App.jsx`)
- App Coordinator → Profile & User Tools: renders (evidence: `frontend/src/App.jsx`)
- App Coordinator → Product Editor: renders (evidence: `frontend/src/App.jsx`)
- App Coordinator → User Directory: renders (evidence: `frontend/src/App.jsx`)
- Sign-in & Registration → App Coordinator: submits credentials (evidence: `frontend/src/components/AuthScreen.jsx`)
- App Coordinator → Gateway API Client: calls API client (evidence: `frontend/src/App.jsx`)
- Gateway API Client → JWT Gateway: sends API requests (evidence: `README.md`)
- JWT Gateway → JWT Utilities: validates tokens (evidence: `gateway_service/main.py`)
- JWT Gateway → Identity & Account API: proxies requests (evidence: `README.md`)
- JWT Gateway → Catalog & Inventory API: proxies requests (evidence: `README.md`)
- JWT Gateway → Checkout & Orders API: proxies requests (evidence: `README.md`)
- Identity & Account API → User Schemas: validates payloads (evidence: `user_service/main.py`)
- Identity & Account API → User Model: queries users (evidence: `user_service/main.py`)
- Identity & Account API → Users MySQL: uses database session (evidence: `user_service/main.py`)
- User Model → Users MySQL: uses ORM base (evidence: `user_service/models.py`)
- Checkout & Orders API → Orders MySQL: uses database session (evidence: `order_service/main.py`)
- Checkout & Orders API → Identity & Account API: verifies user (evidence: `order_service/main.py`)
- Checkout & Orders API → Catalog & Inventory API: checks and adjusts stock (evidence: `order_service/main.py`)
- Catalog & Inventory API → Products MySQL: uses database session (evidence: `product_service/main.py`)
- Catalog & Inventory API → Checkout & Orders API: checks order references (evidence: `product_service/main.py`)
- Identity & Account API → Checkout & Orders API: checks orders before deletion (evidence: `user_service/main.py`)
- Checkout & Orders API → Razorpay: creates and verifies payments (evidence: `README.md`)
