# banana1638/coffee-plus architecture

> Architecture diagram of the GitHub repository banana1638/coffee-plus, 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/banana1638/coffee-plus
- Repository: https://github.com/banana1638/coffee-plus

## Overview

Coffee Plus is a Laravel coffee-shop ordering system with customer-facing web/API flows and an admin panel. Customers browse products, customize a persistent cart, apply coupons or OZ rewards, choose pickup, and pay by wallet or Stripe; Stripe completion is webhook-driven. The map also preserves wallet/refill, recipes, reviews, referrals, and admin operations documented in the README. Sampled source confirms checkout orchestration and some model relationships; other subsystem links rely on README statements, so unsampled implementation details are not inferred.

Main entry points: [`app/Models`](https://github.com/banana1638/coffee-plus/tree/main/app/Models) (Commerce records), [`app/Services/CheckoutService.php`](https://github.com/banana1638/coffee-plus/blob/main/app/Services/CheckoutService.php) (Checkout orchestration), [`app/Services/Payment/PaymentHandlerFactory.php`](https://github.com/banana1638/coffee-plus/blob/main/app/Services/Payment/PaymentHandlerFactory.php) (Payment handlers), [`app/Http/Controllers/Admin`](https://github.com/banana1638/coffee-plus/tree/main/app/Http/Controllers/Admin) (Admin operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer experience"]
  node_auth["Authentication"]
  node_catalog["Product catalog"]
  node_cart["Persistent cart<br/>[CartService.php]"]
  node_reviews["Product reviews"]
  node_recipes["Shared recipes"]
end

subgraph group_commerce["Ordering and payments"]
  node_checkout["Checkout orchestration"]
  node_pricing["Pricing and rewards<br/>[PricingService.php]"]
  node_snapshot["Cart price snapshot"]
  node_payment_entry["Payment initiation"]
  node_payment_handlers["Payment handlers"]
  node_stripe["Stripe gateway<br/>[StripeGateway.php]"]
  node_webhook["Stripe webhook"]
  node_wallet["Tangki wallet<br/>[TangkiService.php]"]
  node_ledger["Wallet ledger<br/>[LedgerService.php]"]
end

subgraph group_domain["Domain and engagement"]
  node_orders["Order lifecycle"]
  node_models[("Commerce records")]
  node_money["Money representation<br/>[Money.php]"]
  node_notifications["Realtime notifications"]
end

subgraph group_operations["Administration"]
  node_admin["Admin operations"]
  node_admin_access["Admin permissions"]
  node_audit["Audit logging"]
end

node_customer(("Customer"))

node_customer -->|"registers or logs in"| node_auth
node_customer -->|"browses products"| node_catalog
node_customer -->|"customizes cart"| node_cart
node_cart -.->|"persists items"| node_models
node_customer -->|"places order"| node_checkout
node_checkout -.->|"calculates discounts"| node_pricing
node_checkout -->|"creates order and items"| node_models
node_checkout -->|"emits order event"| node_orders
node_customer -->|"starts checkout payment"| node_payment_entry
node_payment_entry -->|"locks cart prices"| node_snapshot
node_payment_entry -->|"selects completion handler"| node_payment_handlers
node_payment_handlers -.->|"initiates Stripe payment"| node_stripe
node_stripe -.->|"redirects to checkout"| node_customer
node_stripe -->|"sends signed event"| node_webhook
node_webhook -->|"dispatches completion"| node_payment_handlers
node_payment_handlers -->|"processes snapshot"| node_checkout
node_customer -->|"views balance or refills"| node_wallet
node_wallet -.->|"records balance changes"| node_ledger
node_customer -->|"submits review"| node_reviews
node_reviews -->|"stores review"| node_models
node_customer -->|"shares or imports recipe"| node_recipes
node_orders -.->|"tracks order state"| node_models
node_models -->|"converts monetary values"| node_money
node_webhook -->|"notifies payment events"| node_notifications
node_admin -.->|"manages products and orders"| node_models
node_admin -->|"checks permissions"| node_admin_access
node_admin -.->|"records admin actions"| node_audit

click node_auth "https://github.com/banana1638/coffee-plus/tree/main/app/Http/Controllers/API/Auth"
click node_catalog "https://github.com/banana1638/coffee-plus/blob/main/app/Http/Controllers/API/ProductController.php"
click node_cart "https://github.com/banana1638/coffee-plus/blob/main/app/Services/CartService.php"
click node_reviews "https://github.com/banana1638/coffee-plus/blob/main/app/Http/Controllers/API/ProductReviewController.php"
click node_recipes "https://github.com/banana1638/coffee-plus/blob/main/app/Http/Controllers/API/SharedRecipeController.php"
click node_checkout "https://github.com/banana1638/coffee-plus/blob/main/app/Services/CheckoutService.php"
click node_pricing "https://github.com/banana1638/coffee-plus/blob/main/app/Services/PricingService.php"
click node_snapshot "https://github.com/banana1638/coffee-plus/blob/main/app/Services/CartSnapshotService.php"
click node_payment_entry "https://github.com/banana1638/coffee-plus/blob/main/app/Http/Controllers/PaymentController.php"
click node_payment_handlers "https://github.com/banana1638/coffee-plus/blob/main/app/Services/Payment/PaymentHandlerFactory.php"
click node_stripe "https://github.com/banana1638/coffee-plus/blob/main/app/Services/Payment/Gateways/StripeGateway.php"
click node_webhook "https://github.com/banana1638/coffee-plus/blob/main/app/Http/Controllers/API/StripeWebhookController.php"
click node_wallet "https://github.com/banana1638/coffee-plus/blob/main/app/Services/TangkiService.php"
click node_ledger "https://github.com/banana1638/coffee-plus/blob/main/app/Services/LedgerService.php"
click node_orders "https://github.com/banana1638/coffee-plus/blob/main/app/Services/OrderStateMachine.php"
click node_models "https://github.com/banana1638/coffee-plus/tree/main/app/Models"
click node_money "https://github.com/banana1638/coffee-plus/blob/main/app/Support/Money.php"
click node_notifications "https://github.com/banana1638/coffee-plus/blob/main/app/Services/RealtimeNotificationService.php"
click node_admin "https://github.com/banana1638/coffee-plus/tree/main/app/Http/Controllers/Admin"
click node_admin_access "https://github.com/banana1638/coffee-plus/blob/main/app/Http/Middleware/AdminPermission.php"
click node_audit "https://github.com/banana1638/coffee-plus/blob/main/app/Services/AuditLogService.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_auth,node_catalog,node_cart,node_reviews,node_recipes toneBlue
class node_checkout,node_pricing,node_snapshot,node_payment_entry,node_payment_handlers,node_stripe,node_webhook,node_wallet,node_ledger toneAmber
class node_orders,node_models,node_money,node_notifications toneMint
class node_admin,node_admin_access,node_audit toneRose
class node_customer toneIndigo
```

## Components

### Customer experience

- [Authentication](https://github.com/banana1638/coffee-plus/tree/main/app/Http/Controllers/API/Auth): `app/Http/Controllers/API/Auth`
- [Product catalog](https://github.com/banana1638/coffee-plus/blob/main/app/Http/Controllers/API/ProductController.php): `app/Http/Controllers/API/ProductController.php`
- [Persistent cart](https://github.com/banana1638/coffee-plus/blob/main/app/Services/CartService.php): `app/Services/CartService.php`
- [Product reviews](https://github.com/banana1638/coffee-plus/blob/main/app/Http/Controllers/API/ProductReviewController.php): `app/Http/Controllers/API/ProductReviewController.php`
- [Shared recipes](https://github.com/banana1638/coffee-plus/blob/main/app/Http/Controllers/API/SharedRecipeController.php): `app/Http/Controllers/API/SharedRecipeController.php`

### Ordering and payments

- [Checkout orchestration](https://github.com/banana1638/coffee-plus/blob/main/app/Services/CheckoutService.php): `app/Services/CheckoutService.php`
- [Pricing and rewards](https://github.com/banana1638/coffee-plus/blob/main/app/Services/PricingService.php): `app/Services/PricingService.php`
- [Cart price snapshot](https://github.com/banana1638/coffee-plus/blob/main/app/Services/CartSnapshotService.php): `app/Services/CartSnapshotService.php`
- [Payment initiation](https://github.com/banana1638/coffee-plus/blob/main/app/Http/Controllers/PaymentController.php): `app/Http/Controllers/PaymentController.php`
- [Payment handlers](https://github.com/banana1638/coffee-plus/blob/main/app/Services/Payment/PaymentHandlerFactory.php): `app/Services/Payment/PaymentHandlerFactory.php`
- [Stripe gateway](https://github.com/banana1638/coffee-plus/blob/main/app/Services/Payment/Gateways/StripeGateway.php): `app/Services/Payment/Gateways/StripeGateway.php`
- [Stripe webhook](https://github.com/banana1638/coffee-plus/blob/main/app/Http/Controllers/API/StripeWebhookController.php): `app/Http/Controllers/API/StripeWebhookController.php`
- [Tangki wallet](https://github.com/banana1638/coffee-plus/blob/main/app/Services/TangkiService.php): `app/Services/TangkiService.php`
- [Wallet ledger](https://github.com/banana1638/coffee-plus/blob/main/app/Services/LedgerService.php): `app/Services/LedgerService.php`

### Domain and engagement

- [Order lifecycle](https://github.com/banana1638/coffee-plus/blob/main/app/Services/OrderStateMachine.php): `app/Services/OrderStateMachine.php`
- [Commerce records](https://github.com/banana1638/coffee-plus/tree/main/app/Models): `app/Models`
- [Money representation](https://github.com/banana1638/coffee-plus/blob/main/app/Support/Money.php): `app/Support/Money.php`
- [Realtime notifications](https://github.com/banana1638/coffee-plus/blob/main/app/Services/RealtimeNotificationService.php): `app/Services/RealtimeNotificationService.php`

### Administration

- [Admin operations](https://github.com/banana1638/coffee-plus/tree/main/app/Http/Controllers/Admin): `app/Http/Controllers/Admin`
- [Admin permissions](https://github.com/banana1638/coffee-plus/blob/main/app/Http/Middleware/AdminPermission.php): `app/Http/Middleware/AdminPermission.php`
- [Audit logging](https://github.com/banana1638/coffee-plus/blob/main/app/Services/AuditLogService.php): `app/Services/AuditLogService.php`

### Other components

- **Customer**

## Connections

- Customer → Authentication: registers or logs in (evidence: `README.md`)
- Customer → Product catalog: browses products (evidence: `README.md`)
- Customer → Persistent cart: customizes cart (evidence: `README.md`)
- Persistent cart → Commerce records: persists items (evidence: `README.md`)
- Customer → Checkout orchestration: places order (evidence: `README.md`)
- Checkout orchestration → Pricing and rewards: calculates discounts (evidence: `README.md`)
- Checkout orchestration → Commerce records: creates order and items (evidence: `app/Services/CheckoutService.php`)
- Checkout orchestration → Order lifecycle: emits order event (evidence: `app/Services/CheckoutService.php`)
- Customer → Payment initiation: starts checkout payment (evidence: `README.md`)
- Payment initiation → Cart price snapshot: locks cart prices (evidence: `app/Http/Controllers/PaymentController.php`)
- Payment initiation → Payment handlers: selects completion handler (evidence: `app/Http/Controllers/PaymentController.php`)
- Payment handlers → Stripe gateway: initiates Stripe payment (evidence: `README.md`)
- Stripe gateway → Customer: redirects to checkout (evidence: `README.md`)
- Stripe gateway → Stripe webhook: sends signed event (evidence: `README.md`)
- Stripe webhook → Payment handlers: dispatches completion (evidence: `app/Http/Controllers/API/StripeWebhookController.php`)
- Payment handlers → Checkout orchestration: processes snapshot
- Customer → Tangki wallet: views balance or refills (evidence: `README.md`)
- Tangki wallet → Wallet ledger: records balance changes (evidence: `README.md`)
- Customer → Product reviews: submits review (evidence: `README.md`)
- Product reviews → Commerce records: stores review (evidence: `app/Http/Controllers/API/ProductReviewController.php`)
- Customer → Shared recipes: shares or imports recipe (evidence: `README.md`)
- Order lifecycle → Commerce records: tracks order state (evidence: `README.md`)
- Commerce records → Money representation: converts monetary values (evidence: `app/Models/Order.php`)
- Stripe webhook → Realtime notifications: notifies payment events (evidence: `app/Http/Controllers/API/StripeWebhookController.php`)
- Admin operations → Commerce records: manages products and orders (evidence: `README.md`)
- Admin operations → Admin permissions: checks permissions (evidence: `README.md`)
- Admin operations → Audit logging: records admin actions (evidence: `README.md`)
