# chris903224/merchandise-system architecture

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

- Interactive diagram: https://gitdiagram.com/chris903224/merchandise-system
- Repository: https://github.com/chris903224/merchandise-system

## Overview

SJC Merchandise is a student-focused school merchandise storefront with separate administrative and organization workflows. Students browse products, manage a cart, check out, pay online, and track orders; account features include authentication, profiles, favorites, and notifications. The React app routes users to these interfaces, while services connect the workflows to Supabase and payment/email integrations. Admin and organization interfaces support product, inventory, order, and payment operations. The map reflects the README and shown excerpts; unsampled subsystems are included where documented, but their internal calls are not inferred.

Main entry points: [`src/lib/supabaseClient.ts`](https://github.com/chris903224/merchandise-system/blob/main/src/lib/supabaseClient.ts) (Supabase Client), [`src/services/orders.ts`](https://github.com/chris903224/merchandise-system/blob/main/src/services/orders.ts) (Order Service), [`src/App.tsx`](https://github.com/chris903224/merchandise-system/blob/main/src/App.tsx) (Application Router), [`src/services/admin/adminOrdersService.ts`](https://github.com/chris903224/merchandise-system/blob/main/src/services/admin/adminOrdersService.ts) (Admin Order Operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Student Storefront"]
  node_catalog["Catalog and Product Detail<br/>[CatalogPage.tsx]"]
  node_product_service["Product Service<br/>[products.ts]"]
  node_cart["Cart<br/>[CartPage.tsx]"]
  node_checkout["Checkout<br/>[CheckoutPage.tsx]"]
  node_orders["Order History and Detail"]
  node_order_service["Order Service<br/>[orders.ts]"]
end

subgraph group_identity["Accounts and Preferences"]
  node_auth["Registration and Login<br/>[authService.ts]"]
  node_auth_pages["Authentication Screens<br/>[LoginPage.tsx]"]
  node_profile["Profile and Settings<br/>[ProfilePages.tsx]"]
  node_profile_storage["Profile Storage<br/>[storage.ts]"]
  node_favorites["Favorites<br/>[favorites.ts]"]
  node_notifications["Notifications"]
end

subgraph group_operations["Admin and Organization"]
  node_admin["Administrative Console<br/>[DashboardPage.tsx]"]
  node_admin_orders["Admin Order Operations"]
  node_org["Organization Workspace<br/>[DashboardPage.tsx]"]
  node_org_orders["Organization Order Service<br/>[orgOrderService.ts]"]
  node_org_products["Organization Products<br/>[productService.ts]"]
end

subgraph group_platform["Application and Data"]
  node_app["Application Router<br/>[App.tsx]"]
  node_store["Application State<br/>[store.tsx]"]
  node_supabase["Supabase Client<br/>[supabaseClient.ts]"]
  node_database[("Supabase Data")]
  node_cache[("Browser Cache<br/>[cache.ts]")]
end

subgraph group_integrations["External Integrations"]
  node_payment["Payment Flow<br/>[paymongo.ts]"]
  node_payment_api["PayMongo API<br/>[create-checkout.ts]"]
  node_payment_verify["Payment Verification<br/>[verify.ts]"]
  node_payment_webhook["Payment Webhook<br/>[paymongo.ts]"]
  node_email["Order Email"]
  node_otp_api["OTP Endpoint<br/>[send-otp.ts]"]
  node_server["Backend Server<br/>[server.ts]"]
  node_email_provider["Brevo Email"]
end

node_student(("Student"))

node_student -->|"uses"| node_app
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_checkout
node_app -->|"routes to"| node_orders
node_app -->|"routes to"| node_auth_pages
node_catalog -.->|"loads products"| node_product_service
node_product_service -->|"queries"| node_supabase
node_product_service -->|"uses cache"| node_cache
node_checkout -.->|"starts payment"| node_payment
node_payment -.->|"requests checkout"| node_payment_api
node_payment_api -->|"PayMongo checkout"| node_payment
node_payment_verify -.->|"verifies payment"| node_payment
node_payment_webhook -.->|"updates payment"| node_order_service
node_checkout -.->|"submits order"| node_order_service
node_order_service -.->|"persists orders"| node_supabase
node_orders -->|"loads order"| node_order_service
node_auth_pages -.->|"authenticates"| node_auth
node_auth -->|"uses auth"| node_supabase
node_profile -->|"updates profile"| node_profile_storage
node_profile_storage -->|"reads and writes"| node_supabase
node_store -->|"updates orders"| node_order_service
node_store -->|"creates alerts"| node_notifications
node_admin -.->|"manages orders"| node_admin_orders
node_admin_orders -->|"loads and updates"| node_order_service
node_admin_orders -->|"loads products"| node_product_service
node_admin_orders -->|"triggers status alerts"| node_notifications
node_org -.->|"manages orders"| node_org_orders
node_org -.->|"manages products"| node_org_products
node_org_orders -->|"accesses data"| node_supabase
node_org_orders -->|"triggers order alerts"| node_notifications
node_email -->|"sends email"| node_email_provider
node_otp_api -.->|"sends OTP"| node_email_provider
node_server -.->|"backend access"| node_supabase
node_supabase -->|"persists application data"| node_database

click node_app "https://github.com/chris903224/merchandise-system/blob/main/src/App.tsx"
click node_store "https://github.com/chris903224/merchandise-system/blob/main/src/store.tsx"
click node_supabase "https://github.com/chris903224/merchandise-system/blob/main/src/lib/supabaseClient.ts"
click node_cache "https://github.com/chris903224/merchandise-system/blob/main/src/utils/cache.ts"
click node_catalog "https://github.com/chris903224/merchandise-system/blob/main/src/pages/CatalogPage.tsx"
click node_product_service "https://github.com/chris903224/merchandise-system/blob/main/src/services/products.ts"
click node_cart "https://github.com/chris903224/merchandise-system/blob/main/src/pages/CartPage.tsx"
click node_checkout "https://github.com/chris903224/merchandise-system/blob/main/src/pages/CheckoutPage.tsx"
click node_payment "https://github.com/chris903224/merchandise-system/blob/main/src/services/paymongo.ts"
click node_payment_api "https://github.com/chris903224/merchandise-system/blob/main/api/paymongo/create-checkout.ts"
click node_payment_verify "https://github.com/chris903224/merchandise-system/blob/main/api/paymongo/verify.ts"
click node_payment_webhook "https://github.com/chris903224/merchandise-system/blob/main/api/webhooks/paymongo.ts"
click node_orders "https://github.com/chris903224/merchandise-system/blob/main/src/pages/OrderDetailsPage.tsx"
click node_order_service "https://github.com/chris903224/merchandise-system/blob/main/src/services/orders.ts"
click node_auth "https://github.com/chris903224/merchandise-system/blob/main/src/services/authService.ts"
click node_auth_pages "https://github.com/chris903224/merchandise-system/blob/main/src/pages/LoginPage.tsx"
click node_profile "https://github.com/chris903224/merchandise-system/blob/main/src/pages/ProfilePages.tsx"
click node_profile_storage "https://github.com/chris903224/merchandise-system/blob/main/src/data/storage.ts"
click node_favorites "https://github.com/chris903224/merchandise-system/blob/main/src/services/favorites.ts"
click node_notifications "https://github.com/chris903224/merchandise-system/blob/main/src/services/userNotifications.ts"
click node_email "https://github.com/chris903224/merchandise-system/blob/main/api/notifications/send-order-email.ts"
click node_otp_api "https://github.com/chris903224/merchandise-system/blob/main/api/send-otp.ts"
click node_admin "https://github.com/chris903224/merchandise-system/blob/main/src/pages/admin/DashboardPage.tsx"
click node_admin_orders "https://github.com/chris903224/merchandise-system/blob/main/src/services/admin/adminOrdersService.ts"
click node_org "https://github.com/chris903224/merchandise-system/blob/main/src/pages/organization/DashboardPage.tsx"
click node_org_orders "https://github.com/chris903224/merchandise-system/blob/main/src/services/organization/orgOrderService.ts"
click node_org_products "https://github.com/chris903224/merchandise-system/blob/main/src/services/organization/productService.ts"
click node_server "https://github.com/chris903224/merchandise-system/blob/main/server/server.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_catalog,node_product_service,node_cart,node_checkout,node_orders,node_order_service toneBlue
class node_auth,node_auth_pages,node_profile,node_profile_storage,node_favorites,node_notifications toneAmber
class node_admin,node_admin_orders,node_org,node_org_orders,node_org_products toneMint
class node_app,node_store,node_supabase,node_database,node_cache toneRose
class node_payment,node_payment_api,node_payment_verify,node_payment_webhook,node_email,node_otp_api,node_server,node_email_provider,node_student toneIndigo
```

## Components

### Student Storefront

- [Catalog and Product Detail](https://github.com/chris903224/merchandise-system/blob/main/src/pages/CatalogPage.tsx): `src/pages/CatalogPage.tsx`
- [Product Service](https://github.com/chris903224/merchandise-system/blob/main/src/services/products.ts): `src/services/products.ts`
- [Cart](https://github.com/chris903224/merchandise-system/blob/main/src/pages/CartPage.tsx): `src/pages/CartPage.tsx`
- [Checkout](https://github.com/chris903224/merchandise-system/blob/main/src/pages/CheckoutPage.tsx): `src/pages/CheckoutPage.tsx`
- [Order History and Detail](https://github.com/chris903224/merchandise-system/blob/main/src/pages/OrderDetailsPage.tsx): `src/pages/OrderDetailsPage.tsx`
- [Order Service](https://github.com/chris903224/merchandise-system/blob/main/src/services/orders.ts): `src/services/orders.ts`

### Accounts and Preferences

- [Registration and Login](https://github.com/chris903224/merchandise-system/blob/main/src/services/authService.ts): `src/services/authService.ts`
- [Authentication Screens](https://github.com/chris903224/merchandise-system/blob/main/src/pages/LoginPage.tsx): `src/pages/LoginPage.tsx`
- [Profile and Settings](https://github.com/chris903224/merchandise-system/blob/main/src/pages/ProfilePages.tsx): `src/pages/ProfilePages.tsx`
- [Profile Storage](https://github.com/chris903224/merchandise-system/blob/main/src/data/storage.ts): `src/data/storage.ts`
- [Favorites](https://github.com/chris903224/merchandise-system/blob/main/src/services/favorites.ts): `src/services/favorites.ts`
- [Notifications](https://github.com/chris903224/merchandise-system/blob/main/src/services/userNotifications.ts): `src/services/userNotifications.ts`

### Admin and Organization

- [Administrative Console](https://github.com/chris903224/merchandise-system/blob/main/src/pages/admin/DashboardPage.tsx): `src/pages/admin/DashboardPage.tsx`
- [Admin Order Operations](https://github.com/chris903224/merchandise-system/blob/main/src/services/admin/adminOrdersService.ts): `src/services/admin/adminOrdersService.ts`
- [Organization Workspace](https://github.com/chris903224/merchandise-system/blob/main/src/pages/organization/DashboardPage.tsx): `src/pages/organization/DashboardPage.tsx`
- [Organization Order Service](https://github.com/chris903224/merchandise-system/blob/main/src/services/organization/orgOrderService.ts): `src/services/organization/orgOrderService.ts`
- [Organization Products](https://github.com/chris903224/merchandise-system/blob/main/src/services/organization/productService.ts): `src/services/organization/productService.ts`

### Application and Data

- [Application Router](https://github.com/chris903224/merchandise-system/blob/main/src/App.tsx): `src/App.tsx`
- [Application State](https://github.com/chris903224/merchandise-system/blob/main/src/store.tsx): `src/store.tsx`
- [Supabase Client](https://github.com/chris903224/merchandise-system/blob/main/src/lib/supabaseClient.ts): `src/lib/supabaseClient.ts`
- **Supabase Data**
- [Browser Cache](https://github.com/chris903224/merchandise-system/blob/main/src/utils/cache.ts): `src/utils/cache.ts`

### External Integrations

- [Payment Flow](https://github.com/chris903224/merchandise-system/blob/main/src/services/paymongo.ts): `src/services/paymongo.ts`
- [PayMongo API](https://github.com/chris903224/merchandise-system/blob/main/api/paymongo/create-checkout.ts): `api/paymongo/create-checkout.ts`
- [Payment Verification](https://github.com/chris903224/merchandise-system/blob/main/api/paymongo/verify.ts): `api/paymongo/verify.ts`
- [Payment Webhook](https://github.com/chris903224/merchandise-system/blob/main/api/webhooks/paymongo.ts): `api/webhooks/paymongo.ts`
- [Order Email](https://github.com/chris903224/merchandise-system/blob/main/api/notifications/send-order-email.ts): `api/notifications/send-order-email.ts`
- [OTP Endpoint](https://github.com/chris903224/merchandise-system/blob/main/api/send-otp.ts): `api/send-otp.ts`
- [Backend Server](https://github.com/chris903224/merchandise-system/blob/main/server/server.ts): `server/server.ts`
- **Brevo Email**

### Other components

- **Student**

## Connections

- Student → Application Router: uses (evidence: `README.md`)
- Application Router → Catalog and Product Detail: routes to (evidence: `src/App.tsx`)
- Application Router → Checkout: routes to (evidence: `src/App.tsx`)
- Application Router → Order History and Detail: routes to (evidence: `src/App.tsx`)
- Application Router → Authentication Screens: routes to (evidence: `src/App.tsx`)
- Catalog and Product Detail → Product Service: loads products
- Product Service → Supabase Client: queries (evidence: `src/services/products.ts`)
- Product Service → Browser Cache: uses cache (evidence: `src/services/products.ts`)
- Checkout → Payment Flow: starts payment
- Payment Flow → PayMongo API: requests checkout
- PayMongo API → Payment Flow: PayMongo checkout (evidence: `README.md`)
- Payment Verification → Payment Flow: verifies payment
- Payment Webhook → Order Service: updates payment
- Checkout → Order Service: submits order
- Order Service → Supabase Client: persists orders
- Order History and Detail → Order Service: loads order (evidence: `src/pages/OrderDetailsPage.tsx`)
- Authentication Screens → Registration and Login: authenticates
- Registration and Login → Supabase Client: uses auth (evidence: `src/services/authService.ts`)
- Profile and Settings → Profile Storage: updates profile
- Profile Storage → Supabase Client: reads and writes (evidence: `src/data/storage.ts`)
- Application State → Order Service: updates orders (evidence: `src/store.tsx`)
- Application State → Notifications: creates alerts (evidence: `src/store.tsx`)
- Administrative Console → Admin Order Operations: manages orders
- Admin Order Operations → Order Service: loads and updates (evidence: `src/services/admin/adminOrdersService.ts`)
- Admin Order Operations → Product Service: loads products (evidence: `src/services/admin/adminOrdersService.ts`)
- Admin Order Operations → Notifications: triggers status alerts (evidence: `src/services/admin/adminOrdersService.ts`)
- Organization Workspace → Organization Order Service: manages orders
- Organization Workspace → Organization Products: manages products
- Organization Order Service → Supabase Client: accesses data (evidence: `src/services/organization/orgOrderService.ts`)
- Organization Order Service → Notifications: triggers order alerts (evidence: `src/services/organization/orgOrderService.ts`)
- Order Email → Brevo Email: sends email (evidence: `README.md`)
- OTP Endpoint → Brevo Email: sends OTP
- Backend Server → Supabase Client: backend access
- Supabase Client → Supabase Data: persists application data (evidence: `README.md`)
