# trinity-newfed/trinity-style-ai architecture

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

- Interactive diagram: https://gitdiagram.com/trinity-newfed/trinity-style-ai
- Repository: https://github.com/trinity-newfed/trinity-style-ai

## Overview

Trinity Style is a fashion e-commerce platform with account and shopping flows, loyalty features, AI virtual try-on, and AI customer support. The visible search flow renders a search page using database results; the README documents the broader shopping and AI capabilities. Excerpts establish the search and LLM-queue behavior, but not most PHP endpoint wiring or how the Python workers connect to AI modules, so uncertain relationships are omitted or marked dashed.

Main entry points: [`Database/host.php`](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/host.php) (MySQL Store), [`Pages/search.php`](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/search.php) (Search Page), [`Database/worker.py`](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/worker.py) (Chat Worker), [`Database/search.php`](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/search.php) (Product Search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront &amp; Catalog"]
  node_catalog["Catalog &amp; Product Detail<br/>[products.php]"]
  node_search_page["Search Page<br/>[search.php]"]
  node_search_data["Product Search<br/>[search.php]"]
  node_search_results["Search Results<br/>[item.php]"]
  node_navigation["Site Navigation<br/>[sectionMenu.php]"]
  node_site_shell["Shared Site Components<br/>[base.php]"]
end

subgraph group_commerce["Commerce &amp; Accounts"]
  node_account["Registration &amp; Login<br/>[reglog.php]"]
  node_account_actions["Account Actions<br/>[register.php]"]
  node_cart["Cart<br/>[cart.php]"]
  node_checkout["Checkout &amp; Payment<br/>[checkout.php]"]
  node_orders["Orders &amp; History<br/>[order.php]"]
  node_loyalty["Tiers &amp; Vouchers<br/>[userTier.php]"]
end

subgraph group_ai["AI Experiences"]
  node_tryon_ui["Virtual Try-On<br/>[tryon.php]"]
  node_tryon_proxy["Try-On Proxy"]
  node_tryon_model["Image Generation<br/>[generative.py]"]
  node_chat_ui["AI Support Chat<br/>[sectionFooter.php]"]
  node_chat_proxy["Chat Queue Proxy<br/>[llm-proxy.php]"]
  node_chat_worker["Chat Worker<br/>[worker.py]"]
  node_language_model["Language Model<br/>[llm.py]"]
end

subgraph group_platform["Data &amp; Operations"]
  node_queue["Redis AI Queue"]
  node_database[("MySQL Store<br/>[host.php]")]
  node_schema["Commerce &amp; AI Schema<br/>[createdatabase.php]"]
  node_admin["Admin Operations<br/>[admin.php]"]
end

node_shopper(("Shopper"))

node_shopper -->|"searches"| node_search_page
node_search_page -->|"loads results"| node_search_data
node_search_page -->|"renders"| node_search_results
node_search_data -->|"queries"| node_database
node_shopper -.->|"browses"| node_catalog
node_shopper -.->|"registers"| node_account
node_shopper -.->|"shops"| node_cart
node_shopper -->|"tries on"| node_tryon_ui
node_tryon_ui -.->|"requests generation"| node_tryon_proxy
node_tryon_proxy -.->|"requests inference"| node_tryon_model
node_shopper -->|"asks support"| node_chat_ui
node_chat_ui -.->|"requests chat"| node_chat_proxy
node_chat_proxy -->|"enqueues task"| node_queue
node_chat_worker -.->|"processes tasks"| node_queue
node_chat_worker -.->|"requests responses"| node_language_model
node_shopper -.->|"places order"| node_checkout
node_shopper -.->|"views benefits"| node_loyalty
node_checkout -.->|"persists transaction"| node_database
node_orders -.->|"reads order data"| node_database
node_account_actions -.->|"updates accounts"| node_database
node_admin -.->|"manages records"| node_database
node_schema -->|"defines tables"| node_database
node_shopper -->|"navigates"| node_navigation

click node_catalog "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/products.php"
click node_search_page "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/search.php"
click node_search_data "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/search.php"
click node_search_results "https://github.com/trinity-newfed/trinity-style-ai/blob/main/component/search/item.php"
click node_navigation "https://github.com/trinity-newfed/trinity-style-ai/blob/main/component/sectionMenu.php"
click node_site_shell "https://github.com/trinity-newfed/trinity-style-ai/blob/main/component/base.php"
click node_account "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/reglog.php"
click node_account_actions "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/register.php"
click node_cart "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/cart.php"
click node_checkout "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/checkout.php"
click node_orders "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/order.php"
click node_loyalty "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/userTier.php"
click node_tryon_ui "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/tryon.php"
click node_tryon_proxy "https://github.com/trinity-newfed/trinity-style-ai/blob/main/network/generative-proxy.php"
click node_tryon_model "https://github.com/trinity-newfed/trinity-style-ai/blob/main/AI/generative.py"
click node_chat_ui "https://github.com/trinity-newfed/trinity-style-ai/blob/main/component/sectionFooter.php"
click node_chat_proxy "https://github.com/trinity-newfed/trinity-style-ai/blob/main/network/llm-proxy.php"
click node_chat_worker "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/worker.py"
click node_language_model "https://github.com/trinity-newfed/trinity-style-ai/blob/main/AI/llm.py"
click node_database "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/host.php"
click node_schema "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/createdatabase.php"
click node_admin "https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/admin.php"

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_catalog,node_search_page,node_search_data,node_search_results,node_navigation,node_site_shell toneBlue
class node_account,node_account_actions,node_cart,node_checkout,node_orders,node_loyalty toneAmber
class node_tryon_ui,node_tryon_proxy,node_tryon_model,node_chat_ui,node_chat_proxy,node_chat_worker,node_language_model toneMint
class node_queue,node_database,node_schema,node_admin toneRose
class node_shopper toneIndigo
```

## Components

### Storefront & Catalog

- [Catalog & Product Detail](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/products.php): `Pages/products.php`
- [Search Page](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/search.php): `Pages/search.php`
- [Product Search](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/search.php): `Database/search.php`
- [Search Results](https://github.com/trinity-newfed/trinity-style-ai/blob/main/component/search/item.php): `component/search/item.php`
- [Site Navigation](https://github.com/trinity-newfed/trinity-style-ai/blob/main/component/sectionMenu.php): `component/sectionMenu.php`
- [Shared Site Components](https://github.com/trinity-newfed/trinity-style-ai/blob/main/component/base.php): `component/base.php`

### Commerce & Accounts

- [Registration & Login](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/reglog.php): `Pages/reglog.php`
- [Account Actions](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/register.php): `Database/register.php`
- [Cart](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/cart.php): `Pages/cart.php`
- [Checkout & Payment](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/checkout.php): `Database/checkout.php`
- [Orders & History](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/order.php): `Database/order.php`
- [Tiers & Vouchers](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/userTier.php): `Pages/userTier.php`

### AI Experiences

- [Virtual Try-On](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Pages/tryon.php): `Pages/tryon.php`
- [Try-On Proxy](https://github.com/trinity-newfed/trinity-style-ai/blob/main/network/generative-proxy.php): `network/generative-proxy.php`
- [Image Generation](https://github.com/trinity-newfed/trinity-style-ai/blob/main/AI/generative.py): `AI/generative.py`
- [AI Support Chat](https://github.com/trinity-newfed/trinity-style-ai/blob/main/component/sectionFooter.php): `component/sectionFooter.php`
- [Chat Queue Proxy](https://github.com/trinity-newfed/trinity-style-ai/blob/main/network/llm-proxy.php): `network/llm-proxy.php`
- [Chat Worker](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/worker.py): `Database/worker.py`
- [Language Model](https://github.com/trinity-newfed/trinity-style-ai/blob/main/AI/llm.py): `AI/llm.py`

### Data & Operations

- **Redis AI Queue**
- [MySQL Store](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/host.php): `Database/host.php`
- [Commerce & AI Schema](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/createdatabase.php): `Database/createdatabase.php`
- [Admin Operations](https://github.com/trinity-newfed/trinity-style-ai/blob/main/Database/admin.php): `Database/admin.php`

### Other components

- **Shopper**

## Connections

- Shopper → Search Page: searches (evidence: `Pages/search.php`)
- Search Page → Product Search: loads results (evidence: `Pages/search.php`)
- Search Page → Search Results: renders (evidence: `Pages/search.php`)
- Product Search → MySQL Store: queries (evidence: `Database/search.php`)
- Shopper → Catalog & Product Detail: browses
- Shopper → Registration & Login: registers
- Shopper → Cart: shops
- Shopper → Virtual Try-On: tries on
- Virtual Try-On → Try-On Proxy: requests generation
- Try-On Proxy → Image Generation: requests inference
- Shopper → AI Support Chat: asks support
- AI Support Chat → Chat Queue Proxy: requests chat
- Chat Queue Proxy → Redis AI Queue: enqueues task (evidence: `network/llm-proxy.php`)
- Chat Worker → Redis AI Queue: processes tasks
- Chat Worker → Language Model: requests responses
- Shopper → Checkout & Payment: places order
- Shopper → Tiers & Vouchers: views benefits
- Checkout & Payment → MySQL Store: persists transaction
- Orders & History → MySQL Store: reads order data
- Account Actions → MySQL Store: updates accounts
- Admin Operations → MySQL Store: manages records
- Commerce & AI Schema → MySQL Store: defines tables (evidence: `Database/createdatabase.php`)
- Shopper → Site Navigation: navigates (evidence: `component/sectionMenu.php`)
