# manikanta-analogue/caneworld architecture

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

- Interactive diagram: https://gitdiagram.com/manikanta-analogue/caneworld
- Repository: https://github.com/manikanta-analogue/caneworld

## Overview

CaneWorld is a juice-shop branch sales and customer-loyalty app with an administrative portal. Customers enter through a branch link or QR code, authenticate, browse products, build a cart, pay, and see checkout results; loyalty tracks purchase progress and rewards. Staff sign in to manage branches and the product menu, while the portal also exposes customer, transaction, reporting, and settings areas. The README establishes the product scope; sampled source supports key auth, product, loyalty, and Supabase links. Some unsampled screen and admin-route connections are left unverified.

Main entry points: [`src/lib/branch.functions.ts`](https://github.com/manikanta-analogue/caneworld/blob/main/src/lib/branch.functions.ts) (Branch services), [`src/integrations/supabase/client.ts`](https://github.com/manikanta-analogue/caneworld/blob/main/src/integrations/supabase/client.ts) (User Supabase), [`src/lib/loyalty.ts`](https://github.com/manikanta-analogue/caneworld/blob/main/src/lib/loyalty.ts) (Loyalty logic), [`src/components/branch/PaymentScreen.tsx`](https://github.com/manikanta-analogue/caneworld/blob/main/src/components/branch/PaymentScreen.tsx) (Payment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer sales"]
  node_branch_entry["Branch entry<br/>[b.$token.tsx]"]
  node_customer_auth["Customer auth<br/>[CustomerAuth.tsx]"]
  node_product_browse["Product browse<br/>[loyalty.ts]"]
  node_cart["Cart<br/>[CartScreen.tsx]"]
  node_payment["Payment<br/>[PaymentScreen.tsx]"]
  node_checkout_result["Checkout result<br/>[SuccessScreen.tsx]"]
  node_customer_profile["Customer profile"]
end

subgraph group_loyalty["Loyalty services"]
  node_loyalty_logic["Loyalty logic<br/>[loyalty.ts]"]
  node_branch_api["Branch services"]
end

subgraph group_admin["Staff portal"]
  node_staff_login["Staff sign-in<br/>[auth.tsx]"]
  node_branch_admin["Branch management<br/>[admin.branches.tsx]"]
  node_menu_admin["Menu management<br/>[admin.menu.tsx]"]
  node_product_editor["Product editor<br/>[ProductDialog.tsx]"]
  node_customer_admin["Customer records"]
  node_transactions["Transactions"]
  node_reports["Reports<br/>[admin.reports.tsx]"]
  node_settings["Portal settings<br/>[admin.settings.tsx]"]
end

subgraph group_platform["Data and runtime"]
  node_supabase_client["User Supabase<br/>[client.ts]"]
  node_admin_client["Admin Supabase<br/>[client.server.ts]"]
  node_product_images["Product images<br/>[product-images.ts]"]
  node_database[("Supabase")]
  node_router["Router<br/>[router.tsx]"]
  node_route_tree["Route registry<br/>[routeTree.gen.ts]"]
end

node_shopper(("Customer"))
node_staff(("Staff"))

node_shopper -.->|"opens branch"| node_branch_entry
node_branch_entry -.->|"starts shopping"| node_customer_auth
node_customer_auth -->|"authenticates"| node_loyalty_logic
node_loyalty_logic -->|"calls services"| node_branch_api
node_product_browse -->|"fetches products"| node_branch_api
node_shopper -.->|"builds cart"| node_cart
node_cart -.->|"continues checkout"| node_payment
node_payment -.->|"submits order"| node_loyalty_logic
node_loyalty_logic -->|"submits checkout"| node_branch_api
node_payment -.->|"shows result"| node_checkout_result
node_customer_profile -->|"loads progress"| node_branch_api
node_staff -->|"signs in"| node_staff_login
node_staff_login -->|"authenticates"| node_supabase_client
node_staff -.->|"manages branches"| node_branch_admin
node_staff -.->|"manages menu"| node_menu_admin
node_menu_admin -->|"opens editor"| node_product_editor
node_product_editor -->|"updates products"| node_supabase_client
node_product_editor -->|"uploads images"| node_product_images
node_product_images -->|"uses storage"| node_supabase_client
node_branch_admin -->|"loads branches"| node_supabase_client
node_branch_admin -->|"uses staff services"| node_branch_api
node_staff -.->|"reviews customers"| node_customer_admin
node_staff -.->|"reviews sales"| node_transactions
node_staff -.->|"views reports"| node_reports
node_staff -.->|"configures portal"| node_settings
node_branch_api -->|"uses privileged client"| node_admin_client
node_supabase_client -.->|"queries data"| node_database
node_admin_client -.->|"queries data"| node_database
node_router -->|"loads routes"| node_route_tree

click node_branch_entry "https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/b.%24token.tsx"
click node_customer_auth "https://github.com/manikanta-analogue/caneworld/blob/main/src/components/branch/CustomerAuth.tsx"
click node_product_browse "https://github.com/manikanta-analogue/caneworld/blob/main/src/lib/loyalty.ts"
click node_cart "https://github.com/manikanta-analogue/caneworld/blob/main/src/components/branch/CartScreen.tsx"
click node_payment "https://github.com/manikanta-analogue/caneworld/blob/main/src/components/branch/PaymentScreen.tsx"
click node_checkout_result "https://github.com/manikanta-analogue/caneworld/blob/main/src/components/branch/SuccessScreen.tsx"
click node_customer_profile "https://github.com/manikanta-analogue/caneworld/blob/main/src/components/branch/CustomerProfile.tsx"
click node_loyalty_logic "https://github.com/manikanta-analogue/caneworld/blob/main/src/lib/loyalty.ts"
click node_branch_api "https://github.com/manikanta-analogue/caneworld/blob/main/src/lib/branch.functions.ts"
click node_staff_login "https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/auth.tsx"
click node_branch_admin "https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/admin.branches.tsx"
click node_menu_admin "https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/admin.menu.tsx"
click node_product_editor "https://github.com/manikanta-analogue/caneworld/blob/main/src/components/admin/ProductDialog.tsx"
click node_customer_admin "https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/admin.customers.tsx"
click node_transactions "https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/admin.transactions.tsx"
click node_reports "https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/admin.reports.tsx"
click node_settings "https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/admin.settings.tsx"
click node_supabase_client "https://github.com/manikanta-analogue/caneworld/blob/main/src/integrations/supabase/client.ts"
click node_admin_client "https://github.com/manikanta-analogue/caneworld/blob/main/src/integrations/supabase/client.server.ts"
click node_product_images "https://github.com/manikanta-analogue/caneworld/blob/main/src/lib/product-images.ts"
click node_router "https://github.com/manikanta-analogue/caneworld/blob/main/src/router.tsx"
click node_route_tree "https://github.com/manikanta-analogue/caneworld/blob/main/src/routeTree.gen.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_branch_entry,node_customer_auth,node_product_browse,node_cart,node_payment,node_checkout_result,node_customer_profile toneBlue
class node_loyalty_logic,node_branch_api toneAmber
class node_staff_login,node_branch_admin,node_menu_admin,node_product_editor,node_customer_admin,node_transactions,node_reports,node_settings toneMint
class node_supabase_client,node_admin_client,node_product_images,node_database,node_router,node_route_tree toneRose
class node_shopper,node_staff toneIndigo
```

## Components

### Customer sales

- [Branch entry](https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/b.%24token.tsx): `src/routes/b.$token.tsx`
- [Customer auth](https://github.com/manikanta-analogue/caneworld/blob/main/src/components/branch/CustomerAuth.tsx): `src/components/branch/CustomerAuth.tsx`
- [Product browse](https://github.com/manikanta-analogue/caneworld/blob/main/src/lib/loyalty.ts): `src/lib/loyalty.ts`
- [Cart](https://github.com/manikanta-analogue/caneworld/blob/main/src/components/branch/CartScreen.tsx): `src/components/branch/CartScreen.tsx`
- [Payment](https://github.com/manikanta-analogue/caneworld/blob/main/src/components/branch/PaymentScreen.tsx): `src/components/branch/PaymentScreen.tsx`
- [Checkout result](https://github.com/manikanta-analogue/caneworld/blob/main/src/components/branch/SuccessScreen.tsx): `src/components/branch/SuccessScreen.tsx`
- [Customer profile](https://github.com/manikanta-analogue/caneworld/blob/main/src/components/branch/CustomerProfile.tsx): `src/components/branch/CustomerProfile.tsx`

### Loyalty services

- [Loyalty logic](https://github.com/manikanta-analogue/caneworld/blob/main/src/lib/loyalty.ts): `src/lib/loyalty.ts`
- [Branch services](https://github.com/manikanta-analogue/caneworld/blob/main/src/lib/branch.functions.ts): `src/lib/branch.functions.ts`

### Staff portal

- [Staff sign-in](https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/auth.tsx): `src/routes/auth.tsx`
- [Branch management](https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/admin.branches.tsx): `src/routes/admin.branches.tsx`
- [Menu management](https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/admin.menu.tsx): `src/routes/admin.menu.tsx`
- [Product editor](https://github.com/manikanta-analogue/caneworld/blob/main/src/components/admin/ProductDialog.tsx): `src/components/admin/ProductDialog.tsx`
- [Customer records](https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/admin.customers.tsx): `src/routes/admin.customers.tsx`
- [Transactions](https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/admin.transactions.tsx): `src/routes/admin.transactions.tsx`
- [Reports](https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/admin.reports.tsx): `src/routes/admin.reports.tsx`
- [Portal settings](https://github.com/manikanta-analogue/caneworld/blob/main/src/routes/admin.settings.tsx): `src/routes/admin.settings.tsx`

### Data and runtime

- [User Supabase](https://github.com/manikanta-analogue/caneworld/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Admin Supabase](https://github.com/manikanta-analogue/caneworld/blob/main/src/integrations/supabase/client.server.ts): `src/integrations/supabase/client.server.ts`
- [Product images](https://github.com/manikanta-analogue/caneworld/blob/main/src/lib/product-images.ts): `src/lib/product-images.ts`
- **Supabase**
- [Router](https://github.com/manikanta-analogue/caneworld/blob/main/src/router.tsx): `src/router.tsx`
- [Route registry](https://github.com/manikanta-analogue/caneworld/blob/main/src/routeTree.gen.ts): `src/routeTree.gen.ts`

### Other components

- **Customer**
- **Staff**

## Connections

- Customer → Branch entry: opens branch (evidence: `README.md`)
- Branch entry → Customer auth: starts shopping
- Customer auth → Loyalty logic: authenticates (evidence: `src/components/branch/CustomerAuth.tsx`)
- Loyalty logic → Branch services: calls services (evidence: `src/lib/loyalty.ts`)
- Product browse → Branch services: fetches products (evidence: `src/lib/loyalty.ts`)
- Customer → Cart: builds cart (evidence: `README.md`)
- Cart → Payment: continues checkout
- Payment → Loyalty logic: submits order
- Loyalty logic → Branch services: submits checkout (evidence: `src/lib/loyalty.ts`)
- Payment → Checkout result: shows result
- Customer profile → Branch services: loads progress (evidence: `src/components/branch/CustomerProfile.tsx`)
- Staff → Staff sign-in: signs in (evidence: `src/routes/auth.tsx`)
- Staff sign-in → User Supabase: authenticates (evidence: `src/routes/auth.tsx`)
- Staff → Branch management: manages branches (evidence: `README.md`)
- Staff → Menu management: manages menu (evidence: `README.md`)
- Menu management → Product editor: opens editor (evidence: `src/routes/admin.menu.tsx`)
- Product editor → User Supabase: updates products (evidence: `src/components/admin/ProductDialog.tsx`)
- Product editor → Product images: uploads images (evidence: `src/components/admin/ProductDialog.tsx`)
- Product images → User Supabase: uses storage (evidence: `src/lib/product-images.ts`)
- Branch management → User Supabase: loads branches (evidence: `src/routes/admin.branches.tsx`)
- Branch management → Branch services: uses staff services (evidence: `src/routes/admin.branches.tsx`)
- Staff → Customer records: reviews customers (evidence: `README.md`)
- Staff → Transactions: reviews sales (evidence: `README.md`)
- Staff → Reports: views reports (evidence: `README.md`)
- Staff → Portal settings: configures portal (evidence: `README.md`)
- Branch services → Admin Supabase: uses privileged client (evidence: `src/lib/branch.functions.ts`)
- User Supabase → Supabase: queries data
- Admin Supabase → Supabase: queries data
- Router → Route registry: loads routes (evidence: `src/router.tsx`)
