# alonmesh/easyshifts architecture

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

- Interactive diagram: https://gitdiagram.com/alonmesh/easyshifts
- Repository: https://github.com/alonmesh/easyshifts

## Overview

##### Main Components Overview

a) Frontend Layer (React Application)
- React components hierarchy
- Components by functionality (Auth, Manager Features, Employee Features)
- Routing structure

b) Backend Layer (Python Server)
- Handlers structure
- Database access layers (Controller -> Service -> Repository pattern)
- Authentication system

c) Database Layer (MySQL)
- Six main tables and their relationships
- Data flow between tables

##### Detailed Component Breakdown

- Authentication (Login, SignUp components)
- Manager Dashboard (ManagerProfile, ManagerSchedule, ManagerSettings)
- Employee Dashboard (EmployeeProfile, ShiftsPage, SignInShifts)

- Create sections for:
- API Handlers (group by functionality)
- Authentication Layer
- Business Logic Layer (Services)
- Data Access Layer (Controllers and Repositories)
- Database Models

- Six tables:
- Users
- Workplaces
- UserRequests
- Shifts
- ShiftWorkers
- ShiftBoard

##### Connection and Data Flow

- HTTP/API requests between Frontend and Backend
- Database queries and responses
- Authentication flow
- Business logic flow

##### Technical Details

Annotations for:
- Technologies used (React, Python, MySQL)
- Key libraries and dependencies
- API endpoints
- Database relationships

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        Auth[Authentication Components]
        MD[Manager Dashboard]
        ED[Employee Dashboard]
        SC[Shared Components]

        subgraph AuthComponents
            Login["Login"]:::frontend
            SignUp["SignUp"]:::frontend
        end

        subgraph ManagerDashboard
            MP["Manager Profile"]:::frontend
            MS["Manager Schedule"]:::frontend
            MSt["Manager Settings"]:::frontend
        end

        subgraph EmployeeDashboard
            EP["Employee Profile"]:::frontend
            SP["Shifts Page"]:::frontend
        end

        subgraph SharedComponents
            TB["Toolbar"]:::frontend
            IC["Icons"]:::frontend
        end
    end

    subgraph Backend
        API["API Server"]:::backend
        SM["Session Management"]:::backend
        AH["Authentication Handler"]:::backend

        subgraph BusinessLogic
            US["Users Service"]:::service
            SS["Shifts Service"]:::service
            WS["Workplaces Service"]:::service
        end

        subgraph Handlers
            MH["Manager Handlers"]:::handler
            EH["Employee Handlers"]:::handler
        end

        subgraph DataAccess
            CTRL["Controllers"]:::data
            REPO["Repositories"]:::data
            Models["Database Models"]:::data
        end
    end

    subgraph Database
        Users[(Users)]:::db
        Workplaces[(Workplaces)]:::db
        UserRequests[(UserRequests)]:::db
        Shifts[(Shifts)]:::db
        ShiftWorkers[(ShiftWorkers)]:::db
        ShiftBoard[(ShiftBoard)]:::db
    end

    %% Frontend to Backend Connections
    Auth --> AH
    MD --> MH
    ED --> EH

    %% Backend Layer Connections
    AH --> SM
    MH --> BusinessLogic
    EH --> BusinessLogic
    BusinessLogic --> DataAccess
    DataAccess --> Database

    %% Database Relationships
    Users --> Workplaces
    Users --> UserRequests
    Users --> ShiftWorkers
    Shifts --> ShiftWorkers
    Shifts --> ShiftBoard
    Workplaces --> ShiftBoard

    %% Styling
    classDef frontend fill:#a8d1ff
    classDef backend fill:#90EE90
    classDef service fill:#98FB98
    classDef handler fill:#3CB371
    classDef data fill:#32CD32
    classDef db fill:#FFD700

    %% Click Events
    click Login "https://github.com/AlonMesh/EasyShifts/blob/main/app/src/components/Login.jsx"
    click SignUp "https://github.com/AlonMesh/EasyShifts/blob/main/app/src/components/SignUp.jsx"
    click MP "https://github.com/AlonMesh/EasyShifts/blob/main/app/src/components/ManagerProfile.jsx"
    click MS "https://github.com/AlonMesh/EasyShifts/blob/main/app/src/components/ManagerSchedule/ManagerSchedule.jsx"
    click MSt "https://github.com/AlonMesh/EasyShifts/blob/main/app/src/components/ManagerSettings.jsx"
    click EP "https://github.com/AlonMesh/EasyShifts/blob/main/app/src/components/EmployeeProfile.jsx"
    click SP "https://github.com/AlonMesh/EasyShifts/blob/main/app/src/components/ShiftsPage.jsx"
    click TB "https://github.com/AlonMesh/EasyShifts/blob/main/app/src/components/Toolbar.jsx"
    click IC "https://github.com/AlonMesh/EasyShifts/tree/main/app/src/components/Icons/"
    click AH "https://github.com/AlonMesh/EasyShifts/blob/main/Backend/handlers/auth/authentication.py"
    click MH "https://github.com/AlonMesh/EasyShifts/blob/main/Backend/handlers/manager_schedule.py"
    click EH "https://github.com/AlonMesh/EasyShifts/blob/main/Backend/handlers/employee_shifts_request.py"
    click US "https://github.com/AlonMesh/EasyShifts/blob/main/Backend/db/services/users_service.py"
    click SS "https://github.com/AlonMesh/EasyShifts/blob/main/Backend/db/services/shifts_service.py"
    click WS "https://github.com/AlonMesh/EasyShifts/blob/main/Backend/db/services/workPlaces_service.py"
    click CTRL "https://github.com/AlonMesh/EasyShifts/tree/main/Backend/db/controllers/"
    click REPO "https://github.com/AlonMesh/EasyShifts/tree/main/Backend/db/repositories/"
    click Models "https://github.com/AlonMesh/EasyShifts/blob/main/Backend/db/models.py"
    click API "https://github.com/AlonMesh/EasyShifts/blob/main/Backend/Server.py"
    click SM "https://github.com/AlonMesh/EasyShifts/blob/main/Backend/user_session.py"
```
