# karim-galal/fullstack_ecommerce_starter architecture

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

- Interactive diagram: https://gitdiagram.com/karim-galal/fullstack_ecommerce_starter
- Repository: https://github.com/karim-galal/fullstack_ecommerce_starter

## Overview

This is a localized ecommerce storefront and administration system, with a Next.js frontend and Laravel API. The principal purchase workflow is cart contents through checkout calculation, order/payment creation, and gateway initiation; the API also supports catalog management, customer accounts, reviews, promotions, and other commerce operations. The excerpts show checkout and authentication internals, while the API route file documents controller dispatch. Payment processing beyond initiation and most frontend-to-API wiring were not sampled, so those links are omitted.

Main entry points: [`backend/routes/api.php`](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/routes/api.php) (API routes), [`backend/app/Http/Controllers/Api/CheckoutController.php`](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/CheckoutController.php) (Checkout), [`backend/app/Http/Controllers/Api/AuthController.php`](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/AuthController.php) (Authentication), [`backend/app/Models/Cart.php`](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Cart.php) (Cart state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_storefront_ui["Storefront UI<br/>[page.jsx]"]
  node_customer_auth_ui["Customer auth<br/>[page.jsx]"]
  node_admin_ui["Admin login<br/>[page.jsx]"]
end

subgraph group_identity["Accounts"]
  node_auth["Authentication<br/>[AuthController.php]"]
  node_cart_merge["Cart merge"]
  node_users[("User accounts<br/>[User.php]")]
end

subgraph group_commerce["Commerce"]
  node_catalog[("Product catalog<br/>[Product.php]")]
  node_cart_api["Cart API<br/>[CartController.php]"]
  node_cart_state[("Cart state<br/>[Cart.php]")]
  node_checkout["Checkout"]
  node_orders[("Orders<br/>[Order.php]")]
  node_payment_init["Payment initiation"]
  node_payments[("Payment records<br/>[Payment.php]")]
  node_gateway_manager["Gateway manager"]
  node_payment_gateways["Payment gateways"]
end

subgraph group_operations["Commerce operations"]
  node_reviews["Reviews"]
  node_review_state[("Review records<br/>[Review.php]")]
  node_promotions[("Coupons and offers<br/>[Coupon.php]")]
  node_invitations["Invitations"]
  node_addresses["Addresses"]
  node_other_catalog_api["Catalog APIs"]
end

node_shopper(("Shopper"))
node_api_routes["API routes<br/>[api.php]"]

node_shopper -.->|"browses"| node_storefront_ui
node_shopper -.->|"signs in"| node_customer_auth_ui
node_storefront_ui -.->|"requests"| node_api_routes
node_customer_auth_ui -.->|"requests"| node_api_routes
node_admin_ui -.->|"requests"| node_api_routes
node_api_routes -->|"dispatches"| node_auth
node_api_routes -->|"dispatches"| node_cart_api
node_api_routes -->|"dispatches"| node_checkout
node_api_routes -->|"dispatches"| node_reviews
node_api_routes -->|"dispatches"| node_invitations
node_api_routes -->|"dispatches"| node_addresses
node_api_routes -->|"dispatches"| node_other_catalog_api
node_auth -->|"creates accounts"| node_users
node_auth -->|"merges guest cart"| node_cart_merge
node_cart_merge -->|"merges items"| node_cart_state
node_cart_api -->|"manages cart"| node_cart_state
node_checkout -->|"reads cart"| node_cart_state
node_checkout -->|"prices products"| node_catalog
node_checkout -->|"applies discounts"| node_promotions
node_checkout -->|"creates order"| node_orders
node_checkout -->|"creates payment"| node_payments
node_checkout -->|"initiates payment"| node_payment_init
node_payment_init -.->|"selects gateway"| node_gateway_manager
node_gateway_manager -->|"manages gateways"| node_payment_gateways
node_reviews -->|"manages reviews"| node_review_state

click node_storefront_ui "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/frontend/src/app/%5Blocale%5D/(storefront)/page.jsx"
click node_customer_auth_ui "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/frontend/src/app/%5Blocale%5D/(customer-auth)/login/page.jsx"
click node_admin_ui "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/frontend/src/app/%5Blocale%5D/admin/(auth)/login/page.jsx"
click node_api_routes "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/routes/api.php"
click node_auth "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/AuthController.php"
click node_cart_merge "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Services/CartMergeService.php"
click node_users "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/User.php"
click node_catalog "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Product.php"
click node_cart_api "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/CartController.php"
click node_cart_state "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Cart.php"
click node_checkout "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/CheckoutController.php"
click node_orders "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Order.php"
click node_payment_init "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Services/Payments/PaymentInitiationService.php"
click node_payments "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Payment.php"
click node_gateway_manager "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Services/Payments/PaymentGatewayManager.php"
click node_payment_gateways "https://github.com/karim-galal/fullstack_ecommerce_starter/tree/main/backend/app/Services/Payments/Gateways"
click node_reviews "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/ReviewController.php"
click node_review_state "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Review.php"
click node_promotions "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Coupon.php"
click node_invitations "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/InvitationController.php"
click node_addresses "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/AddressController.php"
click node_other_catalog_api "https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/ProductController.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_storefront_ui,node_customer_auth_ui,node_admin_ui toneBlue
class node_auth,node_cart_merge,node_users toneAmber
class node_catalog,node_cart_api,node_cart_state,node_checkout,node_orders,node_payment_init,node_payments,node_gateway_manager,node_payment_gateways,node_api_routes toneMint
class node_reviews,node_review_state,node_promotions,node_invitations,node_addresses,node_other_catalog_api toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [Storefront UI](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/frontend/src/app/%5Blocale%5D/(storefront)/page.jsx): `frontend/src/app/[locale]/(storefront)/page.jsx`
- [Customer auth](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/frontend/src/app/%5Blocale%5D/(customer-auth)/login/page.jsx): `frontend/src/app/[locale]/(customer-auth)/login/page.jsx`
- [Admin login](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/frontend/src/app/%5Blocale%5D/admin/(auth)/login/page.jsx): `frontend/src/app/[locale]/admin/(auth)/login/page.jsx`

### Accounts

- [Authentication](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/AuthController.php): `backend/app/Http/Controllers/Api/AuthController.php`
- [Cart merge](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Services/CartMergeService.php): `backend/app/Services/CartMergeService.php`
- [User accounts](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/User.php): `backend/app/Models/User.php`

### Commerce

- [Product catalog](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Product.php): `backend/app/Models/Product.php`
- [Cart API](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/CartController.php): `backend/app/Http/Controllers/Api/CartController.php`
- [Cart state](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Cart.php): `backend/app/Models/Cart.php`
- [Checkout](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/CheckoutController.php): `backend/app/Http/Controllers/Api/CheckoutController.php`
- [Orders](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Order.php): `backend/app/Models/Order.php`
- [Payment initiation](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Services/Payments/PaymentInitiationService.php): `backend/app/Services/Payments/PaymentInitiationService.php`
- [Payment records](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Payment.php): `backend/app/Models/Payment.php`
- [Gateway manager](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Services/Payments/PaymentGatewayManager.php): `backend/app/Services/Payments/PaymentGatewayManager.php`
- [Payment gateways](https://github.com/karim-galal/fullstack_ecommerce_starter/tree/main/backend/app/Services/Payments/Gateways): `backend/app/Services/Payments/Gateways`

### Commerce operations

- [Reviews](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/ReviewController.php): `backend/app/Http/Controllers/Api/ReviewController.php`
- [Review records](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Review.php): `backend/app/Models/Review.php`
- [Coupons and offers](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Models/Coupon.php): `backend/app/Models/Coupon.php`
- [Invitations](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/InvitationController.php): `backend/app/Http/Controllers/Api/InvitationController.php`
- [Addresses](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/AddressController.php): `backend/app/Http/Controllers/Api/AddressController.php`
- [Catalog APIs](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/app/Http/Controllers/Api/ProductController.php): `backend/app/Http/Controllers/Api/ProductController.php`

### Other components

- **Shopper**
- [API routes](https://github.com/karim-galal/fullstack_ecommerce_starter/blob/main/backend/routes/api.php): `backend/routes/api.php`

## Connections

- Shopper → Storefront UI: browses
- Shopper → Customer auth: signs in
- Storefront UI → API routes: requests
- Customer auth → API routes: requests
- Admin login → API routes: requests
- API routes → Authentication: dispatches (evidence: `backend/routes/api.php`)
- API routes → Cart API: dispatches (evidence: `backend/routes/api.php`)
- API routes → Checkout: dispatches (evidence: `backend/routes/api.php`)
- API routes → Reviews: dispatches (evidence: `backend/routes/api.php`)
- API routes → Invitations: dispatches (evidence: `backend/routes/api.php`)
- API routes → Addresses: dispatches (evidence: `backend/routes/api.php`)
- API routes → Catalog APIs: dispatches (evidence: `backend/routes/api.php`)
- Authentication → User accounts: creates accounts (evidence: `backend/app/Http/Controllers/Api/AuthController.php`)
- Authentication → Cart merge: merges guest cart (evidence: `backend/app/Http/Controllers/Api/AuthController.php`)
- Cart merge → Cart state: merges items (evidence: `backend/app/Services/CartMergeService.php`)
- Cart API → Cart state: manages cart (evidence: `backend/app/Http/Controllers/Api/CartController.php`)
- Checkout → Cart state: reads cart (evidence: `backend/app/Http/Controllers/Api/CheckoutController.php`)
- Checkout → Product catalog: prices products (evidence: `backend/app/Http/Controllers/Api/CheckoutController.php`)
- Checkout → Coupons and offers: applies discounts (evidence: `backend/app/Http/Controllers/Api/CheckoutController.php`)
- Checkout → Orders: creates order (evidence: `backend/app/Http/Controllers/Api/CheckoutController.php`)
- Checkout → Payment records: creates payment (evidence: `backend/app/Http/Controllers/Api/CheckoutController.php`)
- Checkout → Payment initiation: initiates payment (evidence: `backend/app/Http/Controllers/Api/CheckoutController.php`)
- Payment initiation → Gateway manager: selects gateway
- Gateway manager → Payment gateways: manages gateways (evidence: `backend/app/Services/Payments/PaymentGatewayManager.php`)
- Reviews → Review records: manages reviews (evidence: `backend/app/Http/Controllers/Api/ReviewController.php`)
