# panchalparth471/studynotion architecture

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

- Interactive diagram: https://gitdiagram.com/panchalparth471/studynotion
- Repository: https://github.com/panchalparth471/studynotion

## Overview

##### Main System Components

A. Frontend (Client-Side)
- React Application Layer
- State Management (Redux - evident from slices folder)
- Core Features (Auth, Courses, Dashboard)
- Common Components
- Service Layer

B. Backend (Server-Side)
- Express.js Server
- API Controllers
- Authentication Middleware
- Database Models
- External Services Integration

C. External Services
- Cloudinary (for media storage)
- Razorpay (for payments)
- Email Service

##### Detailed Component Breakdown

Frontend Section:
- Show main pages (Home, Course, Dashboard, etc.)
- Highlight core components structure
- Include service layer connecting to backend
- Show Redux store with different slices
- Demonstrate auth flow and protected routes

Backend Section:
- API Routes layer
- Controller layer
- Middleware (especially auth)
- Database Models
- External service connectors

##### Connection Flows

Key interactions:
- API calls between frontend and backend
- Authentication flow
- Course creation and consumption flow
- Payment processing flow
- Media upload flow

##### Architecture Patterns to Highlight

- MVC pattern in backend
- Component-based architecture in frontend
- Service-oriented architecture for external integrations
- Redux state management flow

##### Technical Stack Indicators

- React.js (Frontend)
- Express.js (Backend)
- MongoDB (Database)
- Redux (State Management)
- Cloudinary (Media)
- Razorpay (Payments)

**[Client Layer (React + Redux)]**
- ↕
**[API Gateway Layer]**
- ↕
**[Service Layer]**
- ↕
**[Database Layer]**

With external services shown on the side:
**[Cloudinary] ← → [Core Application] ← → [Razorpay]**
- ↕
- [Email Service]

Remember to:
- Keep components modular
- Clear data flow directions
- Security boundaries
- Brief descriptions for complex flows

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Layer"]
        direction TB
        ReactApp["React Application"]
        Pages["Pages"]
        CoreComp["Core Components"]
        Common["Common Components"]
        
        subgraph StateManagement["State Management"]
            ReduxStore["Redux Store"]
            Slices["Redux Slices"]
            Operations["Redux Operations"]
        end
        
        subgraph AuthFront["Authentication Frontend"]
            AuthComponents["Auth Components"]
            ProtectedRoutes["Protected Routes"]
        end
        
        subgraph Dashboard["Dashboard"]
            InstructorDash["Instructor Dashboard"]
            StudentDash["Student Dashboard"]
            CourseManagement["Course Management"]
        end
    end
    
    subgraph Server["Server Layer"]
        direction TB
        Express["Express.js Server"]
        
        subgraph API["API Layer"]
            Routes["API Routes"]
            ApiController["API Controllers"]
        end
        
        subgraph Auth["Authentication"]
            AuthMiddleware["Auth Middleware"]
            AuthController["Auth Controller"]
        end
        
        subgraph Services["Service Layer"]
            CloudinaryService["Cloudinary Service"]
            RazorpayService["Razorpay Service"]
            EmailService["Email Service"]
        end
        
        subgraph DB["Database Layer"]
            MongoDB[(MongoDB)]
            UserModel["User Model"]
            CourseModel["Course Model"]
        end
    end
    
    subgraph External["External Services"]
        Cloudinary["Cloudinary"]
        Razorpay["Razorpay"]
        EmailProvider["Email Provider"]
    end
    
    %% Connections
    ReactApp --> Pages
    ReactApp --> CoreComp
    ReactApp --> Common
    ReactApp --> StateManagement
    StateManagement --> API
    AuthFront --> Auth
    Dashboard --> API
    API --> Services
    Services --> External
    Auth --> DB
    API --> DB
    
    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black
    classDef auth fill:#e74c3c,stroke:#c0392b,color:white
    classDef database fill:#9b59b6,stroke:#8e44ad,color:white
    
    class ReactApp,Pages,CoreComp,Common,StateManagement,AuthFront,Dashboard frontend
    class Express,API,Services backend
    class Cloudinary,Razorpay,EmailProvider external
    class Auth,AuthMiddleware,AuthController auth
    class DB,MongoDB,UserModel,CourseModel database
    
    %% Click Events
    click ReactApp "https://github.com/Panchalparth471/StudyNotion/blob/main/src/App.jsx"
    click Pages "https://github.com/Panchalparth471/StudyNotion/tree/main/src/pages/"
    click CoreComp "https://github.com/Panchalparth471/StudyNotion/tree/main/src/components/core/"
    click Common "https://github.com/Panchalparth471/StudyNotion/tree/main/src/components/Common/"
    click ReduxStore "https://github.com/Panchalparth471/StudyNotion/blob/main/src/reducer/index.js"
    click Slices "https://github.com/Panchalparth471/StudyNotion/tree/main/src/slices/"
    click Operations "https://github.com/Panchalparth471/StudyNotion/tree/main/src/services/operations/"
    click AuthComponents "https://github.com/Panchalparth471/StudyNotion/tree/main/src/components/core/Auth/"
    click AuthController "https://github.com/Panchalparth471/StudyNotion/blob/main/server/controllers/Auth.js"
    click AuthMiddleware "https://github.com/Panchalparth471/StudyNotion/blob/main/server/middleware/auth.js"
    click UserModel "https://github.com/Panchalparth471/StudyNotion/blob/main/server/models/User.js"
    click CourseModel "https://github.com/Panchalparth471/StudyNotion/blob/main/server/models/Course.js"
    click InstructorDash "https://github.com/Panchalparth471/StudyNotion/tree/main/src/components/core/Dashboard/InstructorDashboard/"
    click CourseManagement "https://github.com/Panchalparth471/StudyNotion/tree/main/src/components/core/Dashboard/AddCourse/"
    click CloudinaryService "https://github.com/Panchalparth471/StudyNotion/blob/main/server/config/cloudinary.js"
    click RazorpayService "https://github.com/Panchalparth471/StudyNotion/blob/main/server/config/razorpay.js"
    click EmailService "https://github.com/Panchalparth471/StudyNotion/blob/main/server/utils/mailSender.js"
    click Routes "https://github.com/Panchalparth471/StudyNotion/tree/main/server/routes/"
    click ApiController "https://github.com/Panchalparth471/StudyNotion/tree/main/server/controllers/"
    click MongoDB "https://github.com/Panchalparth471/StudyNotion/blob/main/server/config/database.js"
```
