# rajeshsingh241/edtechplatform architecture

> Architecture diagram of the GitHub repository rajeshsingh241/edtechplatform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rajeshsingh241/edtechplatform
- Repository: https://github.com/rajeshsingh241/edtechplatform

## Overview

##### Project type and purpose
- This is a full-stack EdTech web application (“EdTech Platform”) with a React-based client and a Node/Express backend.
- Purpose: enable students to browse and enroll in courses, track progress; enable instructors to author and manage courses.

##### File structure
- Top-level directories:
- src/ (React frontend)
- public/ (static HTML, manifest, robots)
- server/ (Express backend)
- dist/ (built CSS from Tailwind)
- Frontend:
- Components grouped by feature (core, common, ContactPage, Dashboard, etc.)
- Redux slices (authSlice, cartSlice, etc.) under src/slices/
- Services for API calls (apiconnector.js, operations folder)
- Backend:
- server/index.js (Express entrypoint)
- server/routes/ (route definitions) → server/controllers/ (controller logic) → server/models/ (Mongoose schemas)
- server/config/ (DB, Cloudinary, Razorpay configs)
- server/middlewares/ (JWT auth)
- server/utils/ (mailSender, imageUploader, helpers)
- server/mail/templates/ (email HTML)

##### README
- Tech stack: React, React Router, Tailwind CSS; Node.js, Express, JWT, Bcrypt; MongoDB; external services: Cloudinary (image storage), Razorpay (payments), email (SMTP or third-party).
- Features: CRUD on courses and users, authentication, route protection, password hashing, validation.

a. Main components
1. Client (Browser/SPA)
2. CDN or static asset host (Vercel/Netlify serving built React and Tailwind CSS)
3. API Gateway / Express Server
4. Authentication module (JWT issuance, Bcrypt password hashing)
5. Controllers & Services (Course, User, Payments, Mail)
6. Data layer (MongoDB via Mongoose)
7. External Services: Cloudinary, Razorpay, Email provider (SMTP or API)
b. Relationships & interactions
- Browser → (HTTPS) → CDN/static host → loads index.html, bundle.js, CSS
- Browser SPA → (HTTPS JSON) → Express REST API endpoints (/api/users, /api/courses, /api/payments, etc.)
- Express middlewares authenticate JWT on protected routes
- Controllers call model methods → CRUD operations on MongoDB
- Payment controller interacts with Razorpay API
- Image upload endpoints forward images to Cloudinary
- Mail templates dispatched via mailSender utility to email provider
c. Architectural patterns/design principles
- Frontend: Single-page application; component-driven UI; Redux for state management; service layer abstracts API calls
- Backend: MVC-style layering (Routes → Controllers → Models); separation of concerns; environment configs for credentials; middleware for cross-cutting concerns (auth, error handling)
- Secure practices: JWT tokens stored client-side (HTTP-only cookies or localStorage), Bcrypt hashing, route protection
d. Key technologies/frameworks
- React, React Router, Redux Toolkit (slices), Tailwind CSS
- Node.js, Express.js, Mongoose, JWT, Bcrypt
- Cloudinary SDK, Razorpay SDK, Nodemailer (or similar) for emails

##### Detail and thoroughness
- Middleware layer (JWT auth) sitting between routes and controllers
- Config files or environment variables as a configuration block feeding into the server
- Build/deploy pipeline, if desired, by adding a CI/CD block (e.g., Vercel build for frontend, Heroku/AWS build for backend)

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Presentation Layer"
    subgraph "React SPA"
      RI["public/index.html"]:::frontend
      R1["src/index.js"]:::frontend
      R2["src/App.js"]:::frontend
    end
    CDN["Static Assets (dist/output.css)"]:::frontend
  end

  subgraph "Application Layer"
    SERVER["Express API\n(server/index.js)"]:::backend

    subgraph "Routes"
      UR["User Routes\n(server/routes/User.js)"]:::backend
      CR["Course Routes\n(server/routes/Course.js)"]:::backend
      PR["Payments Routes\n(server/routes/Payments.js)"]:::backend
    end

    subgraph "Middleware"
      MJ["JWT Auth Middleware\n(server/middlewares/auth.js)"]:::backend
    end

    subgraph "Controllers"
      AC["Auth Controller\n(server/controllers/Auth.js)"]:::backend
      CC["Course Controller\n(server/controllers/Course.js)"]:::backend
      SC["Section Controller\n(server/controllers/Section.js)"]:::backend
      SSC["Subsection Controller\n(server/controllers/Subsection.js)"]:::backend
      PC["Payments Controller\n(server/controllers/Payments.js)"]:::backend
      ContactC["Contact Controller\n(server/controllers/ContactUs.js)"]:::backend
      ResetC["Reset Password Controller\n(server/controllers/ResetPassword.js)"]:::backend
    end

    subgraph "Services & Configs"
      RazorCfg["Razorpay Config\n(server/config/razorpay.js)"]:::backend
      CloudCfg["Cloudinary Config\n(server/config/cloudinary.js)"]:::backend
      MailU["Mail Sender Utility\n(server/utils/mailSender.js)"]:::backend
      ImageU["Image Uploader Utility\n(server/utils/imageUploader.js)"]:::backend
    end

    subgraph "Frontend State & Services"
      AuthS["authSlice\n(src/slices/authSlice.js)"]:::frontend
      AuthAPI["authAPI ops\n(src/services/operations/authAPI.js)"]:::frontend
      CourseS["courseSlice\n(src/slices/courseSlice.js)"]:::frontend
      CourseAPI["courseDetailsAPI ops\n(src/services/operations/courseDetailsAPI.js)"]:::frontend
      Store["Redux Store\n(src/reducer/index.js)"]:::frontend
      APIConn["API Connector\n(src/services/apiconnector.js\nsrc/services/apis.js)"]:::frontend
    end
  end

  subgraph "Data Layer"
    DB["MongoDB"]:::data
    subgraph "Models"
      MUser["User Model\n(server/models/User.js)"]:::data
      MCourse["Course Model\n(server/models/Course.js)"]:::data
      MSection["Section Model\n(server/models/Section.js)"]:::data
      MSubS["SubSection Model\n(server/models/SubSection.js)"]:::data
      Others["Other Models\n(server/models/*.js)"]:::data
    end
  end

  subgraph "External Services"
    CloudExt["Cloudinary"]:::external
    RazorExt["Razorpay"]:::external
    EmailP["Email Provider"]:::external
  end

  %% Connections
  RI -->|serves files| CDN
  R1 -->|loads SPA| SERVER
  R2 -->|loads SPA| SERVER

  R1 -->|dispatches actions| AuthS
  R1 -->|dispatches actions| CourseS
  R1 -->|uses connector| APIConn
  APIConn -->|calls REST API| SERVER
  AuthAPI -->|uses APIConn| APIConn
  CourseAPI -->|uses APIConn| APIConn
  Store -->|combines slices| AuthS
  Store -->|combines slices| CourseS

  SERVER --> UR
  SERVER --> CR
  SERVER --> PR

  UR --> MJ
  CR --> MJ
  PR --> MJ

  MJ --> AC
  MJ --> CC
  MJ --> PC

  UR --> AC
  CR --> CC
  CR --> SC
  CR --> SSC
  PR --> PC
  UR --> ContactC
  UR --> ResetC

  AC --> MUser
  CC --> MCourse
  SC --> MSection
  SSC --> MSubS
  PC --> MUser
  ContactC --> MUser
  ResetC --> MUser

  PC --> RazorExt
  ImageU --> CloudExt
  MailU --> EmailP
  RazorCfg --> RazorExt
  CloudCfg --> CloudExt

  %% Click Events
  click RI "https://github.com/rajeshsingh241/edtechplatform/blob/main/public/index.html"
  click R1 "https://github.com/rajeshsingh241/edtechplatform/blob/main/src/index.js"
  click R2 "https://github.com/rajeshsingh241/edtechplatform/blob/main/src/App.js"
  click CDN "https://github.com/rajeshsingh241/edtechplatform/blob/main/dist/output.css"
  click SERVER "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/index.js"
  click UR "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/routes/User.js"
  click CR "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/routes/Course.js"
  click PR "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/routes/Payments.js"
  click MJ "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/middlewares/auth.js"
  click AC "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/controllers/Auth.js"
  click CC "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/controllers/Course.js"
  click SC "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/controllers/Section.js"
  click SSC "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/controllers/Subsection.js"
  click PC "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/controllers/Payments.js"
  click ContactC "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/controllers/ContactUs.js"
  click ResetC "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/controllers/ResetPassword.js"
  click RazorCfg "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/config/razorpay.js"
  click CloudCfg "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/config/cloudinary.js"
  click MailU "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/utils/mailSender.js"
  click ImageU "https://github.com/rajeshsingh241/edtechplatform/blob/main/server/utils/imageUploader.js"
  click AuthS "https://github.com/rajeshsingh241/edtechplatform/blob/main/src/slices/authSlice.js"
  click AuthAPI "https://github.com/rajeshsingh241/edtechplatform/blob/main/src/services/operations/authAPI.js"
  click CourseS "https://github.com/rajeshsingh241/edtechplatform/blob/main/src/slices/courseSlice.js"
  click CourseAPI "https://github.com/rajeshsingh241/edtechplatform/blob/main/src/services/operations/courseDetailsAPI.js"
  click Store "https://github.com/rajeshsingh241/edtechplatform/blob/main/src/reducer/index.js"
  click APIConn "https://github.com/rajeshsingh241/edtechplatform/blob/main/src/services/apiconnector.js"

  %% Styles
  classDef frontend fill:#BBDEFB,stroke:#1E88E5,stroke-width:1px
  classDef backend fill:#90CAF9,stroke:#1565C0,stroke-width:1px
  classDef data fill:#C8E6C9,stroke:#2E7D32,stroke-width:1px
  classDef external fill:#FFE0B2,stroke:#EF6C00,stroke-width:1px
```
