# reydel6/posmart architecture

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

- Interactive diagram: https://gitdiagram.com/reydel6/posmart
- Repository: https://github.com/reydel6/posmart

## Overview

POSMart is a React storefront and cashier POS backed by a Laravel API. The main customer journey is browsing and filtering products, adding items to a cart, checking out, and completing payment; cashiers and administrators manage transactions and store operations. The graph preserves documented admin, reporting, loyalty, promotions, and SMART inventory capabilities. Relationships are limited to calls, routing, and data access shown in excerpts or README; unsampled details are represented without speculative connections.

Main entry points: [`backend/app/Http/Controllers/OrderController.php`](https://github.com/reydel6/posmart/blob/main/backend/app/Http/Controllers/OrderController.php) (Order & Checkout), [`backend/routes/api.php`](https://github.com/reydel6/posmart/blob/main/backend/routes/api.php) (API Routes), [`backend/app/Models/Product.php`](https://github.com/reydel6/posmart/blob/main/backend/app/Models/Product.php) (Products), [`src/utils/api.js`](https://github.com/reydel6/posmart/blob/main/src/utils/api.js) (API Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Storefront &amp; POS"]
  node_frontend["React Router<br/>[App.jsx]"]
  node_catalog["Product Catalog<br/>[CatalogPage.jsx]"]
  node_producthook["Product Fetching<br/>[useProduct.js]"]
  node_cart["Cart State<br/>[CartProvider.jsx]"]
  node_checkoutui["Checkout UI<br/>[CheckoutForm.jsx]"]
  node_posui["Cashier POS"]
  node_adminui["Admin Workspace"]
  node_api["API Client<br/>[api.js]"]
end

subgraph group_commerce["Commerce API"]
  node_api_routes["API Routes<br/>[api.php]"]
  node_product_api["Product Endpoints"]
  node_order_api["Order &amp; Checkout"]
  node_cashier_api["Cashier Orders"]
  node_review_api["Product Reviews"]
end

subgraph group_operations["Store Operations"]
  node_admin_api["Admin APIs"]
  node_smart["SMART Ranking"]
  node_loyalty["Loyalty Service<br/>[LoyaltyService.php]"]
  node_promotions["Promotion Service"]
  node_midtrans["Midtrans Payments"]
  node_payment["Payment Methods<br/>[PaymentMethods.php]"]
  node_notifier["Store Notifications<br/>[StoreNotifier.php]"]
end

subgraph group_domain["Domain &amp; Data"]
  node_products[("Products<br/>[Product.php]")]
  node_orders[("Orders<br/>[Order.php]")]
  node_orderitems[("Order Items<br/>[OrderItem.php]")]
  node_reviews[("Reviews<br/>[Review.php]")]
  node_settings[("Store Settings<br/>[Setting.php]")]
  node_database[("MySQL Database")]
end

node_shopper(("Shopper"))
node_midtrans_service["Midtrans"]

node_shopper -->|"uses"| node_frontend
node_frontend -->|"routes to"| node_catalog
node_catalog -->|"fetches"| node_producthook
node_producthook -->|"requests"| node_api
node_catalog -->|"uses"| node_cart
node_checkoutui -.->|"reads"| node_cart
node_checkoutui -.->|"submits checkout"| node_api
node_posui -->|"requests"| node_api
node_adminui -.->|"requests"| node_api
node_api -->|"calls"| node_api_routes
node_api_routes -->|"routes to"| node_product_api
node_api_routes -->|"routes to"| node_order_api
node_api_routes -.->|"routes to"| node_cashier_api
node_api_routes -.->|"routes to"| node_review_api
node_api_routes -->|"routes to"| node_admin_api
node_api_routes -->|"routes to"| node_smart
node_product_api -->|"queries"| node_products
node_review_api -->|"reads and writes"| node_reviews
node_review_api -->|"updates rating"| node_products
node_order_api -->|"creates and updates"| node_orders
node_order_api -->|"creates"| node_orderitems
node_order_api -->|"checks stock"| node_products
node_order_api -->|"resolves bundles"| node_promotions
node_order_api -->|"redeems points"| node_loyalty
node_order_api -->|"creates transaction"| node_midtrans
node_order_api -->|"loads payment options"| node_payment
node_order_api -->|"notifies store"| node_notifier
node_cashier_api -->|"updates"| node_orders
node_cashier_api -->|"notifies store"| node_notifier
node_smart -->|"ranks"| node_products
node_smart -->|"reads weights"| node_settings
node_admin_api -->|"manages"| node_products
node_admin_api -->|"manages"| node_orders
node_admin_api -->|"uses"| node_loyalty
node_orders -.->|"persists"| node_database
node_products -.->|"persists"| node_database
node_orderitems -.->|"persists"| node_database
node_reviews -.->|"persists"| node_database
node_settings -.->|"persists"| node_database
node_midtrans -.->|"connects"| node_midtrans_service

click node_frontend "https://github.com/reydel6/posmart/blob/main/src/App.jsx"
click node_catalog "https://github.com/reydel6/posmart/blob/main/src/pages/CatalogPage.jsx"
click node_producthook "https://github.com/reydel6/posmart/blob/main/src/hooks/useProduct.js"
click node_cart "https://github.com/reydel6/posmart/blob/main/src/context/CartProvider.jsx"
click node_checkoutui "https://github.com/reydel6/posmart/blob/main/src/components/CheckoutForm.jsx"
click node_posui "https://github.com/reydel6/posmart/blob/main/src/pages/PosRegisterPage.jsx"
click node_adminui "https://github.com/reydel6/posmart/tree/main/src/pages/admin"
click node_api "https://github.com/reydel6/posmart/blob/main/src/utils/api.js"
click node_api_routes "https://github.com/reydel6/posmart/blob/main/backend/routes/api.php"
click node_product_api "https://github.com/reydel6/posmart/blob/main/backend/app/Http/Controllers/ProductController.php"
click node_order_api "https://github.com/reydel6/posmart/blob/main/backend/app/Http/Controllers/OrderController.php"
click node_cashier_api "https://github.com/reydel6/posmart/blob/main/backend/app/Http/Controllers/Cashier/CashierOrderController.php"
click node_review_api "https://github.com/reydel6/posmart/blob/main/backend/app/Http/Controllers/ReviewController.php"
click node_admin_api "https://github.com/reydel6/posmart/tree/main/backend/app/Http/Controllers/Admin"
click node_smart "https://github.com/reydel6/posmart/blob/main/backend/app/Http/Controllers/Admin/AdminSpkSmartController.php"
click node_loyalty "https://github.com/reydel6/posmart/blob/main/backend/app/Services/LoyaltyService.php"
click node_promotions "https://github.com/reydel6/posmart/blob/main/backend/app/Services/PromotionService.php"
click node_midtrans "https://github.com/reydel6/posmart/blob/main/backend/app/Services/MidtransService.php"
click node_payment "https://github.com/reydel6/posmart/blob/main/backend/app/Services/PaymentMethods.php"
click node_notifier "https://github.com/reydel6/posmart/blob/main/backend/app/Services/StoreNotifier.php"
click node_products "https://github.com/reydel6/posmart/blob/main/backend/app/Models/Product.php"
click node_orders "https://github.com/reydel6/posmart/blob/main/backend/app/Models/Order.php"
click node_orderitems "https://github.com/reydel6/posmart/blob/main/backend/app/Models/OrderItem.php"
click node_reviews "https://github.com/reydel6/posmart/blob/main/backend/app/Models/Review.php"
click node_settings "https://github.com/reydel6/posmart/blob/main/backend/app/Models/Setting.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_frontend,node_catalog,node_producthook,node_cart,node_checkoutui,node_posui,node_adminui,node_api toneBlue
class node_api_routes,node_product_api,node_order_api,node_cashier_api,node_review_api toneAmber
class node_admin_api,node_smart,node_loyalty,node_promotions,node_midtrans,node_payment,node_notifier toneMint
class node_products,node_orders,node_orderitems,node_reviews,node_settings,node_database toneRose
class node_shopper,node_midtrans_service toneIndigo
```

## Components

### Storefront & POS

- [React Router](https://github.com/reydel6/posmart/blob/main/src/App.jsx): `src/App.jsx`
- [Product Catalog](https://github.com/reydel6/posmart/blob/main/src/pages/CatalogPage.jsx): `src/pages/CatalogPage.jsx`
- [Product Fetching](https://github.com/reydel6/posmart/blob/main/src/hooks/useProduct.js): `src/hooks/useProduct.js`
- [Cart State](https://github.com/reydel6/posmart/blob/main/src/context/CartProvider.jsx): `src/context/CartProvider.jsx`
- [Checkout UI](https://github.com/reydel6/posmart/blob/main/src/components/CheckoutForm.jsx): `src/components/CheckoutForm.jsx`
- [Cashier POS](https://github.com/reydel6/posmart/blob/main/src/pages/PosRegisterPage.jsx): `src/pages/PosRegisterPage.jsx`
- [Admin Workspace](https://github.com/reydel6/posmart/tree/main/src/pages/admin): `src/pages/admin`
- [API Client](https://github.com/reydel6/posmart/blob/main/src/utils/api.js): `src/utils/api.js`

### Commerce API

- [API Routes](https://github.com/reydel6/posmart/blob/main/backend/routes/api.php): `backend/routes/api.php`
- [Product Endpoints](https://github.com/reydel6/posmart/blob/main/backend/app/Http/Controllers/ProductController.php): `backend/app/Http/Controllers/ProductController.php`
- [Order & Checkout](https://github.com/reydel6/posmart/blob/main/backend/app/Http/Controllers/OrderController.php): `backend/app/Http/Controllers/OrderController.php`
- [Cashier Orders](https://github.com/reydel6/posmart/blob/main/backend/app/Http/Controllers/Cashier/CashierOrderController.php): `backend/app/Http/Controllers/Cashier/CashierOrderController.php`
- [Product Reviews](https://github.com/reydel6/posmart/blob/main/backend/app/Http/Controllers/ReviewController.php): `backend/app/Http/Controllers/ReviewController.php`

### Store Operations

- [Admin APIs](https://github.com/reydel6/posmart/tree/main/backend/app/Http/Controllers/Admin): `backend/app/Http/Controllers/Admin`
- [SMART Ranking](https://github.com/reydel6/posmart/blob/main/backend/app/Http/Controllers/Admin/AdminSpkSmartController.php): `backend/app/Http/Controllers/Admin/AdminSpkSmartController.php`
- [Loyalty Service](https://github.com/reydel6/posmart/blob/main/backend/app/Services/LoyaltyService.php): `backend/app/Services/LoyaltyService.php`
- [Promotion Service](https://github.com/reydel6/posmart/blob/main/backend/app/Services/PromotionService.php): `backend/app/Services/PromotionService.php`
- [Midtrans Payments](https://github.com/reydel6/posmart/blob/main/backend/app/Services/MidtransService.php): `backend/app/Services/MidtransService.php`
- [Payment Methods](https://github.com/reydel6/posmart/blob/main/backend/app/Services/PaymentMethods.php): `backend/app/Services/PaymentMethods.php`
- [Store Notifications](https://github.com/reydel6/posmart/blob/main/backend/app/Services/StoreNotifier.php): `backend/app/Services/StoreNotifier.php`

### Domain & Data

- [Products](https://github.com/reydel6/posmart/blob/main/backend/app/Models/Product.php): `backend/app/Models/Product.php`
- [Orders](https://github.com/reydel6/posmart/blob/main/backend/app/Models/Order.php): `backend/app/Models/Order.php`
- [Order Items](https://github.com/reydel6/posmart/blob/main/backend/app/Models/OrderItem.php): `backend/app/Models/OrderItem.php`
- [Reviews](https://github.com/reydel6/posmart/blob/main/backend/app/Models/Review.php): `backend/app/Models/Review.php`
- [Store Settings](https://github.com/reydel6/posmart/blob/main/backend/app/Models/Setting.php): `backend/app/Models/Setting.php`
- **MySQL Database**

### Other components

- **Shopper**
- **Midtrans**

## Connections

- Shopper → React Router: uses (evidence: `README.md`)
- React Router → Product Catalog: routes to (evidence: `src/App.jsx`)
- Product Catalog → Product Fetching: fetches (evidence: `src/pages/CatalogPage.jsx`)
- Product Fetching → API Client: requests (evidence: `src/hooks/useProduct.js`)
- Product Catalog → Cart State: uses (evidence: `src/pages/CatalogPage.jsx`)
- Checkout UI → Cart State: reads
- Checkout UI → API Client: submits checkout
- Cashier POS → API Client: requests (evidence: `src/pages/PosRegisterPage.jsx`)
- Admin Workspace → API Client: requests (evidence: `src/pages/admin/AdminSpkSmartPage.jsx`)
- API Client → API Routes: calls (evidence: `README.md`)
- API Routes → Product Endpoints: routes to (evidence: `backend/routes/api.php`)
- API Routes → Order & Checkout: routes to (evidence: `backend/routes/api.php`)
- API Routes → Cashier Orders: routes to (evidence: `backend/routes/api.php`)
- API Routes → Product Reviews: routes to (evidence: `backend/routes/api.php`)
- API Routes → Admin APIs: routes to (evidence: `backend/routes/api.php`)
- API Routes → SMART Ranking: routes to (evidence: `backend/routes/api.php`)
- Product Endpoints → Products: queries (evidence: `backend/app/Http/Controllers/ProductController.php`)
- Product Reviews → Reviews: reads and writes (evidence: `backend/app/Http/Controllers/ReviewController.php`)
- Product Reviews → Products: updates rating (evidence: `backend/app/Http/Controllers/ReviewController.php`)
- Order & Checkout → Orders: creates and updates (evidence: `backend/app/Http/Controllers/OrderController.php`)
- Order & Checkout → Order Items: creates (evidence: `backend/app/Http/Controllers/OrderController.php`)
- Order & Checkout → Products: checks stock (evidence: `backend/app/Http/Controllers/OrderController.php`)
- Order & Checkout → Promotion Service: resolves bundles (evidence: `backend/app/Http/Controllers/OrderController.php`)
- Order & Checkout → Loyalty Service: redeems points (evidence: `backend/app/Http/Controllers/OrderController.php`)
- Order & Checkout → Midtrans Payments: creates transaction (evidence: `backend/app/Http/Controllers/OrderController.php`)
- Order & Checkout → Payment Methods: loads payment options (evidence: `backend/app/Http/Controllers/OrderController.php`)
- Order & Checkout → Store Notifications: notifies store (evidence: `backend/app/Http/Controllers/OrderController.php`)
- Cashier Orders → Orders: updates (evidence: `backend/app/Http/Controllers/Cashier/CashierOrderController.php`)
- Cashier Orders → Store Notifications: notifies store (evidence: `backend/app/Http/Controllers/Cashier/CashierOrderController.php`)
- SMART Ranking → Products: ranks (evidence: `backend/app/Http/Controllers/Admin/AdminSpkSmartController.php`)
- SMART Ranking → Store Settings: reads weights (evidence: `backend/app/Http/Controllers/Admin/AdminSpkSmartController.php`)
- Admin APIs → Products: manages (evidence: `backend/app/Http/Controllers/Admin/AdminProductController.php`)
- Admin APIs → Orders: manages (evidence: `backend/app/Http/Controllers/Admin/AdminOrderController.php`)
- Admin APIs → Loyalty Service: uses (evidence: `backend/app/Http/Controllers/Admin/AdminOrderController.php`)
- Orders → MySQL Database: persists
- Products → MySQL Database: persists
- Order Items → MySQL Database: persists
- Reviews → MySQL Database: persists
- Store Settings → MySQL Database: persists
- Midtrans Payments → Midtrans: connects
