# husaindaoud/brnadbags architecture

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

- Interactive diagram: https://gitdiagram.com/husaindaoud/brnadbags
- Repository: https://github.com/husaindaoud/brnadbags

## Overview

This is a women’s fashion catalog and inquiry-commerce application: shoppers browse and filter products, build a locally stored inquiry cart, and send an inquiry through WhatsApp rather than paying online. Administrators manage catalog content and settings, and can review orders and reporting. The React client calls a FastAPI API backed by SQLAlchemy models and a relational database. The README documents several capabilities whose individual handlers were not sampled; those are represented at their existing router or page-directory paths, with links limited to documented or indexed evidence.

Main entry points: [`frontend/src/services/api.js`](https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/services/api.js) (API Client), [`backend/app/core/database.py`](https://github.com/husaindaoud/brnadbags/blob/main/backend/app/core/database.py) (SQL Database), [`backend/app/main.py`](https://github.com/husaindaoud/brnadbags/blob/main/backend/app/main.py) (FastAPI Application), [`frontend/src/App.jsx`](https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/App.jsx) (Store Pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_store["Public Storefront"]
  node_public_app["Store Pages<br/>[App.jsx]"]
  node_browse["Browse Products"]
  node_product_detail["Product Details"]
  node_cart["Inquiry Cart<br/>[CartContext.jsx]"]
  node_checkout["Inquiry Checkout<br/>[CheckoutPage.jsx]"]
end

subgraph group_admin["Admin Management"]
  node_admin_pages["Admin Dashboard"]
  node_product_editor["Product Editor"]
  node_reports_ui["Reports and Analytics<br/>[ReportsPage.jsx]"]
end

subgraph group_backend["API and Domain"]
  node_api_app["FastAPI Application<br/>[main.py]"]
  node_catalog_routes["Catalog Management"]
  node_orders_routes["Orders and Promos<br/>[orders.py]"]
  node_insights_routes["Analytics and Reports<br/>[reports.py]"]
  node_auth_routes["Authentication Routes<br/>[auth.py]"]
  node_security["JWT Security<br/>[security.py]"]
  node_domain_models["Store Domain Models"]
  node_product_model["Product Model<br/>[product.py]"]
  node_order_model["Order Model<br/>[order.py]"]
end

subgraph group_platform["Shared Runtime"]
  node_api_client["API Client<br/>[api.js]"]
  node_auth_context["Admin Authentication<br/>[AuthContext.jsx]"]
  node_settings_context["Store Settings"]
  node_database[("SQL Database<br/>[database.py]")]
  node_email["Order Email<br/>[email.py]"]
end

node_shopper(("Shopper"))
node_whatsapp(("WhatsApp"))
node_admin_user(("Administrator"))

node_shopper -->|"browses"| node_public_app
node_public_app -->|"routes to"| node_browse
node_public_app -->|"routes to"| node_product_detail
node_public_app -->|"routes to"| node_checkout
node_browse -->|"requests catalog"| node_api_client
node_product_detail -->|"adds items"| node_cart
node_cart -->|"provides items"| node_checkout
node_checkout -->|"sends inquiry"| node_whatsapp
node_checkout -->|"submits order"| node_api_client
node_admin_user -->|"manages store"| node_admin_pages
node_admin_pages -->|"routes to"| node_product_editor
node_admin_pages -->|"routes to"| node_reports_ui
node_admin_pages -->|"calls API"| node_api_client
node_auth_context -->|"authenticates through"| node_api_client
node_settings_context -->|"loads settings"| node_api_client
node_api_client -->|"HTTP requests"| node_api_app
node_api_app -->|"registers routes"| node_catalog_routes
node_api_app -->|"registers routes"| node_orders_routes
node_api_app -->|"registers routes"| node_insights_routes
node_api_app -->|"registers routes"| node_auth_routes
node_auth_routes -->|"uses tokens"| node_security
node_catalog_routes -->|"queries data"| node_database
node_orders_routes -->|"queries data"| node_database
node_insights_routes -->|"queries data"| node_database
node_security -->|"loads admin"| node_database
node_product_model -->|"maps tables"| node_database
node_order_model -->|"maps tables"| node_database
node_catalog_routes -->|"uses catalog entities"| node_domain_models
node_orders_routes -->|"creates orders"| node_order_model
node_orders_routes -->|"sends notifications"| node_email

click node_public_app "https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/App.jsx"
click node_browse "https://github.com/husaindaoud/brnadbags/tree/main/frontend/src/pages"
click node_product_detail "https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/pages/ProductDetailPage.jsx"
click node_cart "https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/context/CartContext.jsx"
click node_checkout "https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/pages/CheckoutPage.jsx"
click node_admin_pages "https://github.com/husaindaoud/brnadbags/tree/main/frontend/src/pages/admin"
click node_product_editor "https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/pages/admin/ProductFormPage.jsx"
click node_reports_ui "https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/pages/admin/ReportsPage.jsx"
click node_api_client "https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/services/api.js"
click node_auth_context "https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/context/AuthContext.jsx"
click node_settings_context "https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/context/SettingsContext.jsx"
click node_api_app "https://github.com/husaindaoud/brnadbags/blob/main/backend/app/main.py"
click node_catalog_routes "https://github.com/husaindaoud/brnadbags/tree/main/backend/app/routers"
click node_orders_routes "https://github.com/husaindaoud/brnadbags/blob/main/backend/app/routers/orders.py"
click node_insights_routes "https://github.com/husaindaoud/brnadbags/blob/main/backend/app/routers/reports.py"
click node_auth_routes "https://github.com/husaindaoud/brnadbags/blob/main/backend/app/routers/auth.py"
click node_security "https://github.com/husaindaoud/brnadbags/blob/main/backend/app/core/security.py"
click node_domain_models "https://github.com/husaindaoud/brnadbags/tree/main/backend/app/models"
click node_product_model "https://github.com/husaindaoud/brnadbags/blob/main/backend/app/models/product.py"
click node_order_model "https://github.com/husaindaoud/brnadbags/blob/main/backend/app/models/order.py"
click node_database "https://github.com/husaindaoud/brnadbags/blob/main/backend/app/core/database.py"
click node_email "https://github.com/husaindaoud/brnadbags/blob/main/backend/app/core/email.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_public_app,node_browse,node_product_detail,node_cart,node_checkout toneBlue
class node_admin_pages,node_product_editor,node_reports_ui toneAmber
class node_api_app,node_catalog_routes,node_orders_routes,node_insights_routes,node_auth_routes,node_security,node_domain_models,node_product_model,node_order_model toneMint
class node_api_client,node_auth_context,node_settings_context,node_database,node_email toneRose
class node_shopper,node_whatsapp,node_admin_user toneIndigo
```

## Components

### Public Storefront

- [Store Pages](https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Browse Products](https://github.com/husaindaoud/brnadbags/tree/main/frontend/src/pages): `frontend/src/pages`
- [Product Details](https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/pages/ProductDetailPage.jsx): `frontend/src/pages/ProductDetailPage.jsx`
- [Inquiry Cart](https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/context/CartContext.jsx): `frontend/src/context/CartContext.jsx`
- [Inquiry Checkout](https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/pages/CheckoutPage.jsx): `frontend/src/pages/CheckoutPage.jsx`

### Admin Management

- [Admin Dashboard](https://github.com/husaindaoud/brnadbags/tree/main/frontend/src/pages/admin): `frontend/src/pages/admin`
- [Product Editor](https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/pages/admin/ProductFormPage.jsx): `frontend/src/pages/admin/ProductFormPage.jsx`
- [Reports and Analytics](https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/pages/admin/ReportsPage.jsx): `frontend/src/pages/admin/ReportsPage.jsx`

### API and Domain

- [FastAPI Application](https://github.com/husaindaoud/brnadbags/blob/main/backend/app/main.py): `backend/app/main.py`
- [Catalog Management](https://github.com/husaindaoud/brnadbags/tree/main/backend/app/routers): `backend/app/routers`
- [Orders and Promos](https://github.com/husaindaoud/brnadbags/blob/main/backend/app/routers/orders.py): `backend/app/routers/orders.py`
- [Analytics and Reports](https://github.com/husaindaoud/brnadbags/blob/main/backend/app/routers/reports.py): `backend/app/routers/reports.py`
- [Authentication Routes](https://github.com/husaindaoud/brnadbags/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [JWT Security](https://github.com/husaindaoud/brnadbags/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [Store Domain Models](https://github.com/husaindaoud/brnadbags/tree/main/backend/app/models): `backend/app/models`
- [Product Model](https://github.com/husaindaoud/brnadbags/blob/main/backend/app/models/product.py): `backend/app/models/product.py`
- [Order Model](https://github.com/husaindaoud/brnadbags/blob/main/backend/app/models/order.py): `backend/app/models/order.py`

### Shared Runtime

- [API Client](https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Admin Authentication](https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Store Settings](https://github.com/husaindaoud/brnadbags/blob/main/frontend/src/context/SettingsContext.jsx): `frontend/src/context/SettingsContext.jsx`
- [SQL Database](https://github.com/husaindaoud/brnadbags/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Order Email](https://github.com/husaindaoud/brnadbags/blob/main/backend/app/core/email.py): `backend/app/core/email.py`

### Other components

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

## Connections

- Shopper → Store Pages: browses (evidence: `README.md`)
- Store Pages → Browse Products: routes to (evidence: `frontend/src/App.jsx`)
- Store Pages → Product Details: routes to (evidence: `frontend/src/App.jsx`)
- Store Pages → Inquiry Checkout: routes to (evidence: `frontend/src/App.jsx`)
- Browse Products → API Client: requests catalog (evidence: `frontend/src/pages/SearchPage.jsx`)
- Product Details → Inquiry Cart: adds items (evidence: `frontend/src/pages/ProductDetailPage.jsx`)
- Inquiry Cart → Inquiry Checkout: provides items (evidence: `README.md`)
- Inquiry Checkout → WhatsApp: sends inquiry (evidence: `README.md`)
- Inquiry Checkout → API Client: submits order (evidence: `frontend/src/pages/CheckoutPage.jsx`)
- Administrator → Admin Dashboard: manages store (evidence: `README.md`)
- Admin Dashboard → Product Editor: routes to (evidence: `frontend/src/App.jsx`)
- Admin Dashboard → Reports and Analytics: routes to (evidence: `frontend/src/App.jsx`)
- Admin Dashboard → API Client: calls API (evidence: `frontend/src/pages/admin/ReportsPage.jsx`)
- Admin Authentication → API Client: authenticates through (evidence: `frontend/src/context/AuthContext.jsx`)
- Store Settings → API Client: loads settings (evidence: `frontend/src/context/SettingsContext.jsx`)
- API Client → FastAPI Application: HTTP requests (evidence: `README.md`)
- FastAPI Application → Catalog Management: registers routes (evidence: `backend/app/main.py`)
- FastAPI Application → Orders and Promos: registers routes (evidence: `backend/app/main.py`)
- FastAPI Application → Analytics and Reports: registers routes (evidence: `backend/app/main.py`)
- FastAPI Application → Authentication Routes: registers routes (evidence: `backend/app/main.py`)
- Authentication Routes → JWT Security: uses tokens (evidence: `backend/app/routers/auth.py`)
- Catalog Management → SQL Database: queries data (evidence: `backend/app/routers/products.py`)
- Orders and Promos → SQL Database: queries data (evidence: `backend/app/routers/orders.py`)
- Analytics and Reports → SQL Database: queries data (evidence: `backend/app/routers/reports.py`)
- JWT Security → SQL Database: loads admin (evidence: `backend/app/core/security.py`)
- Product Model → SQL Database: maps tables (evidence: `backend/app/models/product.py`)
- Order Model → SQL Database: maps tables (evidence: `backend/app/models/order.py`)
- Catalog Management → Store Domain Models: uses catalog entities (evidence: `backend/app/routers/products.py`)
- Orders and Promos → Order Model: creates orders (evidence: `backend/app/routers/orders.py`)
- Orders and Promos → Order Email: sends notifications (evidence: `backend/app/routers/orders.py`)
