# shivambonde/parental_engagement architecture

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

- Interactive diagram: https://gitdiagram.com/shivambonde/parental_engagement
- Repository: https://github.com/shivambonde/parental_engagement

## Overview

##### Project Type and Purpose
- This is a single-page application (SPA) front-end built with React and Vite.
- It provides parent/teacher dashboards, attendance tracking, scheduling, offline support, and an AI Bot.
- It communicates with a back-end REST API (via src/utils/api.jsx), supports multiple languages, and offers offline sync.

##### File Structure
- Presentation Layer:
- src/pages (Home, Login, Signup, Dashboard, AiBot)
- src/components (organized into subfolders: Dashboard, Attendance, Teacher, LanguageSettings, OfflineSupport)
- State & Business Logic:
- src/context (AuthContext, LanguageContext)
- src/hooks (useAuth, useOfflineMode)
- Data & Integration Layer:
- src/utils/api.jsx (HTTP client/REST calls)
- src/utils/helpers.jsx (shared helper functions)
- Assets & Public Files:
- public/assets (videos, static media)
- index.html, public/index.html
- Build & Config:
- vite.config.js (Vite config)
- postcss.config.js, tailwind.config.js (styling pipeline)
- .eslintrc.cjs (lint rules)

##### README Insights
- Confirms React + Vite stack with fast refresh via Babel or SWC plugin.
- No explicit back-end in this repo—assume it calls external API endpoints.

##### Main Components & Their Interactions
a. Presentation Layer (UI):
- Top: src/pages render route containers.
- Nested: src/components provide reusable widgets (Dashboard panels, forms, lists).
b. State Management:
- AuthContext & LanguageContext provide global state.
- Hooks (useAuth, useOfflineMode) abstract auth logic and offline detection.
c. Data Layer:
- api.jsx exposes functions to call backend REST endpoints (e.g., getAttendance, postNotice).
- OfflineSync component caches requests and syncs when online.
d. External Services:
- REST API server (authentication, data CRUD).
- CDN or storage for public assets.
- (Optional) Third-party translation or AI services for AiBot page.
e. Build Tooling & Dev Server:
- Vite dev server handles HMR, ESLint plugin enforces code style, TailwindCSS for styling.

##### Architectural Patterns & Design Principles
- Component-Based Architecture: Clear separation between pages (routes) and reusable components.
- Context API for cross-cutting state (auth, locale).
- Custom Hooks to encapsulate side-effects and reusability.
- Single Responsibility for each folder/module.
- Offline-first considerations with service-worker style sync.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        direction TB
        subgraph "Pages"
            direction TB
            Home["Home Page"]:::ui
            Login["Login Page"]:::ui
            Signup["Signup Page"]:::ui
            DashboardPage["Dashboard Container"]:::ui
            AiBot["AI Bot Page"]:::ui
        end
        subgraph "Reusable Components"
            direction TB
            subgraph "Attendance"
                AttendanceComp["AttendanceTracker"]:::ui
            end
            subgraph "Dashboard Widgets"
                ParentDashboard["ParentDashboard"]:::ui
                AcademicPerformance["AcademicPerformance"]:::ui
                ImportantNotices["ImportantNotices"]:::ui
                MeetingScheduler["MeetingScheduler"]:::ui
                NotificationList["NotificationList"]:::ui
                RemindersAndAlerts["RemindersAndAlerts"]:::ui
                DashboardSidebar["Sidebar"]:::ui
                StudentProfile["StudentProfile"]:::ui
                TeacherRating["TeacherRating"]:::ui
                UpcomingEvents["UpcomingEvents"]:::ui
            end
            subgraph "Teacher UI"
                TeacherDashboard["TeacherDashboard"]:::ui
                ClassOverview["ClassOverview"]:::ui
                TeacherAttendance["AttendanceTracker"]:::ui
                ImportanatNotice["ImportanatNotice"]:::ui
                MeetingSchedulers["MeetingSchedulers"]:::ui
                ManageAssignments["ManageAssignments"]:::ui
                TeacherReminders["RemindersAndAlert"]:::ui
                TeacherSidebar["Sidebar"]:::ui
                StudentsComp["Students"]:::ui
                TeacherSchedule["TeacherSchedule"]:::ui
            end
            subgraph "Language Settings"
                LanguageSwitcher["LanguageSwitcher"]:::ui
            end
            subgraph "Offline Support"
                OfflineSyncComp["OfflineSync"]:::ui
            end
        end
    end

    %% State & Business Logic Layer
    subgraph "State Layer"
        direction TB
        AuthContext["AuthContext"]:::state
        LanguageContext["LanguageContext"]:::state
        useAuth["useAuth Hook"]:::state
        useOfflineMode["useOfflineMode Hook"]:::state
    end

    %% Data & Integration Layer
    subgraph "Data Layer"
        direction TB
        APIClient["api.jsx"]:::data
        Helpers["helpers.jsx"]:::data
        LocalCache["Local Cache"]:::cache
    end

    %% External Services
    subgraph "External Services"
        direction TB
        RESTAPI["REST API Server"]:::external
        CDN["CDN/Storage"]:::external
        AIService["Translation/AI Service"]:::external
    end

    %% Dev & Build Tools
    subgraph "Dev & Build Tools"
        direction TB
        PackageJSON["package.json"]:::dev
        ViteConfig["vite.config.js"]:::dev
        PostCSS["postcss.config.js"]:::dev
        TailwindConfig["tailwind.config.js"]:::dev
        ESLint[".eslintrc.cjs"]:::dev
        IndexHTML["index.html"]:::dev
    end

    %% Connections
    Home -->|uses| AttendanceComp
    Home -->|uses| LanguageSwitcher
    Login -->|wraps in| AuthContext
    Signup -->|wraps in| AuthContext
    DashboardPage -->|renders| ParentDashboard
    DashboardPage -->|renders| DashboardSidebar
    DashboardPage -->|renders| NotificationList
    AiBot -->|calls| AIService

    %% UI to State
    Home -->|reads/writes| AuthContext
    Login -->|reads/writes| AuthContext
    Signup -->|reads/writes| AuthContext
    DashboardPage -->|reads/writes| LanguageContext
    DashboardPage -->|uses| useAuth
    OfflineSyncComp -->|uses| useOfflineMode

    %% State to Data
    AuthContext -->|calls| APIClient
    useAuth -->|calls| APIClient
    useOfflineMode -->|intercepts| APIClient

    %% Offline Sync Flow
    OfflineSyncComp -->|queues| LocalCache
    LocalCache -->|syncs with| APIClient
    APIClient -->|GET/POST| RESTAPI

    %% Data to External
    APIClient -->|"GET/POST"| RESTAPI
    APIClient -->|fetch assets| CDN

    %% Click Events
    click Home "https://github.com/shivambonde/parental_engagement/blob/main/src/pages/Home.jsx"
    click Login "https://github.com/shivambonde/parental_engagement/blob/main/src/pages/Login.jsx"
    click Signup "https://github.com/shivambonde/parental_engagement/blob/main/src/pages/Signup.jsx"
    click DashboardPage "https://github.com/shivambonde/parental_engagement/blob/main/src/pages/Dashboard.jsx"
    click AiBot "https://github.com/shivambonde/parental_engagement/blob/main/src/pages/AiBot.jsx"
    click AttendanceComp "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Attendance/AttendanceTracker.jsx"
    click ParentDashboard "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Dashboard/ParentDashboard.jsx"
    click AcademicPerformance "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Dashboard/AcademicPerformance.jsx"
    click ImportantNotices "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Dashboard/ImportantNotices.jsx"
    click MeetingScheduler "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Dashboard/MeetingScheduler.jsx"
    click NotificationList "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Dashboard/NotificationList.jsx"
    click RemindersAndAlerts "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Dashboard/RemindersAndAlerts.jsx"
    click DashboardSidebar "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Dashboard/Sidebar.jsx"
    click StudentProfile "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Dashboard/StudentProfile.jsx"
    click TeacherRating "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Dashboard/TeacherRating.jsx"
    click UpcomingEvents "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Dashboard/UpcomingEvents.jsx"
    click TeacherDashboard "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Teacher/TeacherDashboard.jsx"
    click ClassOverview "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Teacher/ClassOverview.jsx"
    click TeacherAttendance "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Teacher/AttendanceTracker.jsx"
    click ImportanatNotice "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Teacher/ImportanatNotice.jsx"
    click MeetingSchedulers "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Teacher/MeetingSchedulers.jsx"
    click ManageAssignments "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Teacher/ManageAssignments.jsx"
    click TeacherReminders "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Teacher/RemindersAndAlert.jsx"
    click TeacherSidebar "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Teacher/Sidebar.jsx"
    click StudentsComp "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Teacher/Students.jsx"
    click TeacherSchedule "https://github.com/shivambonde/parental_engagement/blob/main/src/components/Teacher/TeacherSchedule.jsx"
    click LanguageSwitcher "https://github.com/shivambonde/parental_engagement/blob/main/src/components/LanguageSettings/LanguageSwitcher.jsx"
    click OfflineSyncComp "https://github.com/shivambonde/parental_engagement/blob/main/src/components/OfflineSupport/OfflineSync.jsx"
    click AuthContext "https://github.com/shivambonde/parental_engagement/blob/main/src/context/AuthContext.jsx"
    click LanguageContext "https://github.com/shivambonde/parental_engagement/blob/main/src/context/LanguageContext.jsx"
    click useAuth "https://github.com/shivambonde/parental_engagement/blob/main/src/hooks/useAuth.jsx"
    click useOfflineMode "https://github.com/shivambonde/parental_engagement/blob/main/src/hooks/useOfflineMode.jsx"
    click APIClient "https://github.com/shivambonde/parental_engagement/blob/main/src/utils/api.jsx"
    click Helpers "https://github.com/shivambonde/parental_engagement/blob/main/src/utils/helpers.jsx"
    click PackageJSON "https://github.com/shivambonde/parental_engagement/blob/main/package.json"
    click ViteConfig "https://github.com/shivambonde/parental_engagement/blob/main/vite.config.js"
    click PostCSS "https://github.com/shivambonde/parental_engagement/blob/main/postcss.config.js"
    click TailwindConfig "https://github.com/shivambonde/parental_engagement/blob/main/tailwind.config.js"
    click ESLint "https://github.com/shivambonde/parental_engagement/blob/main/.eslintrc.cjs"
    click IndexHTML "https://github.com/shivambonde/parental_engagement/blob/main/index.html"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366D6;
    classDef state fill:#DFF5E1,stroke:#2F8F28;
    classDef data fill:#FFE5B4,stroke:#E38B06;
    classDef cache fill:#FFF7C0,stroke:#D4A900;
    classDef external fill:#E8E8E8,stroke:#888888,stroke-dasharray: 5 5;
    classDef dev fill:#F3E8FF,stroke:#8A2BE2;
```
