# work-aditya/kush architecture

> Architecture diagram of the GitHub repository work-aditya/kush, 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/work-aditya/kush
- Repository: https://github.com/work-aditya/kush

## Overview

CoachKush is an online coaching storefront and administration portal. Trainees discover coaching plans, authenticate, and proceed through checkout; server-side Supabase Edge Functions create and verify Razorpay payments and activate enrollments. Administrators manage plans, coupons, users, orders, messages, settings, and CMS pages. The graph follows documented routes and the sampled imports/calls; database schema details and several page/service implementations were not included, so their finer relationships are omitted.

Main entry points: [`frontend/src/lib/supabaseClient.js`](https://github.com/work-aditya/kush/blob/main/frontend/src/lib/supabaseClient.js) (Supabase client), [`frontend/src/pages`](https://github.com/work-aditya/kush/tree/main/frontend/src/pages) (Public pages), [`frontend/src/App.jsx`](https://github.com/work-aditya/kush/blob/main/frontend/src/App.jsx) (Route application), [`frontend/src/services/authService.js`](https://github.com/work-aditya/kush/blob/main/frontend/src/services/authService.js) (Auth service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Trainee experience"]
  node_app["Route application<br/>[App.jsx]"]
  node_public["Public pages"]
  node_contact["Contact form<br/>[ContactPage.jsx]"]
  node_contactservice["Contact service<br/>[contactService.js]"]
end

subgraph group_identity["Identity and state"]
  node_auth["Auth hook<br/>[useAuth.js]"]
  node_authservice["Auth service<br/>[authService.js]"]
end

subgraph group_commerce["Plans and payments"]
  node_plans["Plan catalog<br/>[productService.js]"]
  node_checkout["Checkout modal<br/>[CheckoutModal.jsx]"]
  node_orders["Order service<br/>[orderService.js]"]
  node_payments["Payment client<br/>[paymentService.js]"]
  node_createorder["Create payment order<br/>[index.ts]"]
  node_verify["Verify payment<br/>[index.ts]"]
  node_webhook["Payment webhook<br/>[index.ts]"]
  node_razorpay["Razorpay"]
end

subgraph group_admin["Administration"]
  node_adminpages["Admin portal"]
  node_adminservice["Admin service<br/>[adminService.js]"]
  node_settings["Settings service<br/>[settingsService.js]"]
end

subgraph group_platform["Supabase platform"]
  node_supabaseclient["Supabase client<br/>[supabaseClient.js]"]
  node_authprovider["Supabase Auth"]
  node_database[("PostgreSQL")]
  node_storage[("Supabase Storage")]
end

node_trainee(("Trainee"))

node_trainee -->|"browses"| node_app
node_app -->|"routes to"| node_public
node_public -->|"loads plans"| node_plans
node_public -->|"uses auth"| node_auth
node_public -->|"opens checkout"| node_checkout
node_contact -->|"submits to"| node_contactservice
node_auth -->|"calls"| node_authservice
node_authservice -->|"uses"| node_supabaseclient
node_supabaseclient -->|"authenticates with"| node_authprovider
node_authservice -->|"reads profiles"| node_database
node_plans -->|"queries"| node_supabaseclient
node_checkout -->|"starts order"| node_orders
node_orders -->|"requests payment"| node_payments
node_payments -->|"invokes function"| node_createorder
node_payments -->|"invokes function"| node_verify
node_createorder -->|"reads price"| node_database
node_createorder -->|"creates payment"| node_razorpay
node_verify -->|"verifies signature"| node_razorpay
node_verify -->|"updates enrollment"| node_database
node_razorpay -->|"sends events"| node_webhook
node_webhook -->|"records events"| node_database
node_app -->|"routes protected"| node_adminpages
node_adminpages -->|"manages records"| node_adminservice
node_adminpages -->|"loads settings"| node_settings
node_adminservice -->|"uses"| node_supabaseclient
node_settings -->|"uses"| node_supabaseclient
node_adminservice -->|"reads and writes"| node_database
node_settings -->|"reads and writes"| node_database
node_database -.->|"stores media"| node_storage

click node_app "https://github.com/work-aditya/kush/blob/main/frontend/src/App.jsx"
click node_public "https://github.com/work-aditya/kush/tree/main/frontend/src/pages"
click node_contact "https://github.com/work-aditya/kush/blob/main/frontend/src/pages/ContactPage.jsx"
click node_contactservice "https://github.com/work-aditya/kush/blob/main/frontend/src/services/contactService.js"
click node_auth "https://github.com/work-aditya/kush/blob/main/frontend/src/hooks/useAuth.js"
click node_authservice "https://github.com/work-aditya/kush/blob/main/frontend/src/services/authService.js"
click node_supabaseclient "https://github.com/work-aditya/kush/blob/main/frontend/src/lib/supabaseClient.js"
click node_plans "https://github.com/work-aditya/kush/blob/main/frontend/src/services/productService.js"
click node_checkout "https://github.com/work-aditya/kush/blob/main/frontend/src/components/checkout/CheckoutModal.jsx"
click node_orders "https://github.com/work-aditya/kush/blob/main/frontend/src/services/orderService.js"
click node_payments "https://github.com/work-aditya/kush/blob/main/frontend/src/services/paymentService.js"
click node_createorder "https://github.com/work-aditya/kush/blob/main/supabase/functions/create-razorpay-order/index.ts"
click node_verify "https://github.com/work-aditya/kush/blob/main/supabase/functions/verify-razorpay-payment/index.ts"
click node_webhook "https://github.com/work-aditya/kush/blob/main/supabase/functions/razorpay-webhook/index.ts"
click node_adminpages "https://github.com/work-aditya/kush/tree/main/frontend/src/pages/admin"
click node_adminservice "https://github.com/work-aditya/kush/blob/main/frontend/src/services/adminService.js"
click node_settings "https://github.com/work-aditya/kush/blob/main/frontend/src/services/settingsService.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_app,node_public,node_contact,node_contactservice toneBlue
class node_auth,node_authservice toneAmber
class node_plans,node_checkout,node_orders,node_payments,node_createorder,node_verify,node_webhook,node_razorpay toneMint
class node_adminpages,node_adminservice,node_settings toneRose
class node_supabaseclient,node_authprovider,node_database,node_storage,node_trainee toneIndigo
```

## Components

### Trainee experience

- [Route application](https://github.com/work-aditya/kush/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Public pages](https://github.com/work-aditya/kush/tree/main/frontend/src/pages): `frontend/src/pages`
- [Contact form](https://github.com/work-aditya/kush/blob/main/frontend/src/pages/ContactPage.jsx): `frontend/src/pages/ContactPage.jsx`
- [Contact service](https://github.com/work-aditya/kush/blob/main/frontend/src/services/contactService.js): `frontend/src/services/contactService.js`

### Identity and state

- [Auth hook](https://github.com/work-aditya/kush/blob/main/frontend/src/hooks/useAuth.js): `frontend/src/hooks/useAuth.js`
- [Auth service](https://github.com/work-aditya/kush/blob/main/frontend/src/services/authService.js): `frontend/src/services/authService.js`

### Plans and payments

- [Plan catalog](https://github.com/work-aditya/kush/blob/main/frontend/src/services/productService.js): `frontend/src/services/productService.js`
- [Checkout modal](https://github.com/work-aditya/kush/blob/main/frontend/src/components/checkout/CheckoutModal.jsx): `frontend/src/components/checkout/CheckoutModal.jsx`
- [Order service](https://github.com/work-aditya/kush/blob/main/frontend/src/services/orderService.js): `frontend/src/services/orderService.js`
- [Payment client](https://github.com/work-aditya/kush/blob/main/frontend/src/services/paymentService.js): `frontend/src/services/paymentService.js`
- [Create payment order](https://github.com/work-aditya/kush/blob/main/supabase/functions/create-razorpay-order/index.ts): `supabase/functions/create-razorpay-order/index.ts`
- [Verify payment](https://github.com/work-aditya/kush/blob/main/supabase/functions/verify-razorpay-payment/index.ts): `supabase/functions/verify-razorpay-payment/index.ts`
- [Payment webhook](https://github.com/work-aditya/kush/blob/main/supabase/functions/razorpay-webhook/index.ts): `supabase/functions/razorpay-webhook/index.ts`
- **Razorpay**

### Administration

- [Admin portal](https://github.com/work-aditya/kush/tree/main/frontend/src/pages/admin): `frontend/src/pages/admin`
- [Admin service](https://github.com/work-aditya/kush/blob/main/frontend/src/services/adminService.js): `frontend/src/services/adminService.js`
- [Settings service](https://github.com/work-aditya/kush/blob/main/frontend/src/services/settingsService.js): `frontend/src/services/settingsService.js`

### Supabase platform

- [Supabase client](https://github.com/work-aditya/kush/blob/main/frontend/src/lib/supabaseClient.js): `frontend/src/lib/supabaseClient.js`
- **Supabase Auth**
- **PostgreSQL**
- **Supabase Storage**

### Other components

- **Trainee**

## Connections

- Trainee → Route application: browses (evidence: `frontend/src/App.jsx`)
- Route application → Public pages: routes to (evidence: `frontend/src/App.jsx`)
- Public pages → Plan catalog: loads plans (evidence: `frontend/src/pages/HomePage.jsx`)
- Public pages → Auth hook: uses auth (evidence: `frontend/src/pages/HomePage.jsx`)
- Public pages → Checkout modal: opens checkout (evidence: `frontend/src/pages/PricingPage.jsx`)
- Contact form → Contact service: submits to (evidence: `frontend/src/pages/ContactPage.jsx`)
- Auth hook → Auth service: calls (evidence: `frontend/src/hooks/useAuth.js`)
- Auth service → Supabase client: uses (evidence: `frontend/src/services/authService.js`)
- Supabase client → Supabase Auth: authenticates with (evidence: `README.md`)
- Auth service → PostgreSQL: reads profiles (evidence: `frontend/src/services/authService.js`)
- Plan catalog → Supabase client: queries (evidence: `frontend/src/services/productService.js`)
- Checkout modal → Order service: starts order (evidence: `frontend/src/components/checkout/CheckoutModal.jsx`)
- Order service → Payment client: requests payment (evidence: `frontend/src/services/orderService.js`)
- Payment client → Create payment order: invokes function (evidence: `README.md`)
- Payment client → Verify payment: invokes function (evidence: `README.md`)
- Create payment order → PostgreSQL: reads price (evidence: `README.md`)
- Create payment order → Razorpay: creates payment (evidence: `README.md`)
- Verify payment → Razorpay: verifies signature (evidence: `README.md`)
- Verify payment → PostgreSQL: updates enrollment (evidence: `README.md`)
- Razorpay → Payment webhook: sends events (evidence: `README.md`)
- Payment webhook → PostgreSQL: records events (evidence: `README.md`)
- Route application → Admin portal: routes protected (evidence: `frontend/src/App.jsx`)
- Admin portal → Admin service: manages records (evidence: `frontend/src/pages/admin/AdminCoupons.jsx`)
- Admin portal → Settings service: loads settings (evidence: `frontend/src/pages/admin/AdminSettings.jsx`)
- Admin service → Supabase client: uses (evidence: `frontend/src/services/adminService.js`)
- Settings service → Supabase client: uses (evidence: `frontend/src/services/settingsService.js`)
- Admin service → PostgreSQL: reads and writes (evidence: `frontend/src/services/adminService.js`)
- Settings service → PostgreSQL: reads and writes (evidence: `frontend/src/services/settingsService.js`)
- PostgreSQL → Supabase Storage: stores media (evidence: `README.md`)
