# k1mhoangg/dahttt_warehouse architecture

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

- Interactive diagram: https://gitdiagram.com/k1mhoangg/dahttt_warehouse
- Repository: https://github.com/k1mhoangg/dahttt_warehouse

## Overview

This is a warehouse-management application for product catalog, supplier ordering, warehouse stock operations, sales and returns, and reporting. Users sign in, then role-gated React pages support those tasks through a REST API backed by Flask and SQLAlchemy models. The documented operational flows include FEFO batch selection for exports and sales, and receiving supplier goods into inventory. The graph captures documented frontend-to-API capabilities; several page and route implementations were not sampled, so those links rely on README evidence rather than inspected calls.

Main entry points: [`frontend/src/App.jsx`](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/App.jsx) (Routes and access), [`backend/app/__init__.py`](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/__init__.py) (Flask app setup), [`backend/app/models/__init__.py`](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/models/__init__.py) (SQLAlchemy models), [`backend/app/routes/auth.py`](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/auth.py) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Routes and access<br/>[App.jsx]"]
  node_login["Sign in<br/>[Login.jsx]"]
  node_catalog_ui["Product catalog<br/>[ProductList.jsx]"]
  node_orders_ui["Supplier orders<br/>[SupplierOrders.jsx]"]
  node_warehouse_ui["Warehouse tasks"]
  node_sales_ui["Sales and returns"]
  node_reports_ui["Reports<br/>[Reports.jsx]"]
  node_auth_state["Auth state<br/>[authStore.js]"]
end

subgraph group_api["API capabilities"]
  node_auth_api["Authentication<br/>[auth.py]"]
  node_products_api["Product API<br/>[products.py]"]
  node_orders_api["Orders API<br/>[orders.py]"]
  node_warehouse_api["Warehouse API<br/>[warehouse.py]"]
  node_inventory_api["Inventory API"]
  node_sales_api["Sales API<br/>[sales.py]"]
  node_reports_api["Reports API<br/>[reports.py]"]
end

subgraph group_domain["Inventory domain"]
  node_models["SQLAlchemy models<br/>[__init__.py]"]
  node_mysql[("MySQL database")]
end

subgraph group_infra["Application foundation"]
  node_authz["Role authorization<br/>[auth.py]"]
  node_helpers["Response and ID helpers<br/>[helpers.py]"]
  node_factory["Flask app setup<br/>[__init__.py]"]
end

node_staff(("Staff"))

node_staff -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_catalog_ui
node_app -->|"routes to"| node_orders_ui
node_app -->|"routes to"| node_warehouse_ui
node_app -->|"routes to"| node_sales_ui
node_app -->|"routes to"| node_reports_ui
node_app -->|"checks access"| node_auth_state
node_login -->|"signs in"| node_auth_api
node_catalog_ui -->|"manages products"| node_products_api
node_orders_ui -->|"manages orders"| node_orders_api
node_warehouse_ui -->|"performs operations"| node_warehouse_api
node_warehouse_ui -->|"manages inventory"| node_inventory_api
node_sales_ui -->|"records sales"| node_sales_api
node_sales_ui -->|"submits returns"| node_sales_api
node_reports_ui -->|"requests reports"| node_reports_api
node_factory -->|"registers"| node_auth_api
node_factory -->|"registers"| node_products_api
node_factory -->|"registers"| node_orders_api
node_factory -->|"registers"| node_warehouse_api
node_factory -->|"registers"| node_inventory_api
node_factory -->|"registers"| node_sales_api
node_factory -->|"registers"| node_reports_api
node_auth_api -->|"queries users"| node_models
node_reports_api -->|"queries records"| node_models
node_warehouse_api -->|"updates batches"| node_models
node_inventory_api -->|"queries records"| node_models
node_auth_api -.->|"checks roles"| node_authz
node_warehouse_api -->|"uses responses"| node_helpers
node_reports_api -->|"uses responses"| node_helpers
node_models -->|"persists through ORM"| node_mysql

click node_app "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/pages/Login.jsx"
click node_catalog_ui "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/pages/products/ProductList.jsx"
click node_orders_ui "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/pages/orders/SupplierOrders.jsx"
click node_warehouse_ui "https://github.com/k1mhoangg/dahttt_warehouse/tree/main/frontend/src/pages/warehouse"
click node_sales_ui "https://github.com/k1mhoangg/dahttt_warehouse/tree/main/frontend/src/pages/sales"
click node_reports_ui "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/pages/reports/Reports.jsx"
click node_auth_state "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/store/authStore.js"
click node_auth_api "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/auth.py"
click node_products_api "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/products.py"
click node_orders_api "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/orders.py"
click node_warehouse_api "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/warehouse.py"
click node_inventory_api "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/warehouse_inventory.py"
click node_sales_api "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/sales.py"
click node_reports_api "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/reports.py"
click node_models "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/models/__init__.py"
click node_authz "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/utils/auth.py"
click node_helpers "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/utils/helpers.py"
click node_factory "https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/__init__.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_login,node_catalog_ui,node_orders_ui,node_warehouse_ui,node_sales_ui,node_reports_ui,node_auth_state toneBlue
class node_auth_api,node_products_api,node_orders_api,node_warehouse_api,node_inventory_api,node_sales_api,node_reports_api toneAmber
class node_models,node_mysql toneMint
class node_authz,node_helpers,node_factory toneRose
class node_staff toneIndigo
```

## Components

### Web application

- [Routes and access](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign in](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Product catalog](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/pages/products/ProductList.jsx): `frontend/src/pages/products/ProductList.jsx`
- [Supplier orders](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/pages/orders/SupplierOrders.jsx): `frontend/src/pages/orders/SupplierOrders.jsx`
- [Warehouse tasks](https://github.com/k1mhoangg/dahttt_warehouse/tree/main/frontend/src/pages/warehouse): `frontend/src/pages/warehouse`
- [Sales and returns](https://github.com/k1mhoangg/dahttt_warehouse/tree/main/frontend/src/pages/sales): `frontend/src/pages/sales`
- [Reports](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/pages/reports/Reports.jsx): `frontend/src/pages/reports/Reports.jsx`
- [Auth state](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/frontend/src/store/authStore.js): `frontend/src/store/authStore.js`

### API capabilities

- [Authentication](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/auth.py): `backend/app/routes/auth.py`
- [Product API](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/products.py): `backend/app/routes/products.py`
- [Orders API](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/orders.py): `backend/app/routes/orders.py`
- [Warehouse API](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/warehouse.py): `backend/app/routes/warehouse.py`
- [Inventory API](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/warehouse_inventory.py): `backend/app/routes/warehouse_inventory.py`
- [Sales API](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/sales.py): `backend/app/routes/sales.py`
- [Reports API](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/routes/reports.py): `backend/app/routes/reports.py`

### Inventory domain

- [SQLAlchemy models](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/models/__init__.py): `backend/app/models/__init__.py`
- **MySQL database**

### Application foundation

- [Role authorization](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/utils/auth.py): `backend/app/utils/auth.py`
- [Response and ID helpers](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/utils/helpers.py): `backend/app/utils/helpers.py`
- [Flask app setup](https://github.com/k1mhoangg/dahttt_warehouse/blob/main/backend/app/__init__.py): `backend/app/__init__.py`

### Other components

- **Staff**

## Connections

- Staff → Routes and access: uses (evidence: `frontend/src/App.jsx`)
- Routes and access → Sign in: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Product catalog: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Supplier orders: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Warehouse tasks: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Sales and returns: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Reports: routes to (evidence: `frontend/src/App.jsx`)
- Routes and access → Auth state: checks access (evidence: `frontend/src/App.jsx`)
- Sign in → Authentication: signs in
- Product catalog → Product API: manages products
- Supplier orders → Orders API: manages orders
- Warehouse tasks → Warehouse API: performs operations
- Warehouse tasks → Inventory API: manages inventory
- Sales and returns → Sales API: records sales
- Sales and returns → Sales API: submits returns
- Reports → Reports API: requests reports
- Flask app setup → Authentication: registers (evidence: `backend/app/__init__.py`)
- Flask app setup → Product API: registers (evidence: `backend/app/__init__.py`)
- Flask app setup → Orders API: registers (evidence: `backend/app/__init__.py`)
- Flask app setup → Warehouse API: registers (evidence: `backend/app/__init__.py`)
- Flask app setup → Inventory API: registers (evidence: `backend/app/__init__.py`)
- Flask app setup → Sales API: registers (evidence: `backend/app/__init__.py`)
- Flask app setup → Reports API: registers (evidence: `backend/app/__init__.py`)
- Authentication → SQLAlchemy models: queries users (evidence: `backend/app/routes/auth.py`)
- Reports API → SQLAlchemy models: queries records (evidence: `backend/app/routes/reports.py`)
- Warehouse API → SQLAlchemy models: updates batches (evidence: `backend/app/routes/warehouse.py`)
- Inventory API → SQLAlchemy models: queries records (evidence: `backend/app/routes/warehouse_inventory.py`)
- Authentication → Role authorization: checks roles
- Warehouse API → Response and ID helpers: uses responses (evidence: `backend/app/routes/warehouse.py`)
- Reports API → Response and ID helpers: uses responses (evidence: `backend/app/routes/reports.py`)
- SQLAlchemy models → MySQL database: persists through ORM
