# bharathdatti/socialtrackb architecture

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

- Interactive diagram: https://gitdiagram.com/bharathdatti/socialtrackb
- Repository: https://github.com/bharathdatti/socialtrackb

## Overview

##### Main Components
- Frontend Interface: The application is a single-page app structured in React. The primary entry point is src/main.jsx, which loads App.jsx and then branches out to various components.
- Role-based UI Components:
- Admin: Components located in src/components/admin (e.g., Attendance, BatchManagement, Courses, Dashboard, ResetData, Schedule)
- Student: Components in src/components/student (e.g., AttendanceHistory, StudentAttendance)
- Authentication: Components in src/components/auth (e.g., Login, PrivateRoute)
- Shared Components: Such as NotFound and UnderConstruction within src/components/shared for handling common UI elements
- Layouts: AdminLayout and StudentLayout in src/layouts to standardize page structure depending on user roles.
- State Management: The Redux store found in src/store indicates the usage of slices (such as attendanceSlice, authSlice, batchSlice, dashboardSlice, scheduleSlice) to manage application state.
- Backend / Firebase Integration: Firebase configuration in src/firebase/config.js suggesting that Firebase services (likely authentication, database, or hosting features) are a backend dependency.
- Static Assets and Configurations: Files like index.html, Tailwind CSS setups (tailwind.config.js, postcss.config.js), and Vite configurations (vite.config.js) define the build and styling methodologies.

##### Component Interactions
- The state management layer interacts with Firebase (via the configuration and possible helper functions) to handle data retrieval and real-time updates.
- The role-based layouts (AdminLayout and StudentLayout) wrap their respective UI components, enforcing role-specific presentation and perhaps route protection.
- Authentication flows are managed through the auth components (Login, PrivateRoute), working with the authSlice and potentially triggering Firebase authentication services.

##### Architectural Patterns
- MVC-like / Separation of Concerns: While it’s not a strict MVC, the division between “view” (React components), “model” (Redux store/slices), and “backend” (Firebase) is evident.
- Component-based architecture: Small, focused React components organized into folders by their function (admin, student, auth, and shared).
- Use of Layout components to manage consistent UI structure for different user roles.
- Emphasis on state management using slices that help maintain a clean separation between different domain functionalities.

##### Relevant Technologies
- React, Vite, Tailwind CSS for the frontend and UI.
- Redux for state management.
- Firebase for backend services (authentication, database).
- ESLint configuration for code quality.
- PostCSS for handling CSS transformations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Interface
    subgraph "Frontend"
        FE1("Frontend: main.jsx"):::frontend
        FE2("Frontend: App.jsx"):::frontend
    end

    %% Layouts
    subgraph "Layouts"
        L1("AdminLayout"):::layout
        L2("StudentLayout"):::layout
    end

    %% UI Components
    subgraph "UI Components"
        subgraph "Admin UI Components"
            A1("Attendance"):::uiAdmin
            A2("Batch Management"):::uiAdmin
            A3("Courses"):::uiAdmin
            A4("Dashboard"):::uiAdmin
            A5("Reset Data"):::uiAdmin
            A6("Schedule"):::uiAdmin
        end
        subgraph "Student UI Components"
            S1("Attendance History"):::uiStudent
            S2("Student Attendance"):::uiStudent
        end
        subgraph "Auth Components"
            AU1("Login"):::uiAuth
            AU2("PrivateRoute"):::uiAuth
        end
        subgraph "Shared UI Components"
            SH1("NotFound"):::uiShared
            SH2("Under Construction"):::uiShared
        end
    end

    %% State Management
    subgraph "State Management"
        RS("Redux Store"):::redux
        subgraph "Redux Slices"
            RS1("Attendance Slice"):::slice
            RS2("Auth Slice"):::slice
            RS3("Batch Slice"):::slice
            RS4("Dashboard Slice"):::slice
            RS5("Schedule Slice"):::slice
        end
    end

    %% Backend / Firebase Integration
    B1("Firebase Integration"):::firebase

    %% Connections
    FE1 --> FE2
    FE2 --> L1
    FE2 --> L2
    FE2 --> AU1
    FE2 --> SH1

    L1 --> A1
    L1 --> A2
    L1 --> A3
    L1 --> A4
    L1 --> A5
    L1 --> A6

    L2 --> S1
    L2 --> S2

    %% UI Components connect to Redux Store
    A1 --> RS
    A2 --> RS
    A3 --> RS
    A4 --> RS
    A5 --> RS
    A6 --> RS
    S1 --> RS
    S2 --> RS
    AU1 --> RS
    AU2 --> RS
    SH1 --> RS
    SH2 --> RS

    %% Redux Store connects to Slices and Backend
    RS --> RS1
    RS --> RS2
    RS --> RS3
    RS --> RS4
    RS --> RS5
    RS --> B1

    %% Click Events
    click FE1 "https://github.com/bharathdatti/socialtrackb/blob/main/src/main.jsx"
    click FE2 "https://github.com/bharathdatti/socialtrackb/blob/main/src/App.jsx"
    click A1 "https://github.com/bharathdatti/socialtrackb/blob/main/src/components/admin/Attendance.jsx"
    click A2 "https://github.com/bharathdatti/socialtrackb/blob/main/src/components/admin/BatchManagement.jsx"
    click A3 "https://github.com/bharathdatti/socialtrackb/blob/main/src/components/admin/Courses.jsx"
    click A4 "https://github.com/bharathdatti/socialtrackb/blob/main/src/components/admin/Dashboard.jsx"
    click A5 "https://github.com/bharathdatti/socialtrackb/blob/main/src/components/admin/ResetData.jsx"
    click A6 "https://github.com/bharathdatti/socialtrackb/blob/main/src/components/admin/Schedule.jsx"
    click S1 "https://github.com/bharathdatti/socialtrackb/blob/main/src/components/student/AttendanceHistory.jsx"
    click S2 "https://github.com/bharathdatti/socialtrackb/blob/main/src/components/student/StudentAttendance.jsx"
    click AU1 "https://github.com/bharathdatti/socialtrackb/blob/main/src/components/auth/Login.jsx"
    click AU2 "https://github.com/bharathdatti/socialtrackb/blob/main/src/components/auth/PrivateRoute.jsx"
    click SH1 "https://github.com/bharathdatti/socialtrackb/blob/main/src/components/shared/NotFound.jsx"
    click SH2 "https://github.com/bharathdatti/socialtrackb/blob/main/src/components/shared/UnderConstruction.jsx"
    click L1 "https://github.com/bharathdatti/socialtrackb/blob/main/src/layouts/AdminLayout.jsx"
    click L2 "https://github.com/bharathdatti/socialtrackb/blob/main/src/layouts/StudentLayout.jsx"
    click RS "https://github.com/bharathdatti/socialtrackb/blob/main/src/store/store.js"
    click RS1 "https://github.com/bharathdatti/socialtrackb/blob/main/src/store/slices/attendanceSlice.js"
    click RS2 "https://github.com/bharathdatti/socialtrackb/blob/main/src/store/slices/authSlice.js"
    click RS3 "https://github.com/bharathdatti/socialtrackb/blob/main/src/store/slices/batchSlice.js"
    click RS4 "https://github.com/bharathdatti/socialtrackb/blob/main/src/store/slices/dashboardSlice.js"
    click RS5 "https://github.com/bharathdatti/socialtrackb/blob/main/src/store/slices/scheduleSlice.js"
    click B1 "https://github.com/bharathdatti/socialtrackb/blob/main/src/firebase/config.js"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#42a5f5,stroke-width:2px;
    classDef uiAdmin fill:#e1bee7,stroke:#7b1fa2,stroke-width:2px;
    classDef uiStudent fill:#c5e1a5,stroke:#558b2f,stroke-width:2px;
    classDef uiAuth fill:#ffcc80,stroke:#fb8c00,stroke-width:2px;
    classDef uiShared fill:#ffe082,stroke:#f9a825,stroke-width:2px;
    classDef layout fill:#b2dfdb,stroke:#00796b,stroke-width:2px;
    classDef redux fill:#dcedc8,stroke:#689f38,stroke-width:2px;
    classDef slice fill:#fff9c4,stroke:#fbc02d,stroke-width:2px;
    classDef firebase fill:#ffab91,stroke:#d84315,stroke-width:2px;
```
