# hoangnhattruyen/24ct1-hoangnhattruyen architecture

> Architecture diagram of the GitHub repository hoangnhattruyen/24ct1-hoangnhattruyen, 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/hoangnhattruyen/24ct1-hoangnhattruyen
- Repository: https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen

## Overview

This Django e-commerce application serves a mother-and-baby storefront, with customer shopping and checkout as its main workflow: customers browse and search the catalog, manage a cart, apply vouchers, and place orders. Separate capabilities cover account and address management, flash sales and banners, store locations, AI/staff chat, and staff administration. Django models provide the domain and persistence layer; the README identifies Supabase PostgreSQL as the database, though the sampled code does not show its connection configuration. Some capability links are documented rather than verified in sampled implementation.

Main entry points: [`apps/products/models.py`](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/products/models.py) (Product Catalog and Reviews), [`apps/orders/views.py`](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/orders/views.py) (Cart and Checkout), [`apps/orders/models.py`](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/orders/models.py) (Cart and Order Records), [`apps/dashboard/views.py`](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/dashboard/views.py) (Staff and Admin Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shopping["Shopping"]
  node_product_pages["Catalog and Product Pages<br/>[views.py]"]
  node_promotions[("Banners and Promotions<br/>[models.py]")]
  node_promotion_views["Promotion Views<br/>[views.py]"]
  node_cart_checkout["Cart and Checkout<br/>[views.py]"]
  node_storefront_js["Storefront JavaScript<br/>[main.js]"]
end

subgraph group_accounts_support["Accounts and Support"]
  node_account_views["Account Management<br/>[views.py]"]
  node_chat_views["Chat Support<br/>[views.py]"]
  node_ai_advisor["AI Product Advisor<br/>[ai_advisor.py]"]
end

subgraph group_operations["Store Operations"]
  node_dashboard["Staff and Admin Dashboard<br/>[views.py]"]
  node_store_views["Store Location Views<br/>[views.py]"]
end

subgraph group_shared["Shared Commerce Data"]
  node_catalog_data[("Product Catalog and Reviews<br/>[models.py]")]
  node_order_data[("Cart and Order Records<br/>[models.py]")]
  node_account_data[("Profiles and Addresses<br/>[models.py]")]
  node_chat_data[("Chat Sessions and Messages<br/>[models.py]")]
  node_store_data[("Store Locations<br/>[models.py]")]
  node_global_context["Shared Storefront Context"]
end

node_customer(("Customer"))
node_supabase[("Supabase PostgreSQL")]

node_customer -->|"browses"| node_product_pages
node_product_pages -->|"queries catalog"| node_catalog_data
node_product_pages -->|"loads promotions"| node_promotion_views
node_promotion_views -->|"queries promotions"| node_promotions
node_customer -->|"manages cart"| node_cart_checkout
node_cart_checkout -->|"loads products"| node_catalog_data
node_cart_checkout -->|"checks vouchers"| node_promotions
node_cart_checkout -->|"loads addresses"| node_account_data
node_cart_checkout -->|"creates orders"| node_order_data
node_customer -->|"registers or signs in"| node_account_views
node_account_views -->|"manages profile"| node_account_data
node_customer -->|"requests advice"| node_chat_views
node_chat_views -->|"stores messages"| node_chat_data
node_chat_views -->|"requests response"| node_ai_advisor
node_ai_advisor -->|"finds products"| node_catalog_data
node_dashboard -->|"updates orders"| node_order_data
node_dashboard -->|"handles chats"| node_chat_data
node_dashboard -->|"reports inventory"| node_catalog_data
node_customer -->|"finds stores"| node_store_views
node_store_views -->|"queries locations"| node_store_data
node_global_context -->|"loads categories"| node_catalog_data
node_global_context -->|"counts cart items"| node_order_data
node_global_context -->|"counts stores"| node_store_data
node_customer -.->|"uses storefront"| node_storefront_js
node_catalog_data -.->|"persists data"| node_supabase
node_order_data -.->|"persists data"| node_supabase
node_account_data -.->|"persists data"| node_supabase
node_chat_data -.->|"persists data"| node_supabase
node_promotions -.->|"persists data"| node_supabase
node_store_data -.->|"persists data"| node_supabase

click node_product_pages "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/products/views.py"
click node_catalog_data "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/products/models.py"
click node_promotions "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/promotions/models.py"
click node_promotion_views "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/promotions/views.py"
click node_cart_checkout "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/orders/views.py"
click node_order_data "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/orders/models.py"
click node_account_views "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/accounts/views.py"
click node_account_data "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/accounts/models.py"
click node_chat_views "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/chat/views.py"
click node_chat_data "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/chat/models.py"
click node_ai_advisor "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/chat/ai_advisor.py"
click node_dashboard "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/dashboard/views.py"
click node_store_views "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/stores/views.py"
click node_store_data "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/stores/models.py"
click node_global_context "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/ecommerce_core/context_processors.py"
click node_storefront_js "https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/static/js/main.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_product_pages,node_promotions,node_promotion_views,node_cart_checkout,node_storefront_js toneBlue
class node_account_views,node_chat_views,node_ai_advisor,node_supabase toneAmber
class node_dashboard,node_store_views toneMint
class node_catalog_data,node_order_data,node_account_data,node_chat_data,node_store_data,node_global_context toneRose
class node_customer toneIndigo
```

## Components

### Shopping

- [Catalog and Product Pages](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/products/views.py): `apps/products/views.py`
- [Banners and Promotions](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/promotions/models.py): `apps/promotions/models.py`
- [Promotion Views](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/promotions/views.py): `apps/promotions/views.py`
- [Cart and Checkout](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/orders/views.py): `apps/orders/views.py`
- [Storefront JavaScript](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/static/js/main.js): `static/js/main.js`

### Accounts and Support

- [Account Management](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/accounts/views.py): `apps/accounts/views.py`
- [Chat Support](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/chat/views.py): `apps/chat/views.py`
- [AI Product Advisor](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/chat/ai_advisor.py): `apps/chat/ai_advisor.py`

### Store Operations

- [Staff and Admin Dashboard](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/dashboard/views.py): `apps/dashboard/views.py`
- [Store Location Views](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/stores/views.py): `apps/stores/views.py`

### Shared Commerce Data

- [Product Catalog and Reviews](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/products/models.py): `apps/products/models.py`
- [Cart and Order Records](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/orders/models.py): `apps/orders/models.py`
- [Profiles and Addresses](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/accounts/models.py): `apps/accounts/models.py`
- [Chat Sessions and Messages](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/chat/models.py): `apps/chat/models.py`
- [Store Locations](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/apps/stores/models.py): `apps/stores/models.py`
- [Shared Storefront Context](https://github.com/hoangnhattruyen/24ct1-hoangnhattruyen/blob/main/ecommerce_core/context_processors.py): `ecommerce_core/context_processors.py`

### Other components

- **Customer**
- **Supabase PostgreSQL**

## Connections

- Customer → Catalog and Product Pages: browses
- Catalog and Product Pages → Product Catalog and Reviews: queries catalog (evidence: `apps/products/views.py`)
- Catalog and Product Pages → Promotion Views: loads promotions (evidence: `apps/products/views.py`)
- Promotion Views → Banners and Promotions: queries promotions (evidence: `apps/promotions/views.py`)
- Customer → Cart and Checkout: manages cart
- Cart and Checkout → Product Catalog and Reviews: loads products (evidence: `apps/orders/views.py`)
- Cart and Checkout → Banners and Promotions: checks vouchers (evidence: `apps/orders/views.py`)
- Cart and Checkout → Profiles and Addresses: loads addresses (evidence: `apps/orders/views.py`)
- Cart and Checkout → Cart and Order Records: creates orders (evidence: `apps/orders/views.py`)
- Customer → Account Management: registers or signs in
- Account Management → Profiles and Addresses: manages profile (evidence: `apps/accounts/views.py`)
- Customer → Chat Support: requests advice
- Chat Support → Chat Sessions and Messages: stores messages (evidence: `apps/chat/views.py`)
- Chat Support → AI Product Advisor: requests response (evidence: `apps/chat/views.py`)
- AI Product Advisor → Product Catalog and Reviews: finds products (evidence: `apps/chat/ai_advisor.py`)
- Staff and Admin Dashboard → Cart and Order Records: updates orders (evidence: `apps/dashboard/views.py`)
- Staff and Admin Dashboard → Chat Sessions and Messages: handles chats (evidence: `apps/dashboard/views.py`)
- Staff and Admin Dashboard → Product Catalog and Reviews: reports inventory (evidence: `apps/dashboard/views.py`)
- Customer → Store Location Views: finds stores
- Store Location Views → Store Locations: queries locations (evidence: `apps/stores/views.py`)
- Shared Storefront Context → Product Catalog and Reviews: loads categories (evidence: `ecommerce_core/context_processors.py`)
- Shared Storefront Context → Cart and Order Records: counts cart items (evidence: `ecommerce_core/context_processors.py`)
- Shared Storefront Context → Store Locations: counts stores (evidence: `ecommerce_core/context_processors.py`)
- Customer → Storefront JavaScript: uses storefront (evidence: `README.md`)
- Product Catalog and Reviews → Supabase PostgreSQL: persists data (evidence: `README.md`)
- Cart and Order Records → Supabase PostgreSQL: persists data (evidence: `README.md`)
- Profiles and Addresses → Supabase PostgreSQL: persists data (evidence: `README.md`)
- Chat Sessions and Messages → Supabase PostgreSQL: persists data (evidence: `README.md`)
- Banners and Promotions → Supabase PostgreSQL: persists data (evidence: `README.md`)
- Store Locations → Supabase PostgreSQL: persists data (evidence: `README.md`)
