# ckstudentcouncil/souvenir architecture

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

- Interactive diagram: https://gitdiagram.com/ckstudentcouncil/souvenir
- Repository: https://github.com/ckstudentcouncil/souvenir

## Overview

CKSC Online Souvenir is a merchandise storefront with staff operations and financial reporting. Buyers browse products, build a cart, and submit an order; the server rechecks pricing and stores it, after which buyers can track it and receive email confirmation. Staff review and manage orders, send notifications, and handle survey and in-person sales workflows; super admins also manage accounts and view sales analytics. Several secondary subsystems are included from README capabilities, but their internal call paths were not sampled, so those links are documented rather than inferred.

Main entry points: [`functions/index.js`](https://github.com/ckstudentcouncil/souvenir/blob/main/functions/index.js) (Order creation), [`src/pages/SalesAnalyticsPage.vue`](https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/SalesAnalyticsPage.vue) (Financial report), [`src/services/orderService.js`](https://github.com/ckstudentcouncil/souvenir/blob/main/src/services/orderService.js) (Order access), [`src/pages/CartPage.vue`](https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/CartPage.vue) (Cart and checkout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shop["Storefront"]
  node_catalog["Product catalog<br/>[catalog.js]"]
  node_product_page["Product pages<br/>[ProductPage.vue]"]
  node_cart["Cart and checkout<br/>[CartPage.vue]"]
  node_cart_store["Cart state<br/>[cart.js]"]
  node_router["Routes and gate<br/>[index.js]"]
end

subgraph group_orders["Orders"]
  node_order_create["Order creation<br/>[index.js]"]
  node_pricing["Pricing rules<br/>[pricing.js]"]
  node_order_build["Order validation<br/>[orders.js]"]
  node_order_service["Order access<br/>[orderService.js]"]
  node_order_tracking["Order history<br/>[OrdersPage.vue]"]
  node_order_detail["Order details"]
end

subgraph group_staff["Staff operations"]
  node_admin_orders["Order administration<br/>[AdminPage.vue]"]
  node_survey["Survey workflows"]
  node_stand_sales["Stand sales<br/>[StandSalesPage.vue]"]
  node_account_admin["Staff accounts<br/>[AccountPage.vue]"]
end

subgraph group_backend["Cloud backend"]
  node_firestore[("Firestore")]
  node_auth["Firebase authentication<br/>[staffAuth.js]"]
  node_confirmation["Confirmation email<br/>[index.js]"]
  node_mailer["Email delivery<br/>[mailer.js]"]
  node_bulk_notify["Bulk notifications<br/>[notifications.js]"]
  node_mail_queue["Mail queue<br/>[mailQueue.js]"]
  node_queue_core["Queue processing<br/>[mailQueueCore.js]"]
end

subgraph group_reports["Sales reporting"]
  node_analytics_page["Financial report"]
  node_analytics_data["Analytics data"]
  node_archive[("Past sales archive")]
  node_analytics_chart["Report charts<br/>[LineChart.vue]"]
  node_pdf["PDF export<br/>[pdf.js]"]
end

node_buyer(("Buyer"))
node_staff_user(("Staff user"))

node_buyer -->|"browses"| node_product_page
node_product_page -.->|"uses catalog"| node_catalog
node_buyer -->|"checks out"| node_cart
node_cart -.->|"uses state"| node_cart_store
node_cart -->|"submits order"| node_order_create
node_order_create -.->|"rechecks prices"| node_pricing
node_order_create -->|"validates order"| node_order_build
node_order_create -->|"writes order"| node_firestore
node_order_build -->|"validates items"| node_catalog
node_order_build -->|"calculates price"| node_pricing
node_order_service -.->|"reads and writes"| node_firestore
node_order_tracking -.->|"loads orders"| node_order_service
node_order_detail -.->|"loads order"| node_order_service
node_buyer -->|"tracks orders"| node_order_tracking
node_order_create -->|"triggers email"| node_confirmation
node_confirmation -->|"sends message"| node_mailer
node_confirmation -->|"watches new order"| node_firestore
node_staff_user -->|"opens staff area"| node_router
node_router -->|"checks role"| node_auth
node_staff_user -->|"manages orders"| node_admin_orders
node_admin_orders -.->|"updates orders"| node_order_service
node_staff_user -->|"requests notices"| node_bulk_notify
node_bulk_notify -->|"enqueues batches"| node_mail_queue
node_mail_queue -->|"delegates queue"| node_queue_core
node_queue_core -->|"sends messages"| node_mailer
node_staff_user -->|"reviews surveys"| node_survey
node_staff_user -.->|"records sales"| node_stand_sales
node_staff_user -->|"manages accounts"| node_account_admin
node_staff_user -->|"views report"| node_analytics_page
node_analytics_page -.->|"loads metrics"| node_analytics_data
node_analytics_data -->|"reads live orders"| node_firestore
node_analytics_data -->|"loads past sales"| node_archive
node_analytics_page -.->|"renders charts"| node_analytics_chart
node_analytics_page -->|"exports PDF"| node_pdf

click node_catalog "https://github.com/ckstudentcouncil/souvenir/blob/main/functions/shared/catalog.js"
click node_product_page "https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/ProductPage.vue"
click node_cart "https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/CartPage.vue"
click node_cart_store "https://github.com/ckstudentcouncil/souvenir/blob/main/src/stores/cart.js"
click node_router "https://github.com/ckstudentcouncil/souvenir/blob/main/src/router/index.js"
click node_order_create "https://github.com/ckstudentcouncil/souvenir/blob/main/functions/index.js"
click node_pricing "https://github.com/ckstudentcouncil/souvenir/blob/main/functions/shared/pricing.js"
click node_order_build "https://github.com/ckstudentcouncil/souvenir/blob/main/functions/lib/orders.js"
click node_order_service "https://github.com/ckstudentcouncil/souvenir/blob/main/src/services/orderService.js"
click node_order_tracking "https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/OrdersPage.vue"
click node_order_detail "https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/OrderDetailPage.vue"
click node_auth "https://github.com/ckstudentcouncil/souvenir/blob/main/src/services/staffAuth.js"
click node_confirmation "https://github.com/ckstudentcouncil/souvenir/blob/main/functions/index.js"
click node_mailer "https://github.com/ckstudentcouncil/souvenir/blob/main/functions/lib/mailer.js"
click node_bulk_notify "https://github.com/ckstudentcouncil/souvenir/blob/main/functions/lib/notifications.js"
click node_mail_queue "https://github.com/ckstudentcouncil/souvenir/blob/main/functions/lib/mailQueue.js"
click node_queue_core "https://github.com/ckstudentcouncil/souvenir/blob/main/functions/lib/mailQueueCore.js"
click node_admin_orders "https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/AdminPage.vue"
click node_survey "https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/SurveyAdminPage.vue"
click node_stand_sales "https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/StandSalesPage.vue"
click node_account_admin "https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/AccountPage.vue"
click node_analytics_page "https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/SalesAnalyticsPage.vue"
click node_analytics_data "https://github.com/ckstudentcouncil/souvenir/blob/main/src/composables/useSalesAnalytics.js"
click node_archive "https://github.com/ckstudentcouncil/souvenir/blob/main/src/services/salesArchiveService.js"
click node_analytics_chart "https://github.com/ckstudentcouncil/souvenir/blob/main/src/components/analytics/LineChart.vue"
click node_pdf "https://github.com/ckstudentcouncil/souvenir/blob/main/src/utils/pdf.js"

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_page,node_cart,node_cart_store,node_router,node_staff_user toneBlue
class node_order_create,node_pricing,node_order_build,node_order_service,node_order_tracking,node_order_detail toneAmber
class node_admin_orders,node_survey,node_stand_sales,node_account_admin toneMint
class node_firestore,node_auth,node_confirmation,node_mailer,node_bulk_notify,node_mail_queue,node_queue_core toneRose
class node_analytics_page,node_analytics_data,node_archive,node_analytics_chart,node_pdf,node_buyer toneIndigo
```

## Components

### Storefront

- [Product catalog](https://github.com/ckstudentcouncil/souvenir/blob/main/functions/shared/catalog.js): `functions/shared/catalog.js`
- [Product pages](https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/ProductPage.vue): `src/pages/ProductPage.vue`
- [Cart and checkout](https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/CartPage.vue): `src/pages/CartPage.vue`
- [Cart state](https://github.com/ckstudentcouncil/souvenir/blob/main/src/stores/cart.js): `src/stores/cart.js`
- [Routes and gate](https://github.com/ckstudentcouncil/souvenir/blob/main/src/router/index.js): `src/router/index.js`

### Orders

- [Order creation](https://github.com/ckstudentcouncil/souvenir/blob/main/functions/index.js): `functions/index.js`
- [Pricing rules](https://github.com/ckstudentcouncil/souvenir/blob/main/functions/shared/pricing.js): `functions/shared/pricing.js`
- [Order validation](https://github.com/ckstudentcouncil/souvenir/blob/main/functions/lib/orders.js): `functions/lib/orders.js`
- [Order access](https://github.com/ckstudentcouncil/souvenir/blob/main/src/services/orderService.js): `src/services/orderService.js`
- [Order history](https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/OrdersPage.vue): `src/pages/OrdersPage.vue`
- [Order details](https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/OrderDetailPage.vue): `src/pages/OrderDetailPage.vue`

### Staff operations

- [Order administration](https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/AdminPage.vue): `src/pages/AdminPage.vue`
- [Survey workflows](https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/SurveyAdminPage.vue): `src/pages/SurveyAdminPage.vue`
- [Stand sales](https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/StandSalesPage.vue): `src/pages/StandSalesPage.vue`
- [Staff accounts](https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/AccountPage.vue): `src/pages/AccountPage.vue`

### Cloud backend

- **Firestore**
- [Firebase authentication](https://github.com/ckstudentcouncil/souvenir/blob/main/src/services/staffAuth.js): `src/services/staffAuth.js`
- [Confirmation email](https://github.com/ckstudentcouncil/souvenir/blob/main/functions/index.js): `functions/index.js`
- [Email delivery](https://github.com/ckstudentcouncil/souvenir/blob/main/functions/lib/mailer.js): `functions/lib/mailer.js`
- [Bulk notifications](https://github.com/ckstudentcouncil/souvenir/blob/main/functions/lib/notifications.js): `functions/lib/notifications.js`
- [Mail queue](https://github.com/ckstudentcouncil/souvenir/blob/main/functions/lib/mailQueue.js): `functions/lib/mailQueue.js`
- [Queue processing](https://github.com/ckstudentcouncil/souvenir/blob/main/functions/lib/mailQueueCore.js): `functions/lib/mailQueueCore.js`

### Sales reporting

- [Financial report](https://github.com/ckstudentcouncil/souvenir/blob/main/src/pages/SalesAnalyticsPage.vue): `src/pages/SalesAnalyticsPage.vue`
- [Analytics data](https://github.com/ckstudentcouncil/souvenir/blob/main/src/composables/useSalesAnalytics.js): `src/composables/useSalesAnalytics.js`
- [Past sales archive](https://github.com/ckstudentcouncil/souvenir/blob/main/src/services/salesArchiveService.js): `src/services/salesArchiveService.js`
- [Report charts](https://github.com/ckstudentcouncil/souvenir/blob/main/src/components/analytics/LineChart.vue): `src/components/analytics/LineChart.vue`
- [PDF export](https://github.com/ckstudentcouncil/souvenir/blob/main/src/utils/pdf.js): `src/utils/pdf.js`

### Other components

- **Buyer**
- **Staff user**

## Connections

- Buyer → Product pages: browses
- Product pages → Product catalog: uses catalog
- Buyer → Cart and checkout: checks out
- Cart and checkout → Cart state: uses state
- Cart and checkout → Order creation: submits order
- Order creation → Pricing rules: rechecks prices
- Order creation → Order validation: validates order (evidence: `functions/index.js`)
- Order creation → Firestore: writes order (evidence: `functions/index.js`)
- Order validation → Product catalog: validates items (evidence: `functions/lib/orders.js`)
- Order validation → Pricing rules: calculates price (evidence: `functions/lib/orders.js`)
- Order access → Firestore: reads and writes
- Order history → Order access: loads orders
- Order details → Order access: loads order
- Buyer → Order history: tracks orders
- Order creation → Confirmation email: triggers email (evidence: `functions/index.js`)
- Confirmation email → Email delivery: sends message (evidence: `functions/index.js`)
- Confirmation email → Firestore: watches new order (evidence: `functions/index.js`)
- Staff user → Routes and gate: opens staff area (evidence: `src/router/index.js`)
- Routes and gate → Firebase authentication: checks role (evidence: `src/router/index.js`)
- Staff user → Order administration: manages orders
- Order administration → Order access: updates orders
- Staff user → Bulk notifications: requests notices
- Bulk notifications → Mail queue: enqueues batches (evidence: `functions/lib/notifications.js`)
- Mail queue → Queue processing: delegates queue (evidence: `functions/lib/mailQueue.js`)
- Queue processing → Email delivery: sends messages (evidence: `functions/lib/mailQueue.js`)
- Staff user → Survey workflows: reviews surveys
- Staff user → Stand sales: records sales
- Staff user → Staff accounts: manages accounts
- Staff user → Financial report: views report
- Financial report → Analytics data: loads metrics
- Analytics data → Firestore: reads live orders
- Analytics data → Past sales archive: loads past sales
- Financial report → Report charts: renders charts
- Financial report → PDF export: exports PDF
