# tekdi/all-saas-learner-ai-app architecture

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

- Interactive diagram: https://gitdiagram.com/tekdi/all-saas-learner-ai-app
- Repository: https://github.com/tekdi/all-saas-learner-ai-app

## Overview

##### Project Type and Purpose
- This is a front-end single-page application (SPA) boilerplate built with React, Redux Toolkit, and Redux-Saga.
- It provides a structured starting point for developers, featuring routing (React Router v6), state management (Redux + Saga), styling (Material-UI + SCSS), and telemetry/audio functionality for interactive learning modules (Assessment, Discover, Practice).

##### Key Architectural Layers / Components
a. Presentation Layer (UI)
- public/index.html → React root container
- src/index.js + src/App.js → Application bootstrap & top-level routing (React Router v6)
- src/views/** & src/components/** → View containers and reusable components
- src/assets/ → static assets (audio, images, styles)
b. State Management Layer
- src/store/configureStore.js → Redux store setup
- src/store/slices/*.slice.js → Feature slices (user, snackbar)
- src/store/sagas/ → Saga middleware for side effects
c. Services Layer
- src/services/*.js → API wrappers (telemetryService, utilService, AWS S3 config)
- src/utils/** → Helper modules (AudioCompare, VoiceAnalyser)
d. External Dependencies
- AWS S3 (via src/config/awsS3.js) for asset storage/deployment
- Telemetry backend endpoint (called by telemetryService)
- Browser APIs (Web Audio, MediaRecorder)

##### Sequence / Workflow (User Interaction to Data Flow)
1. **Page Load**
- Browser fetches public/index.html → ReactDOM renders `<App />`.
- App.js sets up `<BrowserRouter>` and global providers (Redux Provider, ThemeProvider).
2. **Route Selection**
- User clicks a link → React Router loads corresponding View (e.g., DiscoverStartPage).
- View composes UI components, passing props, connecting to Redux via `useSelector` / `useDispatch`.
3. **User Action → Dispatch**
- Interaction (e.g., “Start Assessment”) triggers a Redux action (e.g., `startAssessment()`).
4. **Saga Intercepts**
- rootSaga watches for dispatched actions → triggers handler in `src/store/sagas/handlers/*.handler.js`.
5. **Service Call**
- Handler calls a service (e.g., `telemetryService.logEvent()`, `utilService.fetchData()` or AudioCompare).
- Service may read/write audio from `src/assets/audio` or upload data to AWS S3.
6. **Response Handling**
- On success/failure, the saga dispatches success/failure actions to update the store slice.
7. **UI Update**
- Redux store change → subscribed components re-render with new props/state.
8. **Telemetry / Analytics**
- Each major user event is sent via `callTelemetryIntract.js` to an external telemetry endpoint.
9. **Asset Loading**
- Static assets served from `public/` or `AWS S3` based on runtime config in `awsS3.js`.

- Clear, descriptive **component labels** (e.g., “AssessmentPage (View)”, “user.slice.js”).
- **Sequence numbers** on the main flow paths to reflect the workflow described above.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        HTML["public/index.html"]:::ui
        IndexJS["src/index.js"]:::ui
        AppJS["src/App.js"]:::ui
        subgraph "Views (src/views/**)" 
            direction TB
            AppContent["AppContent.jsx"]:::ui
            AssessmentPage["AssesmentPage.jsx"]:::ui
            AssessmentEndPage["AssesmentEndPage.jsx"]:::ui
            Discover["Discover.jsx"]:::ui
            DiscoverStartPage["DiscoverStartPage.jsx"]:::ui
            DiscoverEnd["DiscoverEnd.jsx"]:::ui
            Practice["Practice.jsx"]:::ui
            HomePage["HomePage.jsx"]:::ui
            NoPageFound["NoPageFound.jsx"]:::ui
            CustomSnackbar["CustomSnackbar.jsx"]:::ui
        end
        subgraph "Components (src/components/**)"
            direction TB
            Layouts["Layouts.jsx"]:::ui
            MainLayout["MainLayout.jsx"]:::ui
            AssessmentComp["Assesment.jsx"]:::ui
            AssessmentEndComp["AssesmentEnd.jsx"]:::ui
            DiscoverSentance["DiscoverSentance.jsx"]:::ui
            DiscoverEndComp["DiscoverEnd.jsx"]:::ui
            WordsOrImage["WordsOrImage.jsx"]:::ui
            Mechanics1["Mechanics1.jsx"]:::ui
            Mechanics2["Mechanics2.jsx"]:::ui
            Mechanics3["Mechanics3.jsx"]:::ui
            Mechanics4["Mechanics4.jsx"]:::ui
            Mechanics5["Mechanics5.jsx"]:::ui
            ComponentsIndex["index.js"]:::ui
        end
        subgraph "Assets (src/assets/**)"
            direction TB
            AudioFiles["Audio Files"]:::ui
            Images["Images"]:::ui
            Styles["Styles (SCSS)"]:::ui
        end
    end

    %% State Management Layer
    subgraph "State Management" 
        direction TB
        StoreConfig["configureStore.js"]:::state
        subgraph "Slices (src/store/slices/**)"
            direction TB
            UserSlice["user.slice.js"]:::state
            SnackbarSlice["snackbar.slice.js"]:::state
        end
        subgraph "Sagas (src/store/sagas/**)"
            direction TB
            RootSaga["rootSaga.js"]:::state
            UserHandler["user.handler.js"]:::state
            UserRequest["user.request.js"]:::state
        end
    end

    %% Services Layer
    subgraph "Services Layer"
        direction TB
        TelemetryService["telemetryService.js"]:::service
        CallTelemetry["callTelemetryIntract.js"]:::service
        UtilService["utilService.js"]:::service
        AWSConfig["awsS3.js"]:::service
    end

    %% Utilities
    subgraph "Utilities (src/utils/**)"
        direction TB
        AudioCompare["AudioCompare.js"]:::service
        VoiceAnalyser["VoiceAnalyser.js"]:::service
    end

    %% External Dependencies
    subgraph "External"
        direction TB
        S3[(AWS S3)]:::external
        TelemetryAPI(CloudTelemetryAPI):::external
        BrowserAPIs( Web Audio & MediaRecorder ):::external
    end

    %% Workflow Sequence
    HTML -->|"1. load HTML"| IndexJS
    IndexJS -->|"2. render <App />"| AppJS
    AppJS -->|"3. route selection"| AppContent
    AppContent -->|"3.1 navigate to view"| AssessmentPage
    AssessmentPage -->|"4. dispatch startAssessment"| RootSaga
    RootSaga -->|"5. invoke handler"| UserHandler
    UserHandler -->|"6. call telemetryService.logEvent()"| TelemetryService
    UserHandler -->|"6. call utilService.fetchData()"| UtilService
    TelemetryService -->|"7. send event"| TelemetryAPI
    UtilService -->|"7. upload audio"| S3
    TelemetryAPI -->|"8. response"| UserHandler
    S3 -->|"8. response"| UserHandler
    UserHandler -->|"9. dispatch success/failure"| UserSlice
    UserSlice -->|"10. state update"| AssessmentPage
    AssessmentPage -->|"11. render UI update"| AppContent

    %% Click Events
    click HTML "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/public/index.html"
    click IndexJS "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/index.js"
    click AppJS "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/App.js"
    click AppContent "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/views/AppContent/AppContent.jsx"
    click AssessmentPage "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/views/Assesment/AssesmentPage.jsx"
    click AssessmentEndPage "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/views/AssesmentEnd/AssesmentEndPage.jsx"
    click Discover "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/views/Discover/Discover.jsx"
    click DiscoverStartPage "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/views/DiscoverStart/DiscoverStartPage.jsx"
    click DiscoverEnd "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/views/DiscoverEnd/DiscoverEnd.jsx"
    click Practice "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/views/Practice/Practice.jsx"
    click HomePage "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/views/HomePage/HomePage.jsx"
    click NoPageFound "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/views/NoPageFound/NoPageFound.jsx"
    click CustomSnackbar "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/views/Snackbar/CustomSnackbar.jsx"
    click Layouts "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/Layouts.jsx"
    click MainLayout "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/Layouts.jsx/MainLayout.jsx"
    click AssessmentComp "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/Assesment/Assesment.jsx"
    click AssessmentEndComp "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/AssesmentEnd/AssesmentEnd.jsx"
    click DiscoverSentance "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/DiscoverSentance/DiscoverSentance.jsx"
    click DiscoverEndComp "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/DiscoverEnd/DiscoverEnd.jsx"
    click WordsOrImage "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/Mechanism/WordsOrImage.jsx"
    click Mechanics1 "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/Practice/Mechanics1.jsx"
    click Mechanics2 "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/Practice/Mechanics2.jsx"
    click Mechanics3 "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/Practice/Mechanics3.jsx"
    click Mechanics4 "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/Practice/Mechanics4.jsx"
    click Mechanics5 "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/Practice/Mechanics5.jsx"
    click ComponentsIndex "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/components/index.js"
    click StoreConfig "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/store/configureStore.js"
    click UserSlice "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/store/slices/user.slice.js"
    click SnackbarSlice "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/store/slices/snackbar.slice.js"
    click RootSaga "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/store/sagas/rootSaga.js"
    click UserHandler "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/store/sagas/handlers/user.handler.js"
    click UserRequest "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/store/sagas/requests/user.request.js"
    click TelemetryService "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/services/telemetryService.js"
    click CallTelemetry "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/services/callTelemetryIntract.js"
    click UtilService "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/services/utilService.js"
    click AWSConfig "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/config/awsS3.js"
    click AudioCompare "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/utils/AudioCompare.js"
    click VoiceAnalyser "https://github.com/tekdi/all-saas-learner-ai-app/blob/main/src/utils/VoiceAnalyser.js"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef state fill:#90EE90,stroke:#333,stroke-width:1px
    classDef service fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
