# quangvinh14072006/zingshop architecture

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

- Interactive diagram: https://gitdiagram.com/quangvinh14072006/zingshop
- Repository: https://github.com/quangvinh14072006/zingshop

## Overview

This is a storefront with a React web client and a Laravel backend. The visible customer journey is route selection into home, product-list, and product-detail pages; cart, login, and registration are separate routes. The backend exposes product listing and detail controller actions and defines user, cart, product, and order domain models. The sampled files do not show checkout, authentication API calls, or how the frontend fetches backend data, so those connections are not asserted. Several frontend page capabilities are represented from the route map and source index rather than inspected implementations.

Main entry points: [`frontend/src/routes/AppRoutes.jsx`](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/routes/AppRoutes.jsx) (Page routes), [`backend/app/Models/Product.php`](https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/Product.php) (Products), [`backend/app/Models/Order.php`](https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/Order.php) (Orders), [`backend/app/Models/OrderItem.php`](https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/OrderItem.php) (Order items)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Client app<br/>[App.jsx]"]
  node_auth["Auth state<br/>[AuthContext.jsx]"]
  node_routes["Page routes<br/>[AppRoutes.jsx]"]
  node_layout["Main layout<br/>[MainLayout.jsx]"]
  node_home["Home page<br/>[HomePage.jsx]"]
  node_product_list["Product listing<br/>[ProductsPage.jsx]"]
  node_product_detail["Product detail"]
  node_cart_page["Cart page<br/>[CartPage.jsx]"]
  node_login["Login page<br/>[LoginPage.jsx]"]
  node_register["Registration page<br/>[RegisterPage.jsx]"]
  node_not_found["Not found<br/>[NotFoundPage.jsx]"]
  node_api_client["HTTP client<br/>[axiosClient.js]"]
end

subgraph group_catalog["Product catalog"]
  node_product_controller["Product API"]
  node_products[("Products<br/>[Product.php]")]
  node_categories[("Categories<br/>[Category.php]")]
end

subgraph group_commerce["Commerce domain"]
  node_users[("Users<br/>[User.php]")]
  node_carts[("Carts<br/>[Cart.php]")]
  node_cart_items[("Cart items<br/>[CartItem.php]")]
  node_orders[("Orders<br/>[Order.php]")]
  node_order_items[("Order items<br/>[OrderItem.php]")]
end

subgraph group_backend["Backend routing"]
  node_backend_boot["Backend bootstrap<br/>[app.php]"]
  node_web_routes["Web routes<br/>[web.php]"]
  node_api_routes["API routes<br/>[api.php]"]
end

node_shopper(("Shopper"))
node_browser["Browser"]
node_api_caller(("API caller"))

node_shopper -->|"uses"| node_browser
node_browser -->|"opens"| node_app
node_app -->|"provides state"| node_auth
node_app -->|"renders"| node_routes
node_routes -->|"routes to"| node_layout
node_routes -->|"routes to"| node_home
node_routes -->|"routes to"| node_product_list
node_routes -->|"routes to"| node_product_detail
node_routes -->|"routes to"| node_cart_page
node_routes -->|"routes to"| node_login
node_routes -->|"routes to"| node_register
node_routes -->|"routes to"| node_not_found
node_layout -->|"reads state"| node_auth
node_api_caller -.->|"requests"| node_api_routes
node_backend_boot -->|"loads routes"| node_web_routes
node_backend_boot -->|"loads routes"| node_api_routes
node_web_routes -->|"references"| node_product_controller
node_product_controller -->|"queries"| node_products
node_products -->|"belongs to"| node_categories
node_products -->|"has many"| node_cart_items
node_products -->|"has many"| node_order_items
node_users -->|"has one"| node_carts
node_users -->|"has many"| node_orders
node_cart_items -->|"belongs to"| node_carts
node_cart_items -->|"belongs to"| node_products
node_orders -->|"belongs to"| node_users
node_orders -->|"has many"| node_order_items
node_order_items -->|"belongs to"| node_orders
node_order_items -->|"belongs to"| node_products

click node_app "https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/App.jsx"
click node_auth "https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/contexts/AuthContext.jsx"
click node_routes "https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/routes/AppRoutes.jsx"
click node_layout "https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/layouts/MainLayout.jsx"
click node_home "https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/HomePage.jsx"
click node_product_list "https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/ProductsPage.jsx"
click node_product_detail "https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/ProductDetailPage.jsx"
click node_cart_page "https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/CartPage.jsx"
click node_login "https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/LoginPage.jsx"
click node_register "https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/RegisterPage.jsx"
click node_not_found "https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/NotFoundPage.jsx"
click node_api_client "https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/services/axiosClient.js"
click node_backend_boot "https://github.com/quangvinh14072006/zingshop/blob/main/backend/bootstrap/app.php"
click node_web_routes "https://github.com/quangvinh14072006/zingshop/blob/main/backend/routes/web.php"
click node_api_routes "https://github.com/quangvinh14072006/zingshop/blob/main/backend/routes/api.php"
click node_product_controller "https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Http/Controllers/Api/ProductController.php"
click node_products "https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/Product.php"
click node_categories "https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/Category.php"
click node_users "https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/User.php"
click node_carts "https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/Cart.php"
click node_cart_items "https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/CartItem.php"
click node_orders "https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/Order.php"
click node_order_items "https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/OrderItem.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_app,node_auth,node_routes,node_layout,node_home,node_product_list,node_product_detail,node_cart_page,node_login,node_register,node_not_found,node_api_client,node_browser toneBlue
class node_product_controller,node_products,node_categories toneAmber
class node_users,node_carts,node_cart_items,node_orders,node_order_items,node_api_caller toneMint
class node_backend_boot,node_web_routes,node_api_routes toneRose
class node_shopper toneIndigo
```

## Components

### Web client

- [Client app](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth state](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/contexts/AuthContext.jsx): `frontend/src/contexts/AuthContext.jsx`
- [Page routes](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/routes/AppRoutes.jsx): `frontend/src/routes/AppRoutes.jsx`
- [Main layout](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/layouts/MainLayout.jsx): `frontend/src/layouts/MainLayout.jsx`
- [Home page](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [Product listing](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/ProductsPage.jsx): `frontend/src/pages/ProductsPage.jsx`
- [Product detail](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/ProductDetailPage.jsx): `frontend/src/pages/ProductDetailPage.jsx`
- [Cart page](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/CartPage.jsx): `frontend/src/pages/CartPage.jsx`
- [Login page](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Registration page](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/RegisterPage.jsx): `frontend/src/pages/RegisterPage.jsx`
- [Not found](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/pages/NotFoundPage.jsx): `frontend/src/pages/NotFoundPage.jsx`
- [HTTP client](https://github.com/quangvinh14072006/zingshop/blob/main/frontend/src/services/axiosClient.js): `frontend/src/services/axiosClient.js`

### Product catalog

- [Product API](https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Http/Controllers/Api/ProductController.php): `backend/app/Http/Controllers/Api/ProductController.php`
- [Products](https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/Product.php): `backend/app/Models/Product.php`
- [Categories](https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/Category.php): `backend/app/Models/Category.php`

### Commerce domain

- [Users](https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/User.php): `backend/app/Models/User.php`
- [Carts](https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/Cart.php): `backend/app/Models/Cart.php`
- [Cart items](https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/CartItem.php): `backend/app/Models/CartItem.php`
- [Orders](https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/Order.php): `backend/app/Models/Order.php`
- [Order items](https://github.com/quangvinh14072006/zingshop/blob/main/backend/app/Models/OrderItem.php): `backend/app/Models/OrderItem.php`

### Backend routing

- [Backend bootstrap](https://github.com/quangvinh14072006/zingshop/blob/main/backend/bootstrap/app.php): `backend/bootstrap/app.php`
- [Web routes](https://github.com/quangvinh14072006/zingshop/blob/main/backend/routes/web.php): `backend/routes/web.php`
- [API routes](https://github.com/quangvinh14072006/zingshop/blob/main/backend/routes/api.php): `backend/routes/api.php`

### Other components

- **Shopper**
- **Browser**
- **API caller**

## Connections

- Shopper → Browser: uses
- Browser → Client app: opens
- Client app → Auth state: provides state (evidence: `frontend/src/App.jsx`)
- Client app → Page routes: renders (evidence: `frontend/src/App.jsx`)
- Page routes → Main layout: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Page routes → Home page: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Page routes → Product listing: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Page routes → Product detail: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Page routes → Cart page: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Page routes → Login page: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Page routes → Registration page: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Page routes → Not found: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Main layout → Auth state: reads state (evidence: `frontend/src/layouts/MainLayout.jsx`)
- API caller → API routes: requests
- Backend bootstrap → Web routes: loads routes (evidence: `backend/bootstrap/app.php`)
- Backend bootstrap → API routes: loads routes (evidence: `backend/bootstrap/app.php`)
- Web routes → Product API: references (evidence: `backend/routes/web.php`)
- Product API → Products: queries (evidence: `backend/app/Http/Controllers/Api/ProductController.php`)
- Products → Categories: belongs to (evidence: `backend/app/Models/Product.php`)
- Products → Cart items: has many (evidence: `backend/app/Models/Product.php`)
- Products → Order items: has many (evidence: `backend/app/Models/Product.php`)
- Users → Carts: has one (evidence: `backend/app/Models/User.php`)
- Users → Orders: has many (evidence: `backend/app/Models/User.php`)
- Cart items → Carts: belongs to (evidence: `backend/app/Models/CartItem.php`)
- Cart items → Products: belongs to (evidence: `backend/app/Models/CartItem.php`)
- Orders → Users: belongs to (evidence: `backend/app/Models/Order.php`)
- Orders → Order items: has many (evidence: `backend/app/Models/Order.php`)
- Order items → Orders: belongs to (evidence: `backend/app/Models/OrderItem.php`)
- Order items → Products: belongs to (evidence: `backend/app/Models/OrderItem.php`)
