# chandrachur67/learnify architecture

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

- Interactive diagram: https://gitdiagram.com/chandrachur67/learnify
- Repository: https://github.com/chandrachur67/learnify

## Overview

##### Main Components

a) Client-Side (Frontend):
- React Application Layer
- User Interface Components
- Authentication Views (Login/Signup)
- Role-based Components (Admin/Instructor/User)
- Course Management Interface
- Video Player Component
- Live Streaming Interface
- Doubt Corner
- Exam Corner

b) Server-Side (Backend):
- Express.js API Layer
- Authentication & Authorization Middleware
- Controllers Layer
- Models Layer
- Route Handlers

c) External Services:
- ZegoCloud (for live streaming)
- Video Storage Service
- Image Storage Service
- (Future) Payment Gateway

##### Component Relationships

- Frontend to Backend API communication
- Authentication flow
- Role-based access control
- Data flow for course creation/consumption
- Video streaming architecture
- Real-time communication for live classes
- Doubt corner interaction flow

##### Specific Implementation Details

- Blue rectangles for frontend components
- Green rectangles for backend services
- Yellow diamonds for middleware
- Purple circles for external services
- Red rectangles for database models

##### Architectural Patterns to Highlight

- MVC Pattern in backend (Models, Controllers, Routes)
- Component-based architecture in React frontend
- Redux store for state management
- Protected routing system
- Middleware authentication chain

##### Detailed Component Breakdown

Frontend Layer:
- Authentication Components
- Core Components
- Course Management
- Video Platform
- Live Streaming
- Interactive Features
- Role-Specific Views
- Admin Dashboard
- Instructor Interface
- Student Portal
- State Management (Redux)

Backend Layer:
- API Routes
- Middleware Chain
- Authentication
- Role Verification
- Access Control
- Controllers
- Database Models

##### Data Flow Indicators

- User authentication flow
- Course creation/editing flow
- Video upload/streaming flow
- Live class initialization
- Doubt posting/resolution flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI[User Interface Layer]
        Auth[Authentication Views]:::auth
        click Auth "https://github.com/Chandrachur67/learnify/blob/master/client/src/pages/LogIn.jsx"
        
        subgraph RoleViews[Role-based Views]
            Admin[Admin Dashboard]:::role
            click Admin "https://github.com/Chandrachur67/learnify/blob/master/client/src/pages/AdminDashboard.jsx"
            Inst[Instructor Interface]:::role
            click Inst "https://github.com/Chandrachur67/learnify/blob/master/client/src/pages/Instructor.jsx"
            Student[Student Portal]:::role
        end
        
        subgraph CoreFeatures[Core Features]
            CM[Course Management]:::core
            click CM "https://github.com/Chandrachur67/learnify/blob/master/client/src/pages/CreateCourseForm.jsx"
            VP[Video Platform]:::core
            click VP "https://github.com/Chandrachur67/learnify/blob/master/client/src/pages/Video.jsx"
            LS[Live Streaming]:::core
            click LS "https://github.com/Chandrachur67/learnify/blob/master/client/src/pages/LiveStream.jsx"
            DC[Doubt Corner]:::core
            click DC "https://github.com/Chandrachur67/learnify/blob/master/client/src/components/Doubt.js"
            EC[Exam Corner]:::core
            click EC "https://github.com/Chandrachur67/learnify/blob/master/client/src/components/ExamCorner.js"
        end
        
        Redux[Redux Store]:::state
        click Redux "https://github.com/Chandrachur67/learnify/blob/master/client/src/store/store.js"
    end
    
    subgraph Backend
        API[Express API Layer]
        
        subgraph Middleware[Middleware Chain]
            AuthMW[Authentication]:::middleware
            click AuthMW "https://github.com/Chandrachur67/learnify/blob/master/server/middlewares/authenticationGeneral.js"
            RoleMW[Role Verification]:::middleware
            AccessMW[Access Control]:::middleware
        end
        
        subgraph Controllers
            AdminC[Admin Controller]:::controller
            click AdminC "https://github.com/Chandrachur67/learnify/blob/master/server/controller/adminController.js"
            CourseC[Course Controller]:::controller
            click CourseC "https://github.com/Chandrachur67/learnify/blob/master/server/controller/courseController.js"
            InstC[Instructor Controller]:::controller
            click InstC "https://github.com/Chandrachur67/learnify/blob/master/server/controller/instructorController.js"
            UserC[User Controller]:::controller
            click UserC "https://github.com/Chandrachur67/learnify/blob/master/server/controller/userController.js"
            VideoC[Video Controller]:::controller
            click VideoC "https://github.com/Chandrachur67/learnify/blob/master/server/controller/videoController.js"
        end
        
        subgraph Models
            AdminM[Admin Model]:::model
            click AdminM "https://github.com/Chandrachur67/learnify/blob/master/server/models/admin.js"
            CourseM[Course Model]:::model
            click CourseM "https://github.com/Chandrachur67/learnify/blob/master/server/models/course.js"
            InstM[Instructor Model]:::model
            click InstM "https://github.com/Chandrachur67/learnify/blob/master/server/models/instructor.js"
            UserM[User Model]:::model
            click UserM "https://github.com/Chandrachur67/learnify/blob/master/server/models/user.js"
            VideoM[Video Model]:::model
            click VideoM "https://github.com/Chandrachur67/learnify/blob/master/server/models/videoLecture.js"
        end
        
        subgraph Routes
            AdminR[Admin Routes]:::route
            click AdminR "https://github.com/Chandrachur67/learnify/blob/master/server/routes/admin.js"
            CourseR[Course Routes]:::route
            click CourseR "https://github.com/Chandrachur67/learnify/blob/master/server/routes/course.js"
            InstR[Instructor Routes]:::route
            click InstR "https://github.com/Chandrachur67/learnify/blob/master/server/routes/instructor.js"
            UserR[User Routes]:::route
            click UserR "https://github.com/Chandrachur67/learnify/blob/master/server/routes/user.js"
            VideoR[Video Routes]:::route
            click VideoR "https://github.com/Chandrachur67/learnify/blob/master/server/routes/video.js"
        end
    end
    
    subgraph ExternalServices[External Services]
        ZegoCloud[ZegoCloud]:::external
        VideoStorage[Video Storage]:::external
        ImageStorage[Image Storage]:::external
        Payment[Payment Gateway]:::external
    end
    
    %% Connections
    UI --> Auth
    Auth --> API
    RoleViews --> API
    CoreFeatures --> API
    
    API --> Middleware
    Middleware --> Controllers
    Controllers --> Models
    API --> Routes
    Routes --> Controllers
    
    LS --> ZegoCloud
    VP --> VideoStorage
    UI --> ImageStorage
    UI -.-> Payment
    
    %% Styling
    classDef auth fill:#f9f,stroke:#333
    classDef role fill:#aaf,stroke:#333
    classDef core fill:#afa,stroke:#333
    classDef state fill:#ffa,stroke:#333
    classDef middleware fill:#ff9,stroke:#333
    classDef controller fill:#9f9,stroke:#333
    classDef model fill:#f99,stroke:#333
    classDef route fill:#99f,stroke:#333
    classDef external fill:#c9f,stroke:#333
```
