# diyanshu-anand/sangeetalaya architecture

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

- Interactive diagram: https://gitdiagram.com/diyanshu-anand/sangeetalaya
- Repository: https://github.com/diyanshu-anand/sangeetalaya

## Overview

Sangeetalaya is a music-course platform with a React client and Express/MongoDB backend. The visible user journey includes browsing course pages, signing up or logging in, and a backend flow for creating payment orders and granting course access after QR verification or manual review. The graph preserves the documented authentication, course, payment, and password-reset stages. Backend route and model links are supported by sampled source; frontend payment-to-API wiring is not established by the excerpts, so it is omitted.

Main entry points: [`backend/routes/payments.js`](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/routes/payments.js) (Payment routes), [`backend/routes/auth.js`](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/routes/auth.js) (Authentication routes), [`frontend/src/App.js`](https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/App.js) (Application router), [`backend/server.js`](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/server.js) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["Application router<br/>[App.js]"]
  node_landing["Landing page<br/>[LandingPage.js]"]
  node_authmodal["Login and signup<br/>[AuthModal.js]"]
  node_forgot["Forgot password<br/>[ForgetPassowrd.js]"]
  node_dashboard["Dashboard<br/>[Dashboard.js]"]
  node_coursepage["Course page<br/>[CourseIntro.js]"]
  node_checkout["Checkout modal<br/>[checkoutmodal.js]"]
end

subgraph group_api["Backend API"]
  node_server["HTTP server<br/>[server.js]"]
end

subgraph group_identity["Identity"]
  node_authroutes["Authentication routes<br/>[auth.js]"]
  node_authmiddleware["Token protection<br/>[auth.js]"]
  node_usermodel[("User records<br/>[User.js]")]
  node_validators["Input validation<br/>[validators.js]"]
  node_generators["Reset token generation<br/>[generators.js]"]
end

subgraph group_commerce["Course and payments"]
  node_courseroutes["Course routes<br/>[courses.js]"]
  node_coursecontroller["Course operations"]
  node_coursemodel[("Course records<br/>[Course.js]")]
  node_paymentroutes["Payment routes<br/>[payments.js]"]
  node_orders[("Payment orders<br/>[PaymentOrder.js]")]
  node_encryption["Payload security<br/>[crypto.js]"]
  node_qr["QR generation<br/>[qr.js]"]
  node_entitlements[("Course access records<br/>[Usercourse.js]")]
end

node_learner(("Learner"))
node_mongo[("MongoDB")]

node_learner -->|"uses"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_forgot
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_coursepage
node_landing -->|"opens"| node_authmodal
node_coursepage -->|"opens"| node_checkout
node_authmodal -->|"requests login and signup"| node_authroutes
node_forgot -->|"requests reset link"| node_authroutes
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_courseroutes
node_server -->|"mounts"| node_paymentroutes
node_server -->|"connects"| node_mongo
node_authroutes -->|"reads and updates"| node_usermodel
node_authroutes -->|"validates with"| node_validators
node_authroutes -->|"generates reset token"| node_generators
node_authroutes -->|"uses rate limiting"| node_authmiddleware
node_authmiddleware -->|"loads user"| node_usermodel
node_courseroutes -->|"protects routes"| node_authmiddleware
node_courseroutes -->|"dispatches to"| node_coursecontroller
node_coursecontroller -->|"reads and writes"| node_coursemodel
node_paymentroutes -->|"protects selected routes"| node_authmiddleware
node_paymentroutes -->|"creates and updates"| node_orders
node_paymentroutes -->|"loads course"| node_coursemodel
node_paymentroutes -->|"encrypts and verifies"| node_encryption
node_paymentroutes -->|"generates QR"| node_qr
node_paymentroutes -->|"grants and checks access"| node_entitlements

click node_app "https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/App.js"
click node_landing "https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/components/LandingPage.js"
click node_authmodal "https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/components/AuthModal.js"
click node_forgot "https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/pages/ForgetPassowrd.js"
click node_dashboard "https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/components/Dashboard.js"
click node_coursepage "https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/components/CourseIntro.js"
click node_checkout "https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/components/checkoutmodal.js"
click node_server "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/server.js"
click node_authroutes "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/routes/auth.js"
click node_authmiddleware "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/middleware/auth.js"
click node_usermodel "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/models/User.js"
click node_validators "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/utils/validators.js"
click node_generators "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/utils/generators.js"
click node_courseroutes "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/routes/courses.js"
click node_coursecontroller "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/controllers/courseControllers.js"
click node_coursemodel "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/models/Course.js"
click node_paymentroutes "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/routes/payments.js"
click node_orders "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/models/PaymentOrder.js"
click node_encryption "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/utils/crypto.js"
click node_qr "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/utils/qr.js"
click node_entitlements "https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/models/Usercourse.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_landing,node_authmodal,node_forgot,node_dashboard,node_coursepage,node_checkout toneBlue
class node_server,node_mongo toneAmber
class node_authroutes,node_authmiddleware,node_usermodel,node_validators,node_generators toneMint
class node_courseroutes,node_coursecontroller,node_coursemodel,node_paymentroutes,node_orders,node_encryption,node_qr,node_entitlements toneRose
class node_learner toneIndigo
```

## Components

### Web client

- [Application router](https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Landing page](https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/components/LandingPage.js): `frontend/src/components/LandingPage.js`
- [Login and signup](https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/components/AuthModal.js): `frontend/src/components/AuthModal.js`
- [Forgot password](https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/pages/ForgetPassowrd.js): `frontend/src/pages/ForgetPassowrd.js`
- [Dashboard](https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/components/Dashboard.js): `frontend/src/components/Dashboard.js`
- [Course page](https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/components/CourseIntro.js): `frontend/src/components/CourseIntro.js`
- [Checkout modal](https://github.com/diyanshu-anand/sangeetalaya/blob/main/frontend/src/components/checkoutmodal.js): `frontend/src/components/checkoutmodal.js`

### Backend API

- [HTTP server](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/server.js): `backend/server.js`

### Identity

- [Authentication routes](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Token protection](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [User records](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/models/User.js): `backend/models/User.js`
- [Input validation](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/utils/validators.js): `backend/utils/validators.js`
- [Reset token generation](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/utils/generators.js): `backend/utils/generators.js`

### Course and payments

- [Course routes](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/routes/courses.js): `backend/routes/courses.js`
- [Course operations](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/controllers/courseControllers.js): `backend/controllers/courseControllers.js`
- [Course records](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/models/Course.js): `backend/models/Course.js`
- [Payment routes](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/routes/payments.js): `backend/routes/payments.js`
- [Payment orders](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/models/PaymentOrder.js): `backend/models/PaymentOrder.js`
- [Payload security](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/utils/crypto.js): `backend/utils/crypto.js`
- [QR generation](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/utils/qr.js): `backend/utils/qr.js`
- [Course access records](https://github.com/diyanshu-anand/sangeetalaya/blob/main/backend/models/Usercourse.js): `backend/models/Usercourse.js`

### Other components

- **Learner**
- **MongoDB**

## Connections

- Learner → Application router: uses (evidence: `frontend/src/App.js`)
- Application router → Landing page: routes to (evidence: `frontend/src/App.js`)
- Application router → Forgot password: routes to (evidence: `frontend/src/App.js`)
- Application router → Dashboard: routes to (evidence: `frontend/src/App.js`)
- Application router → Course page: routes to (evidence: `frontend/src/App.js`)
- Landing page → Login and signup: opens (evidence: `frontend/src/components/LandingPage.js`)
- Course page → Checkout modal: opens (evidence: `frontend/src/components/CourseIntro.js`)
- Login and signup → Authentication routes: requests login and signup (evidence: `frontend/src/components/AuthModal.js`)
- Forgot password → Authentication routes: requests reset link (evidence: `frontend/src/pages/ForgetPassowrd.js`)
- HTTP server → Authentication routes: mounts (evidence: `backend/server.js`)
- HTTP server → Course routes: mounts (evidence: `backend/server.js`)
- HTTP server → Payment routes: mounts (evidence: `backend/server.js`)
- HTTP server → MongoDB: connects (evidence: `backend/server.js`)
- Authentication routes → User records: reads and updates (evidence: `backend/routes/auth.js`)
- Authentication routes → Input validation: validates with (evidence: `backend/routes/auth.js`)
- Authentication routes → Reset token generation: generates reset token (evidence: `backend/routes/auth.js`)
- Authentication routes → Token protection: uses rate limiting (evidence: `backend/routes/auth.js`)
- Token protection → User records: loads user (evidence: `backend/middleware/auth.js`)
- Course routes → Token protection: protects routes (evidence: `backend/routes/courses.js`)
- Course routes → Course operations: dispatches to (evidence: `backend/routes/courses.js`)
- Course operations → Course records: reads and writes (evidence: `backend/controllers/courseControllers.js`)
- Payment routes → Token protection: protects selected routes (evidence: `backend/routes/payments.js`)
- Payment routes → Payment orders: creates and updates (evidence: `backend/routes/payments.js`)
- Payment routes → Course records: loads course (evidence: `backend/routes/payments.js`)
- Payment routes → Payload security: encrypts and verifies (evidence: `backend/routes/payments.js`)
- Payment routes → QR generation: generates QR (evidence: `backend/routes/payments.js`)
- Payment routes → Course access records: grants and checks access (evidence: `backend/routes/payments.js`)
