# frontfury/deshi-cart-client architecture

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

- Interactive diagram: https://gitdiagram.com/frontfury/deshi-cart-client
- Repository: https://github.com/frontfury/deshi-cart-client

## Overview

DeshiCart’s checked-in product is a React storefront and account interface; its main user journey is browsing products, adding items to a server-backed cart, and using customer, seller, or admin pages. Firebase provides client authentication, while an authenticated Axios client sends API requests to a separately hosted backend. The README describes broader product, order, admin, and email capabilities, but no backend source is present in this tree. Unsampled capabilities are represented only where the README supports them; implementation details and several API interactions remain unverified.

Main entry points: [`src/hooks/useAxiosSecure.jsx`](https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useAxiosSecure.jsx) (Secure API client), [`src/hooks/useAuth.jsx`](https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useAuth.jsx) (Auth hook), [`src/routes/router.jsx`](https://github.com/frontfury/deshi-cart-client/blob/main/src/routes/router.jsx) (Route map), [`src/hooks/useRole.jsx`](https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useRole.jsx) (Role lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Storefront and routing"]
  node_router["Route map<br/>[router.jsx]"]
  node_storefront["Storefront<br/>[App.jsx]"]
  node_shell["Site shell<br/>[RootLayout.jsx]"]
  node_navigation["Navigation<br/>[Navbar.jsx]"]
  node_footer["Footer<br/>[Footer.jsx]"]
end

subgraph group_identity["Identity and access"]
  node_authpages["Account entry<br/>[App.jsx]"]
  node_authprovider["Auth provider<br/>[AuthProvider.jsx]"]
  node_authcontext["Auth context<br/>[AuthContext.jsx]"]
  node_firebase["Firebase Auth<br/>[firebase.init.js]"]
  node_authhook["Auth hook<br/>[useAuth.jsx]"]
  node_access["Route guards<br/>[RoleRoute.jsx]"]
  node_privateguard["Private guard<br/>[PrivateRoute.jsx]"]
  node_rolelookup["Role lookup<br/>[useRole.jsx]"]
end

subgraph group_commerce["Commerce and accounts"]
  node_productadmin["Product workspace<br/>[AccountPages.jsx]"]
  node_customeraccount["Customer account<br/>[AccountPages.jsx]"]
  node_profilehooks["Profile hooks<br/>[useSaveProfile.jsx]"]
  node_sellerproducts["Seller products"]
  node_createproduct["Product creation"]
  node_usercreate["User sync<br/>[useCreateUser.jsx]"]
end

subgraph group_transport["API access"]
  node_secureclient["Secure API client<br/>[useAxiosSecure.jsx]"]
  node_backend["DeshiCart API"]
end

node_shopper(("Shopper"))

node_shopper -->|"opens pages"| node_router
node_router -->|"uses layout"| node_shell
node_router -->|"routes to"| node_storefront
node_router -->|"protects pages"| node_privateguard
node_router -->|"checks roles"| node_access
node_shell -->|"renders"| node_navigation
node_shell -->|"renders"| node_footer
node_shopper -.->|"signs in"| node_authpages
node_authprovider -->|"provides state"| node_authcontext
node_authprovider -->|"uses auth"| node_firebase
node_authhook -->|"reads context"| node_authcontext
node_privateguard -->|"checks user"| node_authhook
node_access -->|"checks user"| node_authhook
node_access -->|"checks role"| node_rolelookup
node_navigation -->|"loads role"| node_rolelookup
node_rolelookup -->|"reads user"| node_authhook
node_rolelookup -->|"reads token"| node_firebase
node_rolelookup -->|"requests role"| node_secureclient
node_storefront -->|"reads user"| node_authhook
node_storefront -->|"adds cart item"| node_secureclient
node_storefront -->|"syncs user"| node_usercreate
node_customeraccount -->|"saves profile"| node_profilehooks
node_customeraccount -->|"loads commerce data"| node_secureclient
node_customeraccount -->|"reads user"| node_authhook
node_productadmin -->|"creates listing"| node_createproduct
node_productadmin -->|"loads listings"| node_sellerproducts
node_profilehooks -->|"sends profile"| node_secureclient
node_sellerproducts -->|"loads products"| node_secureclient
node_createproduct -->|"submits product"| node_secureclient
node_usercreate -->|"posts user"| node_backend
node_secureclient -->|"gets token"| node_firebase
node_secureclient -->|"logs out on error"| node_authhook
node_secureclient -->|"sends requests"| node_backend
node_backend -.->|"serves commerce APIs"| node_shopper

click node_router "https://github.com/frontfury/deshi-cart-client/blob/main/src/routes/router.jsx"
click node_storefront "https://github.com/frontfury/deshi-cart-client/blob/main/src/App.jsx"
click node_shell "https://github.com/frontfury/deshi-cart-client/blob/main/src/layouts/RootLayout.jsx"
click node_navigation "https://github.com/frontfury/deshi-cart-client/blob/main/src/pages/Shared/Navbar/Navbar.jsx"
click node_footer "https://github.com/frontfury/deshi-cart-client/blob/main/src/pages/Shared/Footer/Footer.jsx"
click node_authpages "https://github.com/frontfury/deshi-cart-client/blob/main/src/App.jsx"
click node_authprovider "https://github.com/frontfury/deshi-cart-client/blob/main/src/context/AuthContext/AuthProvider.jsx"
click node_authcontext "https://github.com/frontfury/deshi-cart-client/blob/main/src/context/AuthContext/AuthContext.jsx"
click node_firebase "https://github.com/frontfury/deshi-cart-client/blob/main/src/firebase/firebase.init.js"
click node_authhook "https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useAuth.jsx"
click node_access "https://github.com/frontfury/deshi-cart-client/blob/main/src/routes/RoleRoute.jsx"
click node_privateguard "https://github.com/frontfury/deshi-cart-client/blob/main/src/routes/PrivateRoute.jsx"
click node_rolelookup "https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useRole.jsx"
click node_productadmin "https://github.com/frontfury/deshi-cart-client/blob/main/src/pages/AccountPages.jsx"
click node_customeraccount "https://github.com/frontfury/deshi-cart-client/blob/main/src/pages/AccountPages.jsx"
click node_profilehooks "https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useSaveProfile.jsx"
click node_sellerproducts "https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useSellerProducts.jsx"
click node_createproduct "https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useCreateProduct.jsx"
click node_usercreate "https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useCreateUser.jsx"
click node_secureclient "https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useAxiosSecure.jsx"

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_router,node_storefront,node_shell,node_navigation,node_footer toneBlue
class node_authpages,node_authprovider,node_authcontext,node_firebase,node_authhook,node_access,node_privateguard,node_rolelookup toneAmber
class node_productadmin,node_customeraccount,node_profilehooks,node_sellerproducts,node_createproduct,node_usercreate toneMint
class node_secureclient,node_backend toneRose
class node_shopper toneIndigo
```

## Components

### Storefront and routing

- [Route map](https://github.com/frontfury/deshi-cart-client/blob/main/src/routes/router.jsx): `src/routes/router.jsx`
- [Storefront](https://github.com/frontfury/deshi-cart-client/blob/main/src/App.jsx): `src/App.jsx`
- [Site shell](https://github.com/frontfury/deshi-cart-client/blob/main/src/layouts/RootLayout.jsx): `src/layouts/RootLayout.jsx`
- [Navigation](https://github.com/frontfury/deshi-cart-client/blob/main/src/pages/Shared/Navbar/Navbar.jsx): `src/pages/Shared/Navbar/Navbar.jsx`
- [Footer](https://github.com/frontfury/deshi-cart-client/blob/main/src/pages/Shared/Footer/Footer.jsx): `src/pages/Shared/Footer/Footer.jsx`

### Identity and access

- [Account entry](https://github.com/frontfury/deshi-cart-client/blob/main/src/App.jsx): `src/App.jsx`
- [Auth provider](https://github.com/frontfury/deshi-cart-client/blob/main/src/context/AuthContext/AuthProvider.jsx): `src/context/AuthContext/AuthProvider.jsx`
- [Auth context](https://github.com/frontfury/deshi-cart-client/blob/main/src/context/AuthContext/AuthContext.jsx): `src/context/AuthContext/AuthContext.jsx`
- [Firebase Auth](https://github.com/frontfury/deshi-cart-client/blob/main/src/firebase/firebase.init.js): `src/firebase/firebase.init.js`
- [Auth hook](https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useAuth.jsx): `src/hooks/useAuth.jsx`
- [Route guards](https://github.com/frontfury/deshi-cart-client/blob/main/src/routes/RoleRoute.jsx): `src/routes/RoleRoute.jsx`
- [Private guard](https://github.com/frontfury/deshi-cart-client/blob/main/src/routes/PrivateRoute.jsx): `src/routes/PrivateRoute.jsx`
- [Role lookup](https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useRole.jsx): `src/hooks/useRole.jsx`

### Commerce and accounts

- [Product workspace](https://github.com/frontfury/deshi-cart-client/blob/main/src/pages/AccountPages.jsx): `src/pages/AccountPages.jsx`
- [Customer account](https://github.com/frontfury/deshi-cart-client/blob/main/src/pages/AccountPages.jsx): `src/pages/AccountPages.jsx`
- [Profile hooks](https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useSaveProfile.jsx): `src/hooks/useSaveProfile.jsx`
- [Seller products](https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useSellerProducts.jsx): `src/hooks/useSellerProducts.jsx`
- [Product creation](https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useCreateProduct.jsx): `src/hooks/useCreateProduct.jsx`
- [User sync](https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useCreateUser.jsx): `src/hooks/useCreateUser.jsx`

### API access

- [Secure API client](https://github.com/frontfury/deshi-cart-client/blob/main/src/hooks/useAxiosSecure.jsx): `src/hooks/useAxiosSecure.jsx`
- **DeshiCart API**

### Other components

- **Shopper**

## Connections

- Shopper → Route map: opens pages (evidence: `src/routes/router.jsx`)
- Route map → Site shell: uses layout (evidence: `src/routes/router.jsx`)
- Route map → Storefront: routes to (evidence: `src/routes/router.jsx`)
- Route map → Private guard: protects pages (evidence: `src/routes/router.jsx`)
- Route map → Route guards: checks roles (evidence: `src/routes/router.jsx`)
- Site shell → Navigation: renders (evidence: `src/layouts/RootLayout.jsx`)
- Site shell → Footer: renders (evidence: `src/layouts/RootLayout.jsx`)
- Shopper → Account entry: signs in
- Auth provider → Auth context: provides state (evidence: `src/context/AuthContext/AuthProvider.jsx`)
- Auth provider → Firebase Auth: uses auth (evidence: `src/context/AuthContext/AuthProvider.jsx`)
- Auth hook → Auth context: reads context (evidence: `src/hooks/useAuth.jsx`)
- Private guard → Auth hook: checks user (evidence: `src/routes/PrivateRoute.jsx`)
- Route guards → Auth hook: checks user (evidence: `src/routes/RoleRoute.jsx`)
- Route guards → Role lookup: checks role (evidence: `src/routes/RoleRoute.jsx`)
- Navigation → Role lookup: loads role (evidence: `src/pages/Shared/Navbar/Navbar.jsx`)
- Role lookup → Auth hook: reads user (evidence: `src/hooks/useRole.jsx`)
- Role lookup → Firebase Auth: reads token (evidence: `src/hooks/useRole.jsx`)
- Role lookup → Secure API client: requests role (evidence: `src/hooks/useRole.jsx`)
- Storefront → Auth hook: reads user (evidence: `src/App.jsx`)
- Storefront → Secure API client: adds cart item (evidence: `src/App.jsx`)
- Storefront → User sync: syncs user (evidence: `src/App.jsx`)
- Customer account → Profile hooks: saves profile (evidence: `src/pages/AccountPages.jsx`)
- Customer account → Secure API client: loads commerce data (evidence: `src/pages/AccountPages.jsx`)
- Customer account → Auth hook: reads user (evidence: `src/pages/AccountPages.jsx`)
- Product workspace → Product creation: creates listing (evidence: `src/pages/AccountPages.jsx`)
- Product workspace → Seller products: loads listings (evidence: `src/pages/AccountPages.jsx`)
- Profile hooks → Secure API client: sends profile (evidence: `src/hooks/useSaveProfile.jsx`)
- Seller products → Secure API client: loads products (evidence: `src/hooks/useSellerProducts.jsx`)
- Product creation → Secure API client: submits product (evidence: `src/hooks/useCreateProduct.jsx`)
- User sync → DeshiCart API: posts user (evidence: `src/hooks/useCreateUser.jsx`)
- Secure API client → Firebase Auth: gets token (evidence: `src/hooks/useAxiosSecure.jsx`)
- Secure API client → Auth hook: logs out on error (evidence: `src/hooks/useAxiosSecure.jsx`)
- Secure API client → DeshiCart API: sends requests (evidence: `src/hooks/useAxiosSecure.jsx`)
- DeshiCart API → Shopper: serves commerce APIs (evidence: `README.md`)
