# vishalgunjalswe/ed-tech architecture

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

- Interactive diagram: https://gitdiagram.com/vishalgunjalswe/ed-tech
- Repository: https://github.com/vishalgunjalswe/ed-tech

## Overview

##### Project Type & Overall Purpose
- StudyNotion is a full-stack ed-tech application built using the MERN stack (MongoDB, Express.js, React.js, Node.js).
- It serves multiple user groups (students, instructors, admins), facilitating course creation, consumption, ratings, reviews, and secure transactions.

##### Major Components and Their Roles
a. Frontend:
- Located in the "src" and "public" directories.
- Built with React.js and styled with Tailwind CSS.
- Uses Redux for state management.
- Handles all user interactions, routing (pages like Home, Login, Signup, CourseDetails, Dashboard, etc.), and UI rendering.

b. Backend:
- Found in the "server" directory.
- Built with Node.js and Express.js.
- Contains configuration files for cloud services and payment processing (e.g., cloudinary.js, razorpay.js, database.js).
- Implements controllers (for Auth, Courses, Payments, etc.), models (for Users, Courses, Ratings, etc.), and routes through RESTful endpoints.
- Uses JWT for secure authentication.

c. Database:
- Although not directly in the file tree, the README mentions MongoDB.
- Data is modeled in the backend via the Mongoose schemas (e.g., defined in server/models).

d. External & Third-Party Services:
- Cloud Storage: Cloudinary (see server/config/cloudinary.js).
- Payment Gateway: Razorpay integration (server/config/razorpay.js).
- Email Services: Mail templates and utilities for notifications are in the server/mail folder.
- Deployment: Frontend hosted on Vercel; backend deployed on Render/Railway; Database on MongoDB Atlas.

e. Documentation & Design Artifacts:
- Postman collection provided for API documentation.

##### Relationships & Interactions
- The Frontend sends HTTP requests (via RESTful APIs) to the Backend.
- The Backend processes requests, interacts with the MongoDB database, and communicates with external services such as Cloudinary for media and Razorpay for payments.
- JWT is used as a middleware for authentication, ensuring secure transactions between the client and server.
- Modular design in the client (components, pages) and server (controllers, routes, models) reflects separation of concerns.

##### Architectural Patterns and Design Principles
- MVC/MVVM: The backend follows an MVC-like structure with clear separation of models, controllers, and routes.
- Component-based architecture in React for high reusability.
- RESTful API design for client-server communication.
- Secure authentication using JWT, which is implemented as middleware in the server.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend (React Application)"
        F1["React App UI (src)"]
        F2["Public Assets (public)"]
        F3["Main Entry (src/index.js)"]
        F4["App Component (src/App.js)"]
        F5["Main HTML (public/index.html)"]
        F6["Auth Slice (src/slices/authSlice.js)"]
        F7["Cart Slice (src/slices/cartSlice.js)"]
        F8["Course Slice (src/slices/courseSlice.js)"]
        P1["Home Page (src/pages/Home.jsx)"]
        P2["Login Page (src/pages/Login.jsx)"]
        P3["Signup Page (src/pages/Signup.jsx)"]
        P4["Course Details (src/pages/CourseDetails.jsx)"]
        P5["Dashboard (src/pages/Dashboard.jsx)"]
    end

    subgraph "Backend (Express Server)"
        B1["Server Directory (server)"]
        B2["Server Entry (server/index.js)"]
        
        subgraph "Controllers"
            C1["Auth Controller (server/controllers/Auth.js)"]
            C2["Course Controller (server/controllers/Course.js)"]
            C3["Payments Controller (server/controllers/Payments.js)"]
            C4["Rating Reviews Controller (server/controllers/RatingAndReviews.js)"]
        end

        subgraph "Routes"
            R1["ContactUs Route (server/routes/ContactUs.js)"]
            R2["Course Route (server/routes/Course.js)"]
            R3["Payments Route (server/routes/Payments.js)"]
            R4["Profile Route (server/routes/Profile.js)"]
            R5["User Route (server/routes/User.js)"]
        end

        subgraph "Models"
            M1["User Model (server/models/User.js)"]
            M2["Course Model (server/models/Course.js)"]
            M3["Rating & Review Model (server/models/RatingAndReview.js)"]
        end

        subgraph "Middlewares"
            MD1["JWT Middleware (server/middlewares/auth.js)"]
            MD2["Demo Middleware (server/middlewares/demo.js)"]
        end

        subgraph "Utilities & Configurations"
            U1["Image Uploader (server/utils/imageUploader.js)"]
            U2["Mail Sender (server/utils/mailSender.js)"]
            CF1["Cloudinary Config (server/config/cloudinary.js)"]
            CF2["Razorpay Config (server/config/razorpay.js)"]
            CF3["Database Config (server/config/database.js)"]
        end
    end

    subgraph "External & Data Services"
        ES1["MongoDB Atlas"]
        ES2["Cloudinary Service"]
        ES3["Razorpay Service"]
        ES4["Email Service (Templates)"]
            ET1["Course Enrollment Email (server/mail/templates/courseEnrollmentEmail.js)"]
    end

    subgraph "Documentation & Artifacts"
        D1["Documentation (doc)"]
    end

    %% Relationships
    F4 -->|"REST_API"| B2
    F3 -->|"REST_API"| B2
    F6 --- F4
    F7 --- F4
    F8 --- F4
    P1 --- F4
    P2 --- F4
    P3 --- F4
    P4 --- F4
    P5 --- F4

    B2 -->|"Query"| ES1
    B2 -->|"MediaUpload"| ES2
    B2 -->|"PaymentProcessing"| ES3
    B2 -->|"SendEmail"| ET1

    %% Styles
    class F1,F2,F3,F4,F5,F6,F7,F8,P1,P2,P3,P4,P5 frontend
    class B1,B2,C1,C2,C3,C4,R1,R2,R3,R4,R5,M1,M2,M3,MD1,MD2,U1,U2,CF1,CF2,CF3 backend
    class ES1 database
    class ES2,ES3,ES4,ET1 external
    class D1 docs

    %% Click Events for Frontend
    click F1 "https://github.com/vishalgunjalswe/ed-tech/tree/main/src"
    click F2 "https://github.com/vishalgunjalswe/ed-tech/tree/main/public"
    click F3 "https://github.com/vishalgunjalswe/ed-tech/blob/main/src/index.js"
    click F4 "https://github.com/vishalgunjalswe/ed-tech/blob/main/src/App.js"
    click F5 "https://github.com/vishalgunjalswe/ed-tech/blob/main/public/index.html"
    click F6 "https://github.com/vishalgunjalswe/ed-tech/blob/main/src/slices/authSlice.js"
    click F7 "https://github.com/vishalgunjalswe/ed-tech/blob/main/src/slices/cartSlice.js"
    click F8 "https://github.com/vishalgunjalswe/ed-tech/blob/main/src/slices/courseSlice.js"
    click P1 "https://github.com/vishalgunjalswe/ed-tech/blob/main/src/pages/Home.jsx"
    click P2 "https://github.com/vishalgunjalswe/ed-tech/blob/main/src/pages/Login.jsx"
    click P3 "https://github.com/vishalgunjalswe/ed-tech/blob/main/src/pages/Signup.jsx"
    click P4 "https://github.com/vishalgunjalswe/ed-tech/blob/main/src/pages/CourseDetails.jsx"
    click P5 "https://github.com/vishalgunjalswe/ed-tech/blob/main/src/pages/Dashboard.jsx"

    %% Click Events for Backend
    click B1 "https://github.com/vishalgunjalswe/ed-tech/tree/main/server"
    click B2 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/index.js"
    click C1 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/controllers/Auth.js"
    click C2 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/controllers/Course.js"
    click C3 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/controllers/Payments.js"
    click C4 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/controllers/RatingAndReviews.js"
    click R1 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/routes/ContactUs.js"
    click R2 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/routes/Course.js"
    click R3 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/routes/Payments.js"
    click R4 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/routes/Profile.js"
    click R5 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/routes/User.js"
    click M1 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/models/User.js"
    click M2 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/models/Course.js"
    click M3 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/models/RatingAndReview.js"
    click MD1 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/middlewares/auth.js"
    click MD2 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/middlewares/demo.js"
    click U1 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/utils/imageUploader.js"
    click U2 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/utils/mailSender.js"
    click CF1 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/config/cloudinary.js"
    click CF2 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/config/razorpay.js"
    click CF3 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/config/database.js"

    %% Click Events for Email Templates
    click ET1 "https://github.com/vishalgunjalswe/ed-tech/blob/main/server/mail/templates/courseEnrollmentEmail.js"

    %% Click Event for Documentation
    click D1 "https://github.com/vishalgunjalswe/ed-tech/tree/main/doc"

classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
classDef database fill:#ffeeba,stroke:#856404,stroke-width:2px;
classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;
classDef docs fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
