# pharmastudents/website architecture

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

- Interactive diagram: https://gitdiagram.com/pharmastudents/website
- Repository: https://github.com/pharmastudents/website

## Overview

Pharma Compass is a B.Pharm learning storefront and student platform with academic resource discovery, purchases, authenticated student access, and separate administration. The main journey is browsing the year/semester/subject catalogue, selecting materials, checking out, then using purchased resources through the student area and viewer. Admin capabilities include managing the academic catalogue, materials, students, orders, reports, and settings. Several route implementations were not sampled, so documented product relationships are shown without asserting unsampled call details.

Main entry points: [`src/routes/admin/index.tsx`](https://github.com/pharmastudents/website/blob/main/src/routes/admin/index.tsx) (Admin Dashboard), [`src/lib/store.tsx`](https://github.com/pharmastudents/website/blob/main/src/lib/store.tsx) (Application Store), [`src/lib/academicService.ts`](https://github.com/pharmastudents/website/blob/main/src/lib/academicService.ts) (Academic Service), [`src/integrations/supabase/client.ts`](https://github.com/pharmastudents/website/blob/main/src/integrations/supabase/client.ts) (Supabase Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Site and Discovery"]
  node_public_site["Public Site<br/>[index.tsx]"]
  node_academic_browse["B.Pharm Catalogue<br/>[bpharm.tsx]"]
end

subgraph group_learning["Student Learning"]
  node_resources["Resource Catalogue<br/>[index.tsx]"]
  node_resource_detail["Resource Detail<br/>[$materialId.tsx]"]
  node_purchases["Purchase Records<br/>[index.ts]"]
  node_dashboard["Student Dashboard<br/>[index.tsx]"]
  node_student_area["Student Navigation<br/>[StudentLayout.tsx]"]
  node_viewer["Material Viewer<br/>[$materialId.tsx]"]
end

subgraph group_admin["Administration"]
  node_admin_home["Admin Dashboard<br/>[index.tsx]"]
  node_admin_layout["Admin Navigation<br/>[AdminLayout.tsx]"]
  node_admin_catalogue["Academic Management"]
  node_admin_materials["Material Management"]
  node_admin_students["Student Management"]
  node_admin_orders["Order Management<br/>[index.tsx]"]
  node_admin_reports["Reports<br/>[index.tsx]"]
  node_admin_settings["Settings"]
end

subgraph group_platform["Application Services"]
  node_academic_service["Academic Service<br/>[academicService.ts]"]
  node_store["Application Store<br/>[store.tsx]"]
  node_supabase[("Supabase Client<br/>[client.ts]")]
  node_shared_payment["Payment Helpers<br/>[razorpay.ts]"]
end

subgraph group_commerce["Payments"]
  node_cart["Cart<br/>[cart.tsx]"]
  node_checkout["Checkout<br/>[checkout.tsx]"]
  node_payment_service["Payment Service<br/>[paymentService.ts]"]
  node_create_order["Order Creation<br/>[index.ts]"]
  node_razorpay_order["Razorpay Order<br/>[index.ts]"]
  node_payment_verify["Payment Verification<br/>[index.ts]"]
  node_payment_webhook["Payment Webhook<br/>[index.ts]"]
end

node_student(("Student"))
node_razorpay["Razorpay"]

node_student -->|"explores"| node_public_site
node_student -->|"browses"| node_academic_browse
node_student -->|"finds materials"| node_resources
node_public_site -->|"links to"| node_academic_browse
node_academic_browse -->|"buys subject"| node_checkout
node_resources -->|"loads catalogue"| node_academic_service
node_resources -->|"reads ownership"| node_store
node_resources -->|"opens resource"| node_resource_detail
node_resource_detail -->|"starts purchase"| node_cart
node_student -->|"checks out"| node_checkout
node_checkout -.->|"requests payment"| node_payment_service
node_payment_service -->|"uses client"| node_supabase
node_create_order -->|"uses helpers"| node_shared_payment
node_razorpay_order -->|"uses helpers"| node_shared_payment
node_payment_verify -->|"uses helpers"| node_shared_payment
node_payment_webhook -->|"uses helpers"| node_shared_payment
node_create_order -.->|"creates order"| node_razorpay
node_razorpay_order -.->|"creates order"| node_razorpay
node_payment_webhook -.->|"records purchase"| node_purchases
node_student -->|"opens dashboard"| node_dashboard
node_dashboard -->|"renders within"| node_student_area
node_dashboard -->|"reads student data"| node_store
node_student_area -->|"uses session"| node_store
node_student -->|"opens unlocked material"| node_viewer
node_student -->|"administers platform"| node_admin_home
node_admin_home -->|"renders within"| node_admin_layout
node_admin_home -->|"reads admin data"| node_store
node_admin_home -->|"queries backend"| node_supabase
node_admin_layout -->|"loads notifications"| node_supabase
node_admin_catalogue -.->|"manages academics"| node_academic_service
node_admin_materials -.->|"manages materials"| node_academic_service
node_admin_students -.->|"supports operations"| node_admin_home
node_admin_orders -->|"loads order data"| node_academic_service
node_admin_orders -->|"reads order data"| node_store
node_admin_orders -->|"queries backend"| node_supabase
node_admin_reports -.->|"reports activity"| node_admin_home
node_admin_settings -.->|"configures platform"| node_admin_home
node_academic_service -->|"queries backend"| node_supabase
node_store -->|"uses client"| node_supabase
node_store -->|"uses academic data"| node_academic_service

click node_public_site "https://github.com/pharmastudents/website/blob/main/src/routes/index.tsx"
click node_academic_browse "https://github.com/pharmastudents/website/blob/main/src/routes/bpharm.tsx"
click node_resources "https://github.com/pharmastudents/website/blob/main/src/routes/resources/index.tsx"
click node_resource_detail "https://github.com/pharmastudents/website/blob/main/src/routes/resources/%24materialId.tsx"
click node_cart "https://github.com/pharmastudents/website/blob/main/src/routes/cart.tsx"
click node_checkout "https://github.com/pharmastudents/website/blob/main/src/routes/checkout.tsx"
click node_payment_service "https://github.com/pharmastudents/website/blob/main/src/lib/paymentService.ts"
click node_create_order "https://github.com/pharmastudents/website/blob/main/supabase/functions/create-order/index.ts"
click node_razorpay_order "https://github.com/pharmastudents/website/blob/main/supabase/functions/create-razorpay-order/index.ts"
click node_payment_verify "https://github.com/pharmastudents/website/blob/main/supabase/functions/verify-payment/index.ts"
click node_payment_webhook "https://github.com/pharmastudents/website/blob/main/supabase/functions/razorpay-webhook/index.ts"
click node_purchases "https://github.com/pharmastudents/website/blob/main/supabase/functions/get-my-purchases/index.ts"
click node_dashboard "https://github.com/pharmastudents/website/blob/main/src/routes/dashboard/index.tsx"
click node_student_area "https://github.com/pharmastudents/website/blob/main/src/components/student/StudentLayout.tsx"
click node_viewer "https://github.com/pharmastudents/website/blob/main/src/routes/viewer/%24materialId.tsx"
click node_admin_home "https://github.com/pharmastudents/website/blob/main/src/routes/admin/index.tsx"
click node_admin_layout "https://github.com/pharmastudents/website/blob/main/src/components/admin/AdminLayout.tsx"
click node_admin_catalogue "https://github.com/pharmastudents/website/tree/main/src/routes/admin/subjects"
click node_admin_materials "https://github.com/pharmastudents/website/tree/main/src/routes/admin/materials"
click node_admin_students "https://github.com/pharmastudents/website/tree/main/src/routes/admin/students"
click node_admin_orders "https://github.com/pharmastudents/website/blob/main/src/routes/admin/orders/index.tsx"
click node_admin_reports "https://github.com/pharmastudents/website/blob/main/src/routes/admin/reports/index.tsx"
click node_admin_settings "https://github.com/pharmastudents/website/tree/main/src/routes/admin/settings"
click node_academic_service "https://github.com/pharmastudents/website/blob/main/src/lib/academicService.ts"
click node_store "https://github.com/pharmastudents/website/blob/main/src/lib/store.tsx"
click node_supabase "https://github.com/pharmastudents/website/blob/main/src/integrations/supabase/client.ts"
click node_shared_payment "https://github.com/pharmastudents/website/blob/main/supabase/functions/_shared/razorpay.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_public_site,node_academic_browse toneBlue
class node_resources,node_resource_detail,node_purchases,node_dashboard,node_student_area,node_viewer toneAmber
class node_admin_home,node_admin_layout,node_admin_catalogue,node_admin_materials,node_admin_students,node_admin_orders,node_admin_reports,node_admin_settings toneMint
class node_academic_service,node_store,node_supabase,node_shared_payment toneRose
class node_cart,node_checkout,node_payment_service,node_create_order,node_razorpay_order,node_payment_verify,node_payment_webhook,node_student,node_razorpay toneIndigo
```

## Components

### Site and Discovery

- [Public Site](https://github.com/pharmastudents/website/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [B.Pharm Catalogue](https://github.com/pharmastudents/website/blob/main/src/routes/bpharm.tsx): `src/routes/bpharm.tsx`

### Student Learning

- [Resource Catalogue](https://github.com/pharmastudents/website/blob/main/src/routes/resources/index.tsx): `src/routes/resources/index.tsx`
- [Resource Detail](https://github.com/pharmastudents/website/blob/main/src/routes/resources/%24materialId.tsx): `src/routes/resources/$materialId.tsx`
- [Purchase Records](https://github.com/pharmastudents/website/blob/main/supabase/functions/get-my-purchases/index.ts): `supabase/functions/get-my-purchases/index.ts`
- [Student Dashboard](https://github.com/pharmastudents/website/blob/main/src/routes/dashboard/index.tsx): `src/routes/dashboard/index.tsx`
- [Student Navigation](https://github.com/pharmastudents/website/blob/main/src/components/student/StudentLayout.tsx): `src/components/student/StudentLayout.tsx`
- [Material Viewer](https://github.com/pharmastudents/website/blob/main/src/routes/viewer/%24materialId.tsx): `src/routes/viewer/$materialId.tsx`

### Administration

- [Admin Dashboard](https://github.com/pharmastudents/website/blob/main/src/routes/admin/index.tsx): `src/routes/admin/index.tsx`
- [Admin Navigation](https://github.com/pharmastudents/website/blob/main/src/components/admin/AdminLayout.tsx): `src/components/admin/AdminLayout.tsx`
- [Academic Management](https://github.com/pharmastudents/website/tree/main/src/routes/admin/subjects): `src/routes/admin/subjects`
- [Material Management](https://github.com/pharmastudents/website/tree/main/src/routes/admin/materials): `src/routes/admin/materials`
- [Student Management](https://github.com/pharmastudents/website/tree/main/src/routes/admin/students): `src/routes/admin/students`
- [Order Management](https://github.com/pharmastudents/website/blob/main/src/routes/admin/orders/index.tsx): `src/routes/admin/orders/index.tsx`
- [Reports](https://github.com/pharmastudents/website/blob/main/src/routes/admin/reports/index.tsx): `src/routes/admin/reports/index.tsx`
- [Settings](https://github.com/pharmastudents/website/tree/main/src/routes/admin/settings): `src/routes/admin/settings`

### Application Services

- [Academic Service](https://github.com/pharmastudents/website/blob/main/src/lib/academicService.ts): `src/lib/academicService.ts`
- [Application Store](https://github.com/pharmastudents/website/blob/main/src/lib/store.tsx): `src/lib/store.tsx`
- [Supabase Client](https://github.com/pharmastudents/website/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Payment Helpers](https://github.com/pharmastudents/website/blob/main/supabase/functions/_shared/razorpay.ts): `supabase/functions/_shared/razorpay.ts`

### Payments

- [Cart](https://github.com/pharmastudents/website/blob/main/src/routes/cart.tsx): `src/routes/cart.tsx`
- [Checkout](https://github.com/pharmastudents/website/blob/main/src/routes/checkout.tsx): `src/routes/checkout.tsx`
- [Payment Service](https://github.com/pharmastudents/website/blob/main/src/lib/paymentService.ts): `src/lib/paymentService.ts`
- [Order Creation](https://github.com/pharmastudents/website/blob/main/supabase/functions/create-order/index.ts): `supabase/functions/create-order/index.ts`
- [Razorpay Order](https://github.com/pharmastudents/website/blob/main/supabase/functions/create-razorpay-order/index.ts): `supabase/functions/create-razorpay-order/index.ts`
- [Payment Verification](https://github.com/pharmastudents/website/blob/main/supabase/functions/verify-payment/index.ts): `supabase/functions/verify-payment/index.ts`
- [Payment Webhook](https://github.com/pharmastudents/website/blob/main/supabase/functions/razorpay-webhook/index.ts): `supabase/functions/razorpay-webhook/index.ts`

### Other components

- **Student**
- **Razorpay**

## Connections

- Student → Public Site: explores
- Student → B.Pharm Catalogue: browses
- Student → Resource Catalogue: finds materials
- Public Site → B.Pharm Catalogue: links to (evidence: `src/routes/index.tsx`)
- B.Pharm Catalogue → Checkout: buys subject
- Resource Catalogue → Academic Service: loads catalogue (evidence: `src/routes/resources/index.tsx`)
- Resource Catalogue → Application Store: reads ownership (evidence: `src/routes/resources/index.tsx`)
- Resource Catalogue → Resource Detail: opens resource
- Resource Detail → Cart: starts purchase
- Student → Checkout: checks out
- Checkout → Payment Service: requests payment
- Payment Service → Supabase Client: uses client (evidence: `src/lib/paymentService.ts`)
- Order Creation → Payment Helpers: uses helpers (evidence: `supabase/functions/create-order/index.ts`)
- Razorpay Order → Payment Helpers: uses helpers (evidence: `supabase/functions/create-razorpay-order/index.ts`)
- Payment Verification → Payment Helpers: uses helpers (evidence: `supabase/functions/verify-payment/index.ts`)
- Payment Webhook → Payment Helpers: uses helpers (evidence: `supabase/functions/razorpay-webhook/index.ts`)
- Order Creation → Razorpay: creates order
- Razorpay Order → Razorpay: creates order
- Payment Webhook → Purchase Records: records purchase
- Student → Student Dashboard: opens dashboard
- Student Dashboard → Student Navigation: renders within (evidence: `src/routes/dashboard/index.tsx`)
- Student Dashboard → Application Store: reads student data (evidence: `src/routes/dashboard/index.tsx`)
- Student Navigation → Application Store: uses session (evidence: `src/components/student/StudentLayout.tsx`)
- Student → Material Viewer: opens unlocked material
- Student → Admin Dashboard: administers platform
- Admin Dashboard → Admin Navigation: renders within (evidence: `src/routes/admin/index.tsx`)
- Admin Dashboard → Application Store: reads admin data (evidence: `src/routes/admin/index.tsx`)
- Admin Dashboard → Supabase Client: queries backend (evidence: `src/routes/admin/index.tsx`)
- Admin Navigation → Supabase Client: loads notifications (evidence: `src/components/admin/AdminLayout.tsx`)
- Academic Management → Academic Service: manages academics
- Material Management → Academic Service: manages materials
- Student Management → Admin Dashboard: supports operations
- Order Management → Academic Service: loads order data (evidence: `src/routes/admin/orders/index.tsx`)
- Order Management → Application Store: reads order data (evidence: `src/routes/admin/orders/index.tsx`)
- Order Management → Supabase Client: queries backend (evidence: `src/routes/admin/orders/index.tsx`)
- Reports → Admin Dashboard: reports activity
- Settings → Admin Dashboard: configures platform
- Academic Service → Supabase Client: queries backend (evidence: `src/lib/academicService.ts`)
- Application Store → Supabase Client: uses client (evidence: `src/lib/store.tsx`)
- Application Store → Academic Service: uses academic data (evidence: `src/lib/store.tsx`)
