# vasudevshetty/studysyncs-v2 architecture

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

- Interactive diagram: https://gitdiagram.com/vasudevshetty/studysyncs-v2
- Repository: https://github.com/vasudevshetty/studysyncs-v2

## Overview

##### Main System Components

A. Frontend (Client Layer):
- Sub-components:
- Home Module (Landing pages)
- Dashboard Module
- Authentication Module
- Notes Management
- Attendance System
- GPA Calculator
- Discussion System

B. Backend (Server Layer):
- Sub-components:
- API Routes
- Controllers
- Middleware Layer
- Services Layer

C. Database Layer:
- Core Models (College, Course, Batch, Section)
- User Models (User, USN)
- Notes Models (Subject, Chapter, Resource)
- Attendance Models (Records, Timetable)

##### Component Relationships

A. Client-Server Communication:
- RESTful API calls between frontend and backend
- Authentication flows
- Data fetching paths

B. Data Flow:
- User authentication flow
- Notes management flow
- Attendance tracking flow
- Academic data processing

##### Technical Details

- Frontend: React, Vite, TailwindCSS
- Backend: Node.js, Express
- Database: MongoDB
- Authentication: JWT, OAuth
- File Storage: PDF system

##### Additional Elements

Include:
- Version information
- Data flow direction indicators
- Security boundaries
- API gateway
- Error handling flow

##### Important Architectural Patterns to Highlight

- MVC pattern in backend
- Component-based architecture in frontend
- Service-oriented middleware
- Data access layers
- Authentication middleware flow

This system design should effectively communicate the application's architecture while highlighting its educational focus and core functionalities.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        FE[Client Application]
        Home["Home Module"]:::frontend
        Dashboard["Dashboard Module"]:::frontend
        Auth["Authentication UI"]:::frontend
        Notes["Notes Management"]:::frontend
        Attend["Attendance System"]:::frontend
        GPA["GPA Calculator"]:::frontend
        Discuss["Discussion System"]:::frontend
        
        FE --> Home
        FE --> Dashboard
        FE --> Auth
        FE --> Notes
        FE --> Attend
        FE --> GPA
        FE --> Discuss
    end

    subgraph Server
        BE[Node.js Server]:::backend
        AuthC["Authentication Controller"]:::backend
        OAuth["OAuth Service"]:::backend
        JWT["JWT Handler"]:::backend
        Protect["Auth Middleware"]:::backend
        ErrorM["Error Handler"]:::backend
        APIRoutes["API Routes"]:::backend
        
        BE --> AuthC
        BE --> OAuth
        BE --> JWT
        BE --> Protect
        BE --> ErrorM
        BE --> APIRoutes
    end

    subgraph Database
        DB[(MongoDB)]:::database
        CoreM["Core Models"]:::database
        UserM["User Models"]:::database
        NotesM["Notes Models"]:::database
        AttendM["Attendance Models"]:::database
        
        DB --> CoreM
        DB --> UserM
        DB --> NotesM
        DB --> AttendM
    end

    subgraph Context
        AuthCtx["Auth Context"]:::context
        ThemeCtx["Theme Context"]:::context
        ModalCtx["Modal Context"]:::context
    end

    Client --> Server
    Server --> Database
    Client --> Context

    %% Click Events
    click Home "https://github.com/vasudevshetty/studysyncs-v2/tree/main/client/src/components/Home/"
    click Dashboard "https://github.com/vasudevshetty/studysyncs-v2/tree/main/client/src/components/App/Dashboard/"
    click Notes "https://github.com/vasudevshetty/studysyncs-v2/tree/main/client/src/components/App/Notes/"
    click Attend "https://github.com/vasudevshetty/studysyncs-v2/tree/main/client/src/components/App/Attendance/"
    click GPA "https://github.com/vasudevshetty/studysyncs-v2/tree/main/client/src/components/App/GPACalculator/"
    click Discuss "https://github.com/vasudevshetty/studysyncs-v2/blob/main/client/src/components/App/Discuss.jsx"
    click Auth "https://github.com/vasudevshetty/studysyncs-v2/blob/main/client/src/pages/Login.jsx"
    click BE "https://github.com/vasudevshetty/studysyncs-v2/blob/main/server.js"
    click AuthC "https://github.com/vasudevshetty/studysyncs-v2/blob/main/controllers/auth.controller.js"
    click OAuth "https://github.com/vasudevshetty/studysyncs-v2/blob/main/services/oauth.js"
    click JWT "https://github.com/vasudevshetty/studysyncs-v2/blob/main/util/setJWT.js"
    click CoreM "https://github.com/vasudevshetty/studysyncs-v2/tree/main/models/Core/"
    click UserM "https://github.com/vasudevshetty/studysyncs-v2/tree/main/models/User/"
    click NotesM "https://github.com/vasudevshetty/studysyncs-v2/tree/main/models/Notes/"
    click AttendM "https://github.com/vasudevshetty/studysyncs-v2/tree/main/models/Attendance/"
    click Protect "https://github.com/vasudevshetty/studysyncs-v2/blob/main/middlewares/protect.middleware.js"
    click ErrorM "https://github.com/vasudevshetty/studysyncs-v2/blob/main/middlewares/error.middleware.js"
    click APIRoutes "https://github.com/vasudevshetty/studysyncs-v2/blob/main/routes/auth.route.js"
    click AuthCtx "https://github.com/vasudevshetty/studysyncs-v2/blob/main/client/src/context/authContext.jsx"
    click ThemeCtx "https://github.com/vasudevshetty/studysyncs-v2/blob/main/client/src/components/context/ThemeContext.jsx"
    click ModalCtx "https://github.com/vasudevshetty/studysyncs-v2/blob/main/client/src/components/context/ModalContext.jsx"

    %% Styling
    classDef frontend fill:#2563eb,color:white
    classDef backend fill:#16a34a,color:white
    classDef database fill:#ca8a04,color:white
    classDef context fill:#9333ea,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Service"]:::backend
        Database["Database Component"]:::database
        ContextL["Context/State"]:::context
    end
```
