# phmvu102/laravel-ecomerce architecture

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

- Interactive diagram: https://gitdiagram.com/phmvu102/laravel-ecomerce
- Repository: https://github.com/phmvu102/laravel-ecomerce

## Overview

This is a Laravel e-commerce application: shoppers browse products, manage a cart, place orders and pay; staff maintain the catalog and manage orders and users. Authentication and an AI-oriented chat/order-draft feature are additional branches. The graph reflects the supplied source excerpts and index references; several route/controller connections and unsampled capabilities are shown only as unverified, dashed links.

Main entry points: [`public/index.php`](https://github.com/phmvu102/laravel-ecomerce/blob/main/public/index.php) (Web application), [`app/Models/Product.php`](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Product.php) (Products and variants), [`app/Models/Order.php`](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Order.php) (Orders and items), [`app/Models/User.php`](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/User.php) (Users and conversations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_web["Web application<br/>[index.php]"]
  node_catalog["Product browsing"]
  node_product_page["Product detail view<br/>[show.blade.php]"]
end

subgraph group_commerce["Commerce"]
  node_cart["Cart management<br/>[CartController.php]"]
  node_checkout["Checkout and orders"]
  node_payments["Payment handling"]
end

subgraph group_operations["Administration"]
  node_order_admin["Order administration"]
  node_catalog_admin["Catalog administration"]
  node_catalog_taxonomy["Brands and categories"]
  node_attribute_admin["Attribute administration"]
  node_user_admin["User administration<br/>[UserController.php]"]
end

subgraph group_identity["Identity and chat"]
  node_auth["Authentication"]
  node_chat["Chat and draft orders"]
end

subgraph group_domain["Domain data"]
  node_products[("Products and variants<br/>[Product.php]")]
  node_taxonomy[("Brands and categories<br/>[Category.php]")]
  node_attributes[("Product attributes<br/>[Attribute.php]")]
  node_carts[("Carts and items<br/>[Cart.php]")]
  node_orders[("Orders and items<br/>[Order.php]")]
  node_payment_data[("Payment records<br/>[Payment.php]")]
  node_users[("Users and conversations<br/>[User.php]")]
  node_returns[("Return requests<br/>[ReturnRequest.php]")]
end

node_shopper(("Shopper"))
node_staff(("Staff"))

node_shopper -.->|"opens"| node_web
node_staff -.->|"opens"| node_web
node_web -.->|"routes to"| node_catalog
node_web -.->|"routes to"| node_cart
node_web -.->|"routes to"| node_checkout
node_web -.->|"routes to"| node_auth
node_web -.->|"routes to"| node_chat
node_web -.->|"routes to"| node_catalog_admin
node_web -.->|"routes to"| node_order_admin
node_catalog -.->|"queries"| node_products
node_product_page -->|"renders"| node_products
node_product_page -->|"renders"| node_taxonomy
node_product_page -->|"renders"| node_attributes
node_cart -->|"reads and writes"| node_carts
node_checkout -->|"reads and clears"| node_carts
node_checkout -->|"creates"| node_orders
node_checkout -->|"creates"| node_payment_data
node_checkout -->|"updates stock"| node_products
node_payments -->|"uses"| node_orders
node_payments -->|"uses"| node_payment_data
node_order_admin -.->|"uses"| node_orders
node_catalog_admin -->|"creates and updates"| node_products
node_catalog_admin -->|"loads options"| node_taxonomy
node_catalog_admin -->|"loads options"| node_attributes
node_catalog_taxonomy -.->|"manages"| node_taxonomy
node_attribute_admin -.->|"manages"| node_attributes
node_user_admin -->|"manages"| node_users
node_auth -.->|"authenticates"| node_users
node_chat -->|"uses"| node_users
node_chat -->|"creates draft orders"| node_orders
node_chat -->|"resolves items"| node_products
node_chat -->|"creates records"| node_payment_data
node_products -->|"references"| node_taxonomy
node_products -->|"variants reference"| node_attributes
node_carts -->|"belongs to"| node_users
node_orders -->|"belongs to"| node_users
node_orders -->|"has payment"| node_payment_data
node_users -->|"has requests"| node_returns

click node_web "https://github.com/phmvu102/laravel-ecomerce/blob/main/public/index.php"
click node_catalog "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Client/ProductController.php"
click node_product_page "https://github.com/phmvu102/laravel-ecomerce/blob/main/resources/views/client/show.blade.php"
click node_cart "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Client/CartController.php"
click node_checkout "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Client/OrderController.php"
click node_payments "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Client/PaymentController.php"
click node_order_admin "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Admin/OrderController.php"
click node_catalog_admin "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Admin/ProductController.php"
click node_catalog_taxonomy "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Admin/CategoryController.php"
click node_attribute_admin "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Admin/AttributeController.php"
click node_user_admin "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Admin/UserController.php"
click node_auth "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_chat "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/ChatHistoryController.php"
click node_products "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Product.php"
click node_taxonomy "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Category.php"
click node_attributes "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Attribute.php"
click node_carts "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Cart.php"
click node_orders "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Order.php"
click node_payment_data "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Payment.php"
click node_users "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/User.php"
click node_returns "https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/ReturnRequest.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_web,node_catalog,node_product_page toneBlue
class node_cart,node_checkout,node_payments toneAmber
class node_order_admin,node_catalog_admin,node_catalog_taxonomy,node_attribute_admin,node_user_admin toneMint
class node_auth,node_chat toneRose
class node_products,node_taxonomy,node_attributes,node_carts,node_orders,node_payment_data,node_users,node_returns,node_shopper,node_staff toneIndigo
```

## Components

### Storefront

- [Web application](https://github.com/phmvu102/laravel-ecomerce/blob/main/public/index.php): `public/index.php`
- [Product browsing](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Client/ProductController.php): `app/Http/Controllers/Client/ProductController.php`
- [Product detail view](https://github.com/phmvu102/laravel-ecomerce/blob/main/resources/views/client/show.blade.php): `resources/views/client/show.blade.php`

### Commerce

- [Cart management](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Client/CartController.php): `app/Http/Controllers/Client/CartController.php`
- [Checkout and orders](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Client/OrderController.php): `app/Http/Controllers/Client/OrderController.php`
- [Payment handling](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Client/PaymentController.php): `app/Http/Controllers/Client/PaymentController.php`

### Administration

- [Order administration](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Admin/OrderController.php): `app/Http/Controllers/Admin/OrderController.php`
- [Catalog administration](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Admin/ProductController.php): `app/Http/Controllers/Admin/ProductController.php`
- [Brands and categories](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Admin/CategoryController.php): `app/Http/Controllers/Admin/CategoryController.php`
- [Attribute administration](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Admin/AttributeController.php): `app/Http/Controllers/Admin/AttributeController.php`
- [User administration](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Admin/UserController.php): `app/Http/Controllers/Admin/UserController.php`

### Identity and chat

- [Authentication](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php): `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [Chat and draft orders](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Http/Controllers/ChatHistoryController.php): `app/Http/Controllers/ChatHistoryController.php`

### Domain data

- [Products and variants](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Product.php): `app/Models/Product.php`
- [Brands and categories](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Category.php): `app/Models/Category.php`
- [Product attributes](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Attribute.php): `app/Models/Attribute.php`
- [Carts and items](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Cart.php): `app/Models/Cart.php`
- [Orders and items](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Order.php): `app/Models/Order.php`
- [Payment records](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/Payment.php): `app/Models/Payment.php`
- [Users and conversations](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/User.php): `app/Models/User.php`
- [Return requests](https://github.com/phmvu102/laravel-ecomerce/blob/main/app/Models/ReturnRequest.php): `app/Models/ReturnRequest.php`

### Other components

- **Shopper**
- **Staff**

## Connections

- Shopper → Web application: opens
- Staff → Web application: opens
- Web application → Product browsing: routes to
- Web application → Cart management: routes to
- Web application → Checkout and orders: routes to
- Web application → Authentication: routes to
- Web application → Chat and draft orders: routes to
- Web application → Catalog administration: routes to
- Web application → Order administration: routes to
- Product browsing → Products and variants: queries
- Product detail view → Products and variants: renders (evidence: `resources/views/client/show.blade.php`)
- Product detail view → Brands and categories: renders (evidence: `resources/views/client/show.blade.php`)
- Product detail view → Product attributes: renders (evidence: `resources/views/client/show.blade.php`)
- Cart management → Carts and items: reads and writes (evidence: `app/Http/Controllers/Client/CartController.php`)
- Checkout and orders → Carts and items: reads and clears (evidence: `app/Http/Controllers/Client/OrderController.php`)
- Checkout and orders → Orders and items: creates (evidence: `app/Http/Controllers/Client/OrderController.php`)
- Checkout and orders → Payment records: creates (evidence: `app/Http/Controllers/Client/OrderController.php`)
- Checkout and orders → Products and variants: updates stock (evidence: `app/Http/Controllers/Client/OrderController.php`)
- Payment handling → Orders and items: uses (evidence: `app/Http/Controllers/Client/PaymentController.php`)
- Payment handling → Payment records: uses (evidence: `app/Http/Controllers/Client/PaymentController.php`)
- Order administration → Orders and items: uses
- Catalog administration → Products and variants: creates and updates (evidence: `app/Http/Controllers/Admin/ProductController.php`)
- Catalog administration → Brands and categories: loads options (evidence: `app/Http/Controllers/Admin/ProductController.php`)
- Catalog administration → Product attributes: loads options (evidence: `app/Http/Controllers/Admin/ProductController.php`)
- Brands and categories → Brands and categories: manages
- Attribute administration → Product attributes: manages
- User administration → Users and conversations: manages (evidence: `app/Http/Controllers/Admin/UserController.php`)
- Authentication → Users and conversations: authenticates
- Chat and draft orders → Users and conversations: uses (evidence: `app/Http/Controllers/ChatHistoryController.php`)
- Chat and draft orders → Orders and items: creates draft orders (evidence: `app/Http/Controllers/ChatHistoryController.php`)
- Chat and draft orders → Products and variants: resolves items (evidence: `app/Http/Controllers/ChatHistoryController.php`)
- Chat and draft orders → Payment records: creates records (evidence: `app/Http/Controllers/ChatHistoryController.php`)
- Products and variants → Brands and categories: references (evidence: `app/Models/Product.php`)
- Products and variants → Product attributes: variants reference
- Carts and items → Users and conversations: belongs to (evidence: `app/Models/Cart.php`)
- Orders and items → Users and conversations: belongs to (evidence: `app/Models/Order.php`)
- Orders and items → Payment records: has payment (evidence: `app/Models/Order.php`)
- Users and conversations → Return requests: has requests (evidence: `app/Models/User.php`)
