# princess-groups/craftheaven_apk architecture

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

- Interactive diagram: https://gitdiagram.com/princess-groups/craftheaven_apk
- Repository: https://github.com/princess-groups/craftheaven_apk

## Overview

Craft Connect Hub is a craft-retail application combining customer shopping, staff billing/POS, and administrative management. The principal customer workflow is browse products, manage a cart, check out, and follow orders; staff also bill in-store sales, while administrators manage catalog, stock, and reporting. The README describes unified orders and inventory across channels. Source evidence is partial, so unsampled relationships are omitted or marked unverified rather than inferred from filenames alone.

Main entry points: [`src/integrations/supabase/client.ts`](https://github.com/princess-groups/craftheaven_apk/blob/main/src/integrations/supabase/client.ts) (Client database access), [`src/routes/admin/pos.tsx`](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/pos.tsx) (POS billing), [`src/routes/_authenticated/checkout.tsx`](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/_authenticated/checkout.tsx) (Cart and checkout), [`src/lib/payment.functions.ts`](https://github.com/princess-groups/craftheaven_apk/blob/main/src/lib/payment.functions.ts) (Payment processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shop["Customer shopping"]
  node_browse["Browse storefront<br/>[index.tsx]"]
  node_product["Product catalog views<br/>[product.$slug.tsx]"]
  node_product_card["Product cards<br/>[product-card.tsx]"]
  node_cart_checkout["Cart and checkout<br/>[checkout.tsx]"]
  node_order_history["Orders and tracking<br/>[orders.$id.tsx]"]
end

subgraph group_operations["Retail operations"]
  node_pos["POS billing<br/>[pos.tsx]"]
  node_billing["Billing records<br/>[billing.tsx]"]
  node_admin_auth["Admin access control<br/>[route.tsx]"]
  node_catalog_admin["Catalog management<br/>[products.tsx]"]
  node_inventory["Inventory management<br/>[inventory.tsx]"]
  node_purchases["Purchase entries<br/>[purchases.tsx]"]
  node_analytics["Reports and analytics<br/>[reports.tsx]"]
end

subgraph group_services["Shared services"]
  node_customer_auth["Customer authentication<br/>[auth.tsx]"]
  node_supabase_client["Client database access<br/>[client.ts]"]
  node_supabase_admin["Server database access<br/>[client.server.ts]"]
  node_payments["Payment processing"]
end

subgraph group_printing["Printing agent"]
  node_print_agent["Printer agent<br/>[print-agent.ts]"]
  node_printer_devices["Printer devices<br/>[index.ts]"]
  node_receipt_format["Receipt formatting<br/>[receipt.ts]"]
end

node_customer(("Customer"))
node_staff(("Billing staff"))
node_admin(("Administrators"))
node_payment_gateway{{"Payment gateways"}}

node_customer -->|"browses"| node_browse
node_browse -->|"renders products"| node_product_card
node_product_card -->|"reads wishlist"| node_supabase_client
node_customer -->|"views details"| node_product
node_customer -->|"checks out"| node_cart_checkout
node_cart_checkout -->|"uses database"| node_supabase_client
node_cart_checkout -.->|"initiates payment"| node_payments
node_payments -->|"calls gateway"| node_payment_gateway
node_customer -->|"tracks orders"| node_order_history
node_order_history -.->|"uses database"| node_supabase_client
node_customer -->|"signs in"| node_customer_auth
node_customer_auth -->|"authenticates"| node_supabase_client
node_staff -->|"creates bills"| node_pos
node_pos -.->|"records billing"| node_billing
node_pos -.->|"uses database"| node_supabase_client
node_pos -.->|"requests printing"| node_print_agent
node_admin -->|"opens dashboard"| node_admin_auth
node_admin_auth -->|"checks role"| node_supabase_client
node_admin -->|"manages catalog"| node_catalog_admin
node_admin -->|"manages stock"| node_inventory
node_admin -->|"enters purchases"| node_purchases
node_admin -->|"views reports"| node_analytics
node_catalog_admin -.->|"uses database"| node_supabase_client
node_inventory -.->|"uses database"| node_supabase_client
node_purchases -.->|"uses database"| node_supabase_client
node_analytics -.->|"uses database"| node_supabase_client
node_payments -->|"uses server client"| node_supabase_admin
node_print_agent -->|"manages devices"| node_printer_devices
node_print_agent -->|"formats receipts"| node_receipt_format

click node_browse "https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/index.tsx"
click node_product "https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/product.%24slug.tsx"
click node_product_card "https://github.com/princess-groups/craftheaven_apk/blob/main/src/components/product-card.tsx"
click node_cart_checkout "https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/_authenticated/checkout.tsx"
click node_order_history "https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/_authenticated/orders.%24id.tsx"
click node_customer_auth "https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/auth.tsx"
click node_pos "https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/pos.tsx"
click node_billing "https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/billing.tsx"
click node_admin_auth "https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/route.tsx"
click node_catalog_admin "https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/products.tsx"
click node_inventory "https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/inventory.tsx"
click node_purchases "https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/purchases.tsx"
click node_analytics "https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/reports.tsx"
click node_supabase_client "https://github.com/princess-groups/craftheaven_apk/blob/main/src/integrations/supabase/client.ts"
click node_supabase_admin "https://github.com/princess-groups/craftheaven_apk/blob/main/src/integrations/supabase/client.server.ts"
click node_payments "https://github.com/princess-groups/craftheaven_apk/blob/main/src/lib/payment.functions.ts"
click node_print_agent "https://github.com/princess-groups/craftheaven_apk/blob/main/print-agent/src/print-agent.ts"
click node_printer_devices "https://github.com/princess-groups/craftheaven_apk/blob/main/print-agent/src/devices/index.ts"
click node_receipt_format "https://github.com/princess-groups/craftheaven_apk/blob/main/print-agent/src/escpos/receipt.ts"

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_browse,node_product,node_product_card,node_cart_checkout,node_order_history toneBlue
class node_pos,node_billing,node_admin_auth,node_catalog_admin,node_inventory,node_purchases,node_analytics toneAmber
class node_customer_auth,node_supabase_client,node_supabase_admin,node_payments toneMint
class node_print_agent,node_printer_devices,node_receipt_format toneRose
class node_customer,node_staff,node_admin,node_payment_gateway toneIndigo
```

## Components

### Customer shopping

- [Browse storefront](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Product catalog views](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/product.%24slug.tsx): `src/routes/product.$slug.tsx`
- [Product cards](https://github.com/princess-groups/craftheaven_apk/blob/main/src/components/product-card.tsx): `src/components/product-card.tsx`
- [Cart and checkout](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/_authenticated/checkout.tsx): `src/routes/_authenticated/checkout.tsx`
- [Orders and tracking](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/_authenticated/orders.%24id.tsx): `src/routes/_authenticated/orders.$id.tsx`

### Retail operations

- [POS billing](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/pos.tsx): `src/routes/admin/pos.tsx`
- [Billing records](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/billing.tsx): `src/routes/admin/billing.tsx`
- [Admin access control](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/route.tsx): `src/routes/admin/route.tsx`
- [Catalog management](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/products.tsx): `src/routes/admin/products.tsx`
- [Inventory management](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/inventory.tsx): `src/routes/admin/inventory.tsx`
- [Purchase entries](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/purchases.tsx): `src/routes/admin/purchases.tsx`
- [Reports and analytics](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/admin/reports.tsx): `src/routes/admin/reports.tsx`

### Shared services

- [Customer authentication](https://github.com/princess-groups/craftheaven_apk/blob/main/src/routes/auth.tsx): `src/routes/auth.tsx`
- [Client database access](https://github.com/princess-groups/craftheaven_apk/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Server database access](https://github.com/princess-groups/craftheaven_apk/blob/main/src/integrations/supabase/client.server.ts): `src/integrations/supabase/client.server.ts`
- [Payment processing](https://github.com/princess-groups/craftheaven_apk/blob/main/src/lib/payment.functions.ts): `src/lib/payment.functions.ts`

### Printing agent

- [Printer agent](https://github.com/princess-groups/craftheaven_apk/blob/main/print-agent/src/print-agent.ts): `print-agent/src/print-agent.ts`
- [Printer devices](https://github.com/princess-groups/craftheaven_apk/blob/main/print-agent/src/devices/index.ts): `print-agent/src/devices/index.ts`
- [Receipt formatting](https://github.com/princess-groups/craftheaven_apk/blob/main/print-agent/src/escpos/receipt.ts): `print-agent/src/escpos/receipt.ts`

### Other components

- **Customer**
- **Billing staff**
- **Administrators**
- **Payment gateways**

## Connections

- Customer → Browse storefront: browses
- Browse storefront → Product cards: renders products (evidence: `src/routes/index.tsx`)
- Product cards → Client database access: reads wishlist (evidence: `src/components/product-card.tsx`)
- Customer → Product catalog views: views details
- Customer → Cart and checkout: checks out
- Cart and checkout → Client database access: uses database
- Cart and checkout → Payment processing: initiates payment
- Payment processing → Payment gateways: calls gateway (evidence: `src/lib/payment.functions.ts`)
- Customer → Orders and tracking: tracks orders
- Orders and tracking → Client database access: uses database
- Customer → Customer authentication: signs in (evidence: `src/routes/auth.tsx`)
- Customer authentication → Client database access: authenticates (evidence: `src/routes/auth.tsx`)
- Billing staff → POS billing: creates bills
- POS billing → Billing records: records billing
- POS billing → Client database access: uses database
- POS billing → Printer agent: requests printing
- Administrators → Admin access control: opens dashboard (evidence: `src/routes/admin/route.tsx`)
- Admin access control → Client database access: checks role (evidence: `src/routes/admin/route.tsx`)
- Administrators → Catalog management: manages catalog
- Administrators → Inventory management: manages stock
- Administrators → Purchase entries: enters purchases
- Administrators → Reports and analytics: views reports
- Catalog management → Client database access: uses database
- Inventory management → Client database access: uses database
- Purchase entries → Client database access: uses database
- Reports and analytics → Client database access: uses database
- Payment processing → Server database access: uses server client (evidence: `src/lib/payment.functions.ts`)
- Printer agent → Printer devices: manages devices (evidence: `print-agent/src/print-agent.ts`)
- Printer agent → Receipt formatting: formats receipts (evidence: `print-agent/src/print-agent.ts`)
