# vivek-dubey-0305/gha architecture

> Architecture diagram of the GitHub repository vivek-dubey-0305/gha, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vivek-dubey-0305/gha
- Repository: https://github.com/vivek-dubey-0305/gha

## Overview

#### Purpose and Deployable Surfaces
This is a three-client learning-platform monorepo: a learner-facing site, instructor portal, and administrative portal backed by a shared API. Each client is a separate Vite/React application; the backend is a Node.js HTTP service.
- Learner entry: `frontend/src/main.jsx`, `frontend/src/App.jsx`
- Instructor entry: `Instructor/src/main.jsx`, `Instructor/src/App.jsx`
- Admin entry: `Admin/src/main.jsx`, `Admin/src/App.jsx`
- API process entry: `backend/server.js`, `backend/app.js`

#### Client Routing, Layout, and Access Control
Each React app routes page-level features through a central router and separates public authentication screens from authenticated workspace layouts. Route protection is a frontend boundary; the API enforces role-specific authorization separately.
- Learner routes/layout: `frontend/src/router/router.jsx`, `frontend/src/components/layout/UserLayout.jsx`, `frontend/src/components/protected/Protect.jsx`
- Instructor routes/layout: `Instructor/src/router/router.jsx`, `Instructor/src/components/layout/InstructorLayout.jsx`, `Instructor/src/components/protected/Protect.jsx`
- Admin routes/layout: `Admin/src/router/router.jsx`, `Admin/src/components/layout/AdminLayout.jsx`, `Admin/src/components/protected/Protect.jsx`

#### State and API Integration
All three clients use Redux stores organized by domain slices. Feature pages dispatch resource/auth actions through shared API and authentication utilities; UI state and feedback are rendered through reusable modal/toast components.
- Learner store and domain state: `frontend/src/redux/store/store.js`, `frontend/src/redux/slices/course.slice.js`, `frontend/src/redux/slices/auth.slice.js`
- Instructor store: `Instructor/src/redux/store/store.js`, `Instructor/src/redux/slices/course.slice.js`, `Instructor/src/redux/slices/liveclass.slice.js`
- Admin store: `Admin/src/redux/store/store.js`, `Admin/src/redux/slices/admin.slice.js`, `Admin/src/redux/slices/course.slice.js`

#### Core Learning Domain Flow
Courses are the central aggregate: instructors create/edit courses with modules, lessons, materials, assignments, and live classes; learners enroll, consume content, submit work, receive progress/reviews/certificates; admins manage and moderate platform-wide resources.
- API domain endpoints: `backend/routes/course.routes.js`, `backend/routes/enrollment.routes.js`, `backend/routes/progress.routes.js`
- Persistence models: `backend/models/course.model.js`, `backend/models/module.model.js`, `backend/models/lesson.model.js`
- Course composition and ownership logic: `backend/services/fullCourse.service.js`, `backend/services/ownership.service.js`, `backend/services/progress.service.js`

#### API Request and Security Pipeline
The backend follows route → controller → model/service processing, with shared async/error handling, sanitization, request logging, file upload processing, and distinct user/instructor/admin authentication middleware. Controllers expose domain APIs while services hold cross-resource workflows.
- Application/middleware boundary: `backend/app.js`, `backend/middlewares/error.middleware.js`, `backend/middlewares/sanitization.middleware.js`
- Role authentication: `backend/middlewares/user.auth.middleware.js`, `backend/middlewares/instructor.auth.middleware.js`, `backend/middlewares/admin.auth.middleware.js`
- Authentication APIs/services: `backend/routes/user.auth.routes.js`, `backend/controllers/user.auth.controller.js`, `backend/services/auth.service.js`

#### Engagement, Assessment, and Finance Workflows
Beyond course delivery, the system supports announcements, discussions/study groups, doubt tickets, notifications, assignment submission/grading, and platform financial records. Grading includes a dedicated worker and reconciliation service, creating an asynchronous boundary from normal CRUD requests.
- Assessment pipeline: `backend/routes/submission.routes.js`, `backend/services/mcq-grading.service.js`, `backend/workers/mcq-grading.worker.js`
- Community/support: `backend/routes/discussion.routes.js`, `backend/routes/study-group.routes.js`, `backend/services/doubt-ticket.service.js`
- Financial resources: `backend/routes/payment.routes.js`, `backend/models/wallet.model.js`, `backend/services/payment.service.js`

#### External Services and Infrastructure Boundaries
The API integrates media, object storage, caching, email, and payment-oriented infrastructure through dedicated adapters. Live classes and video delivery are isolated behind services rather than embedded in controllers. Environment/configuration is centralized under backend configs and `.env` inputs.
- Video/media providers: `backend/services/cloudflare-stream.service.js`, `backend/services/bunny.service.js`, `backend/services/image.service.js`
- Storage/cache and email: `backend/services/r2.service.js`, `backend/services/redis.service.js`, `backend/services/mail.service.js`
- Runtime configuration and deployment clues: `backend/configs/env.config.js`, `frontend/vercel.json`, `Instructor/vercel.json`

Main entry points: [`backend/middlewares/sanitization.middleware.js`](https://github.com/vivek-dubey-0305/gha/blob/main/backend/middlewares/sanitization.middleware.js) (Sanitization, errors & role auth), [`backend/services/fullCourse.service.js`](https://github.com/vivek-dubey-0305/gha/blob/main/backend/services/fullCourse.service.js) (Course composition & progress), [`backend/app.js`](https://github.com/vivek-dubey-0305/gha/blob/main/backend/app.js) (HTTP application), [`backend/routes/submission.routes.js`](https://github.com/vivek-dubey-0305/gha/blob/main/backend/routes/submission.routes.js) (Community, support & submissions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["React clients"]
  node_learner_app["Learner app<br/>Vite React app<br/>[main.jsx]"]
  node_learner_router["Learner routes &amp; workspace<br/>router/layout/guard<br/>[router.jsx]"]
  node_learner_state["Learner course &amp; auth state<br/>Redux store<br/>[store.js]"]
  node_instructor_app["Instructor app<br/>Vite React app<br/>[main.jsx]"]
  node_instructor_router["Instructor routes &amp; workspace<br/>router/layout/guard<br/>[router.jsx]"]
  node_instructor_state["Instructor course &amp; live-class state<br/>Redux store<br/>[store.js]"]
  node_admin_app["Admin app<br/>Vite React app<br/>[main.jsx]"]
  node_admin_router["Admin routes &amp; workspace<br/>router/layout/guard<br/>[router.jsx]"]
  node_admin_state["Admin &amp; course state<br/>Redux store<br/>[store.js]"]
end

subgraph group_api["Node.js API"]
  node_api_app["HTTP application<br/>Node.js app<br/>[app.js]"]
  node_security["Sanitization, errors &amp; role auth<br/>middleware pipeline"]
  node_auth_api["Authentication API<br/>routes/controller/service"]
  node_learning_api["Course, enrollment &amp; progress APIs<br/>domain routes<br/>[course.routes.js]"]
  node_course_workflows["Course composition &amp; progress<br/>domain services"]
  node_learning_models[("Course content models<br/>persistence models<br/>[course.model.js]")]
  node_engagement_api["Community, support &amp; submissions<br/>domain routes/services"]
  node_grading["MCQ grading workflow<br/>service and worker"]
  node_finance_api["Payments &amp; wallet<br/>routes/service/models<br/>[payment.routes.js]"]
end

subgraph group_infra["Infrastructure adapters"]
  node_adapters{{"Media, storage, cache &amp; email<br/>service adapters"}}
end

node_learner_app -->|"mounts"| node_learner_router
node_learner_router -->|"dispatches"| node_learner_state
node_instructor_app -->|"mounts"| node_instructor_router
node_instructor_router -->|"dispatches"| node_instructor_state
node_admin_app -->|"mounts"| node_admin_router
node_admin_router -->|"dispatches"| node_admin_state
node_learner_state -->|"API requests"| node_api_app
node_instructor_state -->|"API requests"| node_api_app
node_admin_state -->|"API requests"| node_api_app
node_api_app -->|"applies"| node_security
node_security -->|"authorizes"| node_auth_api
node_security -->|"authorizes"| node_learning_api
node_security -->|"authorizes"| node_engagement_api
node_security -->|"authorizes"| node_finance_api
node_auth_api -.->|"identity context"| node_course_workflows
node_learning_api -->|"orchestrates"| node_course_workflows
node_course_workflows -->|"reads and writes"| node_learning_models
node_engagement_api -->|"submissions"| node_grading
node_grading -->|"records results"| node_learning_models
node_finance_api -->|"payment integration"| node_adapters
node_course_workflows -->|"content media and storage"| node_adapters
node_engagement_api -->|"notifications and cache"| node_adapters

click node_learner_app "https://github.com/vivek-dubey-0305/gha/blob/main/frontend/src/main.jsx"
click node_learner_router "https://github.com/vivek-dubey-0305/gha/blob/main/frontend/src/router/router.jsx"
click node_learner_state "https://github.com/vivek-dubey-0305/gha/blob/main/frontend/src/redux/store/store.js"
click node_instructor_app "https://github.com/vivek-dubey-0305/gha/blob/main/Instructor/src/main.jsx"
click node_instructor_router "https://github.com/vivek-dubey-0305/gha/blob/main/Instructor/src/router/router.jsx"
click node_instructor_state "https://github.com/vivek-dubey-0305/gha/blob/main/Instructor/src/redux/store/store.js"
click node_admin_app "https://github.com/vivek-dubey-0305/gha/blob/main/Admin/src/main.jsx"
click node_admin_router "https://github.com/vivek-dubey-0305/gha/blob/main/Admin/src/router/router.jsx"
click node_admin_state "https://github.com/vivek-dubey-0305/gha/blob/main/Admin/src/redux/store/store.js"
click node_api_app "https://github.com/vivek-dubey-0305/gha/blob/main/backend/app.js"
click node_security "https://github.com/vivek-dubey-0305/gha/blob/main/backend/middlewares/sanitization.middleware.js"
click node_auth_api "https://github.com/vivek-dubey-0305/gha/blob/main/backend/routes/user.auth.routes.js"
click node_learning_api "https://github.com/vivek-dubey-0305/gha/blob/main/backend/routes/course.routes.js"
click node_course_workflows "https://github.com/vivek-dubey-0305/gha/blob/main/backend/services/fullCourse.service.js"
click node_learning_models "https://github.com/vivek-dubey-0305/gha/blob/main/backend/models/course.model.js"
click node_engagement_api "https://github.com/vivek-dubey-0305/gha/blob/main/backend/routes/submission.routes.js"
click node_grading "https://github.com/vivek-dubey-0305/gha/blob/main/backend/services/mcq-grading.service.js"
click node_finance_api "https://github.com/vivek-dubey-0305/gha/blob/main/backend/routes/payment.routes.js"
click node_adapters "https://github.com/vivek-dubey-0305/gha/blob/main/backend/services/cloudflare-stream.service.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_learner_app,node_learner_router,node_learner_state,node_instructor_app,node_instructor_router,node_instructor_state,node_admin_app,node_admin_router,node_admin_state toneBlue
class node_api_app,node_security,node_auth_api,node_learning_api,node_course_workflows,node_learning_models,node_engagement_api,node_grading,node_finance_api toneAmber
class node_adapters toneMint
```

## Components

### React clients

Three Vite/React applications for distinct platform roles.

- [Learner app](https://github.com/vivek-dubey-0305/gha/blob/main/frontend/src/main.jsx): Vite React app · `frontend/src/main.jsx`
- [Learner routes & workspace](https://github.com/vivek-dubey-0305/gha/blob/main/frontend/src/router/router.jsx): router/layout/guard · Public auth screens are separated from protected learner workspace routes. · `frontend/src/router/router.jsx`
- [Learner course & auth state](https://github.com/vivek-dubey-0305/gha/blob/main/frontend/src/redux/store/store.js): Redux store · `frontend/src/redux/store/store.js`
- [Instructor app](https://github.com/vivek-dubey-0305/gha/blob/main/Instructor/src/main.jsx): Vite React app · `Instructor/src/main.jsx`
- [Instructor routes & workspace](https://github.com/vivek-dubey-0305/gha/blob/main/Instructor/src/router/router.jsx): router/layout/guard · Protected instructor workspace routes are rendered in the instructor layout. · `Instructor/src/router/router.jsx`
- [Instructor course & live-class state](https://github.com/vivek-dubey-0305/gha/blob/main/Instructor/src/redux/store/store.js): Redux store · `Instructor/src/redux/store/store.js`
- [Admin app](https://github.com/vivek-dubey-0305/gha/blob/main/Admin/src/main.jsx): Vite React app · `Admin/src/main.jsx`
- [Admin routes & workspace](https://github.com/vivek-dubey-0305/gha/blob/main/Admin/src/router/router.jsx): router/layout/guard · Protected administration routes are rendered in the admin layout. · `Admin/src/router/router.jsx`
- [Admin & course state](https://github.com/vivek-dubey-0305/gha/blob/main/Admin/src/redux/store/store.js): Redux store · `Admin/src/redux/store/store.js`

### Node.js API

Shared HTTP service and domain workflows.

- [HTTP application](https://github.com/vivek-dubey-0305/gha/blob/main/backend/app.js): Node.js app · Applies shared request processing before domain routes. · `backend/app.js`
- [Sanitization, errors & role auth](https://github.com/vivek-dubey-0305/gha/blob/main/backend/middlewares/sanitization.middleware.js): middleware pipeline · User, instructor, and admin authorization are enforced by the API. · `backend/middlewares/sanitization.middleware.js`
- [Authentication API](https://github.com/vivek-dubey-0305/gha/blob/main/backend/routes/user.auth.routes.js): routes/controller/service · `backend/routes/user.auth.routes.js`
- [Course, enrollment & progress APIs](https://github.com/vivek-dubey-0305/gha/blob/main/backend/routes/course.routes.js): domain routes · `backend/routes/course.routes.js`
- [Course composition & progress](https://github.com/vivek-dubey-0305/gha/blob/main/backend/services/fullCourse.service.js): domain services · Builds full courses, verifies ownership, and manages learner progress. · `backend/services/fullCourse.service.js`
- [Course content models](https://github.com/vivek-dubey-0305/gha/blob/main/backend/models/course.model.js): persistence models · Courses contain modules and lessons. · `backend/models/course.model.js`
- [Community, support & submissions](https://github.com/vivek-dubey-0305/gha/blob/main/backend/routes/submission.routes.js): domain routes/services · `backend/routes/submission.routes.js`
- [MCQ grading workflow](https://github.com/vivek-dubey-0305/gha/blob/main/backend/services/mcq-grading.service.js): service and worker · Submission grading crosses an asynchronous worker boundary. · `backend/services/mcq-grading.service.js`
- [Payments & wallet](https://github.com/vivek-dubey-0305/gha/blob/main/backend/routes/payment.routes.js): routes/service/models · `backend/routes/payment.routes.js`

### Infrastructure adapters

External media, storage, cache, email, and payment integrations.

- [Media, storage, cache & email](https://github.com/vivek-dubey-0305/gha/blob/main/backend/services/cloudflare-stream.service.js): service adapters · Provider integrations are isolated behind backend services. · `backend/services/cloudflare-stream.service.js`

## Connections

- Learner app → Learner routes & workspace: mounts
- Learner routes & workspace → Learner course & auth state: dispatches
- Instructor app → Instructor routes & workspace: mounts
- Instructor routes & workspace → Instructor course & live-class state: dispatches
- Admin app → Admin routes & workspace: mounts
- Admin routes & workspace → Admin & course state: dispatches
- Learner course & auth state → HTTP application: API requests
- Instructor course & live-class state → HTTP application: API requests
- Admin & course state → HTTP application: API requests
- HTTP application → Sanitization, errors & role auth: applies
- Sanitization, errors & role auth → Authentication API: authorizes
- Sanitization, errors & role auth → Course, enrollment & progress APIs: authorizes
- Sanitization, errors & role auth → Community, support & submissions: authorizes
- Sanitization, errors & role auth → Payments & wallet: authorizes
- Authentication API → Course composition & progress: identity context
- Course, enrollment & progress APIs → Course composition & progress: orchestrates
- Course composition & progress → Course content models: reads and writes
- Community, support & submissions → MCQ grading workflow: submissions
- MCQ grading workflow → Course content models: records results
- Payments & wallet → Media, storage, cache & email: payment integration
- Course composition & progress → Media, storage, cache & email: content media and storage
- Community, support & submissions → Media, storage, cache & email: notifications and cache
