# mary1afshar/schedulens architecture

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

- Interactive diagram: https://gitdiagram.com/mary1afshar/schedulens
- Repository: https://github.com/mary1afshar/schedulens

## Overview

##### Main System Components

a) Frontend Layer (React Application)
- User Interface Components
- Authentication Views
- Protected Routes
- Context Management

b) Backend Services
- Firebase Authentication
- Firebase Database (likely Firestore)
- User Management
- Class Management
- Friend Management

##### Component Organization

A. Client-Side (React)
- Pages (Landing, Login, Signup, Home, Classes, Schedule, etc.)
- Components (Navbar, CourseCard, Profile, etc.)
- Context (AuthContext for state management)
- Protected Routes

B. Firebase Services
- Authentication Service
- Database Service
- Storage Service (if used for profile pictures)

##### Authentication Flow
- User → Login/Signup Components → Firebase Auth
- Firebase Auth → AuthContext → Protected Routes

##### Data Flow
- Components → Firebase Database (for class data)
- Components → Firebase Database (for friend connections)
- Firebase Database → Components (for displaying schedules)

##### Specific Implementation Details

Technical aspects:

**Frontend (React):**
- Components Layer
- Reusable Components (CourseCard, Navbar)
- Page-specific Components
- Context Layer (AuthContext)
- Routing Layer (ProtectedRoute)
- Pages Layer (Home, Login, etc.)

**Firebase Services:**
- Authentication
- Database
- Security Rules

##### Schedule comparison functionality

- User authentication
- Class management
- Friend connections
- Schedule comparison
- Data persistence

This system design should clearly communicate how ScheduLens achieves its goal of connecting students with shared classes while maintaining security and providing a smooth user experience.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        direction TB
        App["App Component"]
        
        subgraph "Frontend Components"
            direction TB
            Nav["Navigation Bar"]
            CourseCard["Course Card"]
            ClassComp["Class Component"]
            ProfileComp["Profile Component"]
        end

        subgraph "Pages"
            direction TB
            Landing["Landing Page"]
            Login["Login Page"]
            Signup["Signup Page"]
            Home["Home Page"]
            Classes["Classes Page"]
            AddClasses["Add Classes Page"]
            Schedule["Schedule Page"]
            Friends["Friends Page"]
            Profile["Profile Page"]
        end

        subgraph "Core Services"
            direction TB
            ProtectedRoute["Protected Route System"]
            AuthContext["Authentication Context"]
            FirebaseConfig["Firebase Integration"]
        end
    end

    subgraph "Firebase Services"
        direction TB
        Auth["Authentication Service"]
        DB["Firestore Database"]
        Storage["Storage Service"]
    end

    %% Connections
    App --> Nav
    App --> AuthContext
    AuthContext --> ProtectedRoute
    ProtectedRoute --> Home
    ProtectedRoute --> Classes
    ProtectedRoute --> Schedule
    ProtectedRoute --> Friends
    ProtectedRoute --> Profile
    
    FirebaseConfig --> Auth
    FirebaseConfig --> DB
    FirebaseConfig --> Storage
    
    Classes --> CourseCard
    Classes --> ClassComp
    Profile --> ProfileComp

    %% Data Flows
    Auth <--> AuthContext
    DB <--> Classes
    DB <--> Friends
    DB <--> Schedule
    Storage <--> Profile

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef frontend fill:#dae8fc,stroke:#6c8ebf
    classDef firebase fill:#d5e8d4,stroke:#82b366
    classDef auth fill:#ffe6cc,stroke:#d79b00
    classDef protected fill:#e1d5e7,stroke:#9673a6

    class App,Nav,CourseCard,ClassComp,ProfileComp frontend
    class Auth,DB,Storage firebase
    class AuthContext,Login,Signup auth
    class ProtectedRoute,Home,Classes,Schedule,Friends,Profile protected

    %% Click Events
    click App "https://github.com/mary1afshar/scheduLens/blob/main/src/App.js"
    click Nav "https://github.com/mary1afshar/scheduLens/blob/main/src/components/navbar/navbar.js"
    click ProtectedRoute "https://github.com/mary1afshar/scheduLens/blob/main/src/ProtectedRoute.js"
    click AuthContext "https://github.com/mary1afshar/scheduLens/blob/main/src/context/AuthContext.js"
    click FirebaseConfig "https://github.com/mary1afshar/scheduLens/blob/main/src/firebase.js"
    click Login "https://github.com/mary1afshar/scheduLens/blob/main/src/pages/login/Login.js"
    click Signup "https://github.com/mary1afshar/scheduLens/blob/main/src/pages/signup/Signup.js"
    click Classes "https://github.com/mary1afshar/scheduLens/blob/main/src/pages/classes/classes.js"
    click AddClasses "https://github.com/mary1afshar/scheduLens/blob/main/src/pages/add-classes/Add.js"
    click CourseCard "https://github.com/mary1afshar/scheduLens/blob/main/src/components/CourseCard/CourseCard.js"
    click Friends "https://github.com/mary1afshar/scheduLens/blob/main/src/pages/add-friends/friends.js"
    click Schedule "https://github.com/mary1afshar/scheduLens/blob/main/src/pages/my-schedule/schedule.js"
    click ProfileComp "https://github.com/mary1afshar/scheduLens/blob/main/src/components/profile/profile.js"
    click Profile "https://github.com/mary1afshar/scheduLens/blob/main/src/pages/profile/profile.js"
    click Home "https://github.com/mary1afshar/scheduLens/blob/main/src/pages/home/Home.js"
    click Landing "https://github.com/mary1afshar/scheduLens/blob/main/src/pages/landing/Landing.js"
    click ClassComp "https://github.com/mary1afshar/scheduLens/blob/main/src/components/class/class.js"
```
