# musadiq12/edu-wallet-hub architecture

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

- Interactive diagram: https://gitdiagram.com/musadiq12/edu-wallet-hub
- Repository: https://github.com/musadiq12/edu-wallet-hub

## Overview

Edu Wallet is a digital educational-resource storefront with a manual UPI purchase and verification workflow. Students browse the catalog and product details, submit payment evidence at checkout, and await admin verification and delivery. Admins manage products, orders, customers, free resources, messages, and site settings. The graph reflects the sampled calls and documented capabilities; some listed routes and the delivery function were not excerpted, so their internal links are left out.

Main entry points: [`src/lib/catalog.ts`](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/lib/catalog.ts) (Product catalog data), [`src/lib/admin.ts`](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/lib/admin.ts) (Admin data operations), [`src/integrations/supabase/client.ts`](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/integrations/supabase/client.ts) (Supabase client), [`src/components/admin/ProductForm.tsx`](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/components/admin/ProductForm.tsx) (Product management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Student storefront"]
  node_home["Home<br/>[index.tsx]"]
  node_storefront_hero["Storefront hero<br/>[StorefrontHero.tsx]"]
  node_shop["Shop catalog<br/>[shop.index.tsx]"]
  node_product_detail["Product details<br/>[shop.$slug.tsx]"]
  node_free_resources["Free resources<br/>[free-resources.tsx]"]
  node_library["Purchased library<br/>[library.tsx]"]
  node_catalog["Product catalog data<br/>[catalog.ts]"]
end

subgraph group_commerce["Purchase and delivery"]
  node_checkout["UPI checkout<br/>[checkout.$slug.tsx]"]
  node_delivery["Verify and deliver<br/>[index.ts]"]
end

subgraph group_admin["Administration"]
  node_orders_admin["Order management<br/>[admin.orders.tsx]"]
  node_admin_data["Admin data operations<br/>[admin.ts]"]
  node_product_admin["Product management<br/>[ProductForm.tsx]"]
  node_file_field["Product file upload<br/>[AdminFileField.tsx]"]
  node_customer_admin["Customer management"]
  node_free_admin["Free resource management"]
  node_settings_admin["Site settings admin<br/>[admin.settings.tsx]"]
end

subgraph group_platform["Shared platform"]
  node_auth["Authentication and roles<br/>[auth.tsx]"]
  node_supabase_client["Supabase client<br/>[client.ts]"]
  node_supabase[("Supabase backend")]
  node_site_settings["Settings data access<br/>[settings.ts]"]
  node_r2[("R2 file storage")]
  node_r2_worker["R2 upload worker<br/>[index.ts]"]
end

node_student(("Student"))

node_student -->|"opens"| node_home
node_home -->|"renders"| node_storefront_hero
node_home -->|"queries products"| node_catalog
node_home -->|"links to"| node_shop
node_student -->|"browses"| node_shop
node_shop -.->|"loads products"| node_catalog
node_student -->|"opens"| node_product_detail
node_product_detail -->|"loads product"| node_catalog
node_student -->|"browses"| node_free_resources
node_free_resources -.->|"loads free items"| node_catalog
node_student -->|"starts purchase"| node_checkout
node_checkout -->|"loads product"| node_catalog
node_checkout -->|"checks session"| node_auth
node_student -->|"views resources"| node_library
node_library -->|"loads products"| node_catalog
node_library -->|"checks session"| node_auth
node_catalog -->|"queries catalog"| node_supabase_client
node_supabase_client -->|"connects"| node_supabase
node_auth -->|"uses auth"| node_supabase_client
node_checkout -.->|"submits payment details"| node_supabase
node_orders_admin -->|"loads order data"| node_admin_data
node_orders_admin -.->|"requests delivery"| node_delivery
node_admin_data -->|"queries admin data"| node_supabase_client
node_product_admin -->|"renders upload field"| node_file_field
node_product_admin -->|"uses admin operations"| node_admin_data
node_product_admin -->|"uses product types"| node_catalog
node_product_admin -->|"writes product data"| node_supabase_client
node_file_field -->|"uses upload helpers"| node_admin_data
node_customer_admin -.->|"loads customers"| node_admin_data
node_free_admin -.->|"manages resources"| node_admin_data
node_settings_admin -.->|"manages settings"| node_site_settings
node_site_settings -->|"reads and saves"| node_supabase_client
node_delivery -.->|"accesses backend"| node_supabase
node_admin_data -->|"uploads files"| node_r2_worker
node_r2_worker -.->|"stores files"| node_r2

click node_home "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/index.tsx"
click node_storefront_hero "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/components/StorefrontHero.tsx"
click node_shop "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/shop.index.tsx"
click node_product_detail "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/shop.%24slug.tsx"
click node_free_resources "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/free-resources.tsx"
click node_library "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/library.tsx"
click node_catalog "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/lib/catalog.ts"
click node_checkout "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/checkout.%24slug.tsx"
click node_orders_admin "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/admin.orders.tsx"
click node_admin_data "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/lib/admin.ts"
click node_product_admin "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/components/admin/ProductForm.tsx"
click node_file_field "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/components/admin/AdminFileField.tsx"
click node_customer_admin "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/admin.customers.tsx"
click node_free_admin "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/admin.free-resources.tsx"
click node_settings_admin "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/admin.settings.tsx"
click node_auth "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/lib/auth.tsx"
click node_supabase_client "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/integrations/supabase/client.ts"
click node_site_settings "https://github.com/musadiq12/edu-wallet-hub/blob/main/src/lib/settings.ts"
click node_delivery "https://github.com/musadiq12/edu-wallet-hub/blob/main/supabase/functions/verify-and-deliver/index.ts"
click node_r2_worker "https://github.com/musadiq12/edu-wallet-hub/blob/main/cloudflare/r2-worker/src/index.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_home,node_storefront_hero,node_shop,node_product_detail,node_free_resources,node_library,node_catalog toneBlue
class node_checkout,node_delivery toneAmber
class node_orders_admin,node_admin_data,node_product_admin,node_file_field,node_customer_admin,node_free_admin,node_settings_admin toneMint
class node_auth,node_supabase_client,node_supabase,node_site_settings,node_r2,node_r2_worker toneRose
class node_student toneIndigo
```

## Components

### Student storefront

- [Home](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Storefront hero](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/components/StorefrontHero.tsx): `src/components/StorefrontHero.tsx`
- [Shop catalog](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/shop.index.tsx): `src/routes/shop.index.tsx`
- [Product details](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/shop.%24slug.tsx): `src/routes/shop.$slug.tsx`
- [Free resources](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/free-resources.tsx): `src/routes/free-resources.tsx`
- [Purchased library](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/library.tsx): `src/routes/library.tsx`
- [Product catalog data](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/lib/catalog.ts): `src/lib/catalog.ts`

### Purchase and delivery

- [UPI checkout](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/checkout.%24slug.tsx): `src/routes/checkout.$slug.tsx`
- [Verify and deliver](https://github.com/musadiq12/edu-wallet-hub/blob/main/supabase/functions/verify-and-deliver/index.ts): `supabase/functions/verify-and-deliver/index.ts`

### Administration

- [Order management](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/admin.orders.tsx): `src/routes/admin.orders.tsx`
- [Admin data operations](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/lib/admin.ts): `src/lib/admin.ts`
- [Product management](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/components/admin/ProductForm.tsx): `src/components/admin/ProductForm.tsx`
- [Product file upload](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/components/admin/AdminFileField.tsx): `src/components/admin/AdminFileField.tsx`
- [Customer management](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/admin.customers.tsx): `src/routes/admin.customers.tsx`
- [Free resource management](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/admin.free-resources.tsx): `src/routes/admin.free-resources.tsx`
- [Site settings admin](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/routes/admin.settings.tsx): `src/routes/admin.settings.tsx`

### Shared platform

- [Authentication and roles](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/lib/auth.tsx): `src/lib/auth.tsx`
- [Supabase client](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- **Supabase backend**
- [Settings data access](https://github.com/musadiq12/edu-wallet-hub/blob/main/src/lib/settings.ts): `src/lib/settings.ts`
- **R2 file storage**
- [R2 upload worker](https://github.com/musadiq12/edu-wallet-hub/blob/main/cloudflare/r2-worker/src/index.ts): `cloudflare/r2-worker/src/index.ts`

### Other components

- **Student**

## Connections

- Student → Home: opens
- Home → Storefront hero: renders (evidence: `src/routes/index.tsx`)
- Home → Product catalog data: queries products (evidence: `src/routes/index.tsx`)
- Home → Shop catalog: links to (evidence: `src/routes/index.tsx`)
- Student → Shop catalog: browses
- Shop catalog → Product catalog data: loads products
- Student → Product details: opens
- Product details → Product catalog data: loads product (evidence: `src/routes/shop.$slug.tsx`)
- Student → Free resources: browses
- Free resources → Product catalog data: loads free items
- Student → UPI checkout: starts purchase
- UPI checkout → Product catalog data: loads product (evidence: `src/routes/checkout.$slug.tsx`)
- UPI checkout → Authentication and roles: checks session (evidence: `src/routes/checkout.$slug.tsx`)
- Student → Purchased library: views resources
- Purchased library → Product catalog data: loads products (evidence: `src/routes/library.tsx`)
- Purchased library → Authentication and roles: checks session (evidence: `src/routes/library.tsx`)
- Product catalog data → Supabase client: queries catalog (evidence: `src/lib/catalog.ts`)
- Supabase client → Supabase backend: connects (evidence: `src/integrations/supabase/client.ts`)
- Authentication and roles → Supabase client: uses auth (evidence: `src/lib/auth.tsx`)
- UPI checkout → Supabase backend: submits payment details
- Order management → Admin data operations: loads order data (evidence: `src/routes/admin.orders.tsx`)
- Order management → Verify and deliver: requests delivery
- Admin data operations → Supabase client: queries admin data (evidence: `src/lib/admin.ts`)
- Product management → Product file upload: renders upload field (evidence: `src/components/admin/ProductForm.tsx`)
- Product management → Admin data operations: uses admin operations (evidence: `src/components/admin/ProductForm.tsx`)
- Product management → Product catalog data: uses product types (evidence: `src/components/admin/ProductForm.tsx`)
- Product management → Supabase client: writes product data (evidence: `src/components/admin/ProductForm.tsx`)
- Product file upload → Admin data operations: uses upload helpers (evidence: `src/components/admin/AdminFileField.tsx`)
- Customer management → Admin data operations: loads customers
- Free resource management → Admin data operations: manages resources
- Site settings admin → Settings data access: manages settings
- Settings data access → Supabase client: reads and saves (evidence: `src/lib/settings.ts`)
- Verify and deliver → Supabase backend: accesses backend
- Admin data operations → R2 upload worker: uploads files (evidence: `src/lib/admin.ts`)
- R2 upload worker → R2 file storage: stores files
