# youssefelkhafif/morroco_shop architecture

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

- Interactive diagram: https://gitdiagram.com/youssefelkhafif/morroco_shop
- Repository: https://github.com/youssefelkhafif/morroco_shop

## Overview

This is a Laravel/Inertia storefront and commerce back office. Shoppers browse products, build a session cart, and submit a cash-on-delivery checkout; staff manage catalog content and progress orders through fulfillment. The map includes the product/order domain and admin capabilities listed in the tree. The README is empty, so coverage and relationships rely on the source index and excerpts; unsampled controllers and routes are represented only where their role is evident, without inferred call chains.

Main entry points: [`app/Http/Controllers/Shop/CheckoutController.php`](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Http/Controllers/Shop/CheckoutController.php) (Checkout), [`app/Services/Orders/OrderService.php`](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Services/Orders/OrderService.php) (Order lifecycle), [`app/Http/Controllers/Admin/OrderController.php`](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Http/Controllers/Admin/OrderController.php) (Order operations), [`app/Models/Product.php`](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Models/Product.php) (Products and taxonomy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Shopper storefront"]
  node_shop_browse["Browse catalog"]
  node_shop_home["Home and collections"]
  node_cart["Session cart<br/>[CartService.php]"]
  node_checkout["Checkout"]
  node_shop_ui["Storefront pages"]
end

subgraph group_operations["Commerce operations"]
  node_admin_catalog["Catalog management"]
  node_admin_orders["Order operations"]
  node_admin_other["Store configuration"]
  node_admin_ui["Admin pages"]
  node_image_service["Product images"]
end

subgraph group_domain["Commerce domain"]
  node_catalog[("Products and taxonomy<br/>[Product.php]")]
  node_orders[("Orders and line items<br/>[Order.php]")]
  node_delivery[("Delivery zones<br/>[DeliveryZone.php]")]
  node_order_service["Order lifecycle<br/>[OrderService.php]"]
  node_confirmation["Order confirmation notice"]
  node_whatsapp["WhatsApp notifications"]
end

subgraph group_platform["Web platform"]
  node_web_entry["Laravel request entry<br/>[index.php]"]
  node_middleware["Web middleware"]
  node_inertia["Inertia frontend shell<br/>[app.jsx]"]
  node_session[("Session store")]
end

node_shopper(("Shopper"))
node_admin(("Store staff"))
node_pixel["Meta conversion API"]

node_shopper -->|"requests pages"| node_web_entry
node_web_entry -->|"applies middleware"| node_middleware
node_middleware -.->|"shares page data"| node_inertia
node_shop_browse -->|"queries products"| node_catalog
node_shop_home -.->|"renders pages"| node_shop_ui
node_shop_browse -->|"updates cart"| node_cart
node_cart -->|"loads products"| node_catalog
node_cart -->|"stores cart"| node_session
node_checkout -->|"summarizes cart"| node_cart
node_checkout -->|"loads active zones"| node_delivery
node_checkout -->|"creates order"| node_order_service
node_checkout -.->|"sends purchase event"| node_pixel
node_checkout -->|"renders checkout"| node_shop_ui
node_shopper -.->|"submits checkout"| node_checkout
node_admin -.->|"manages catalog"| node_admin_catalog
node_admin_catalog -->|"creates and updates"| node_catalog
node_admin_catalog -->|"manages images"| node_image_service
node_image_service -->|"persists image records"| node_catalog
node_admin_catalog -->|"renders product pages"| node_admin_ui
node_admin_other -.->|"renders admin pages"| node_admin_ui
node_admin -.->|"manages fulfillment"| node_admin_orders
node_admin_orders -->|"loads order details"| node_orders
node_admin_orders -->|"changes order state"| node_order_service
node_admin_orders -->|"renders order pages"| node_admin_ui
node_order_service -->|"checks stock"| node_catalog
node_order_service -->|"creates and transitions"| node_orders
node_order_service -->|"uses delivery zone"| node_delivery
node_order_service -->|"notifies customer"| node_confirmation
node_admin_orders -.->|"triggers messaging"| node_whatsapp

click node_shop_browse "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Http/Controllers/Shop/ProductController.php"
click node_shop_home "https://github.com/youssefelkhafif/morroco_shop/tree/main/app/Http/Controllers/Shop"
click node_cart "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Services/Shop/CartService.php"
click node_checkout "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Http/Controllers/Shop/CheckoutController.php"
click node_shop_ui "https://github.com/youssefelkhafif/morroco_shop/tree/main/resources/js/pages/shop"
click node_admin_catalog "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Http/Controllers/Admin/ProductController.php"
click node_admin_orders "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Http/Controllers/Admin/OrderController.php"
click node_admin_other "https://github.com/youssefelkhafif/morroco_shop/tree/main/app/Http/Controllers/Admin"
click node_admin_ui "https://github.com/youssefelkhafif/morroco_shop/tree/main/resources/js/pages/admin"
click node_image_service "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Services/ProductImageService.php"
click node_catalog "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Models/Product.php"
click node_orders "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Models/Order.php"
click node_delivery "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Models/DeliveryZone.php"
click node_order_service "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Services/Orders/OrderService.php"
click node_confirmation "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Notifications/OrderConfirmedNotification.php"
click node_whatsapp "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Services/Orders/WhatsAppNotificationService.php"
click node_web_entry "https://github.com/youssefelkhafif/morroco_shop/blob/main/public/index.php"
click node_middleware "https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Http/Middleware/HandleInertiaRequests.php"
click node_inertia "https://github.com/youssefelkhafif/morroco_shop/blob/main/resources/js/app.jsx"

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_shop_browse,node_shop_home,node_cart,node_checkout,node_shop_ui toneBlue
class node_admin_catalog,node_admin_orders,node_admin_other,node_admin_ui,node_image_service toneAmber
class node_catalog,node_orders,node_delivery,node_order_service,node_confirmation,node_whatsapp,node_pixel toneMint
class node_web_entry,node_middleware,node_inertia,node_session toneRose
class node_shopper,node_admin toneIndigo
```

## Components

### Shopper storefront

- [Browse catalog](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Http/Controllers/Shop/ProductController.php): `app/Http/Controllers/Shop/ProductController.php`
- [Home and collections](https://github.com/youssefelkhafif/morroco_shop/tree/main/app/Http/Controllers/Shop): `app/Http/Controllers/Shop`
- [Session cart](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Services/Shop/CartService.php): `app/Services/Shop/CartService.php`
- [Checkout](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Http/Controllers/Shop/CheckoutController.php): `app/Http/Controllers/Shop/CheckoutController.php`
- [Storefront pages](https://github.com/youssefelkhafif/morroco_shop/tree/main/resources/js/pages/shop): `resources/js/pages/shop`

### Commerce operations

- [Catalog management](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Http/Controllers/Admin/ProductController.php): `app/Http/Controllers/Admin/ProductController.php`
- [Order operations](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Http/Controllers/Admin/OrderController.php): `app/Http/Controllers/Admin/OrderController.php`
- [Store configuration](https://github.com/youssefelkhafif/morroco_shop/tree/main/app/Http/Controllers/Admin): `app/Http/Controllers/Admin`
- [Admin pages](https://github.com/youssefelkhafif/morroco_shop/tree/main/resources/js/pages/admin): `resources/js/pages/admin`
- [Product images](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Services/ProductImageService.php): `app/Services/ProductImageService.php`

### Commerce domain

- [Products and taxonomy](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Models/Product.php): `app/Models/Product.php`
- [Orders and line items](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Models/Order.php): `app/Models/Order.php`
- [Delivery zones](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Models/DeliveryZone.php): `app/Models/DeliveryZone.php`
- [Order lifecycle](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Services/Orders/OrderService.php): `app/Services/Orders/OrderService.php`
- [Order confirmation notice](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Notifications/OrderConfirmedNotification.php): `app/Notifications/OrderConfirmedNotification.php`
- [WhatsApp notifications](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Services/Orders/WhatsAppNotificationService.php): `app/Services/Orders/WhatsAppNotificationService.php`

### Web platform

- [Laravel request entry](https://github.com/youssefelkhafif/morroco_shop/blob/main/public/index.php): `public/index.php`
- [Web middleware](https://github.com/youssefelkhafif/morroco_shop/blob/main/app/Http/Middleware/HandleInertiaRequests.php): `app/Http/Middleware/HandleInertiaRequests.php`
- [Inertia frontend shell](https://github.com/youssefelkhafif/morroco_shop/blob/main/resources/js/app.jsx): `resources/js/app.jsx`
- **Session store**

### Other components

- **Shopper**
- **Store staff**
- **Meta conversion API**

## Connections

- Shopper → Laravel request entry: requests pages
- Laravel request entry → Web middleware: applies middleware
- Web middleware → Inertia frontend shell: shares page data
- Browse catalog → Products and taxonomy: queries products (evidence: `app/Http/Controllers/Shop/ProductController.php`)
- Home and collections → Storefront pages: renders pages
- Browse catalog → Session cart: updates cart (evidence: `app/Http/Controllers/Shop/ProductController.php`)
- Session cart → Products and taxonomy: loads products (evidence: `app/Services/Shop/CartService.php`)
- Session cart → Session store: stores cart (evidence: `app/Services/Shop/CartService.php`)
- Checkout → Session cart: summarizes cart (evidence: `app/Http/Controllers/Shop/CheckoutController.php`)
- Checkout → Delivery zones: loads active zones (evidence: `app/Http/Controllers/Shop/CheckoutController.php`)
- Checkout → Order lifecycle: creates order (evidence: `app/Http/Controllers/Shop/CheckoutController.php`)
- Checkout → Meta conversion API: sends purchase event (evidence: `app/Http/Controllers/Shop/CheckoutController.php`)
- Checkout → Storefront pages: renders checkout (evidence: `app/Http/Controllers/Shop/CheckoutController.php`)
- Shopper → Checkout: submits checkout
- Store staff → Catalog management: manages catalog
- Catalog management → Products and taxonomy: creates and updates (evidence: `app/Http/Controllers/Admin/ProductController.php`)
- Catalog management → Product images: manages images (evidence: `app/Http/Controllers/Admin/ProductController.php`)
- Product images → Products and taxonomy: persists image records (evidence: `app/Services/ProductImageService.php`)
- Catalog management → Admin pages: renders product pages (evidence: `app/Http/Controllers/Admin/ProductController.php`)
- Store configuration → Admin pages: renders admin pages
- Store staff → Order operations: manages fulfillment
- Order operations → Orders and line items: loads order details (evidence: `app/Http/Controllers/Admin/OrderController.php`)
- Order operations → Order lifecycle: changes order state (evidence: `app/Http/Controllers/Admin/OrderController.php`)
- Order operations → Admin pages: renders order pages (evidence: `app/Http/Controllers/Admin/OrderController.php`)
- Order lifecycle → Products and taxonomy: checks stock (evidence: `app/Services/Orders/OrderService.php`)
- Order lifecycle → Orders and line items: creates and transitions (evidence: `app/Services/Orders/OrderService.php`)
- Order lifecycle → Delivery zones: uses delivery zone (evidence: `app/Services/Orders/OrderService.php`)
- Order lifecycle → Order confirmation notice: notifies customer (evidence: `app/Services/Orders/OrderService.php`)
- Order operations → WhatsApp notifications: triggers messaging
