# fluffyspy/stroke-guardian-angel-app architecture

> Architecture diagram of the GitHub repository fluffyspy/stroke-guardian-angel-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fluffyspy/stroke-guardian-angel-app
- Repository: https://github.com/fluffyspy/stroke-guardian-angel-app

## Overview

##### Project type and purpose
- This is a single‐page front-end application built with Vite, React, and TypeScript.
- Its domain is medical assessment: it supports patient registration, emergency workflows, patient dashboards, various detection tests (balance, eye-tracking, speech), comprehensive analysis, and educational content about strokes.

##### File structure
- Top-level files: configuration for Vite (`vite.config.ts`), TypeScript (`tsconfig.json`), Tailwind (`tailwind.config.ts`), linting, package manifests.
- `public/`: static assets (e.g., `index.html`, `robots.txt`).
- `src/` root: entry point (`main.tsx`, `index.css`), global utilities (`src/lib/utils.ts`), authentication service (`src/services/authService.ts`), type definitions.
- `src/pages/`: route-level components (`Index`, `Login`, `NotFound`).
- `src/components/`: subdivided into feature folders (e.g., `dashboard`, `detection`, `analysis`, `education`, `ui`).
- `ui/`: shared atomic UI components (buttons, cards, forms, modals, etc.) built on shadcn-ui + Tailwind.
- `detection/`: further broken down into test types (balance, eyeTracking, speech) with both screens and hooks or utilities for hardware integration.
- `dashboard/` & `analysis/`: composite views aggregating data from services and sensor modules.
- `src/hooks/`: custom React hooks (e.g., `use-mobile`, `use-toast`).

##### Extracted architecture insights from README
- Tech stack: Vite, React, TypeScript, shadcn-ui, Tailwind CSS.
- No backend resides in this repo; it likely communicates with external APIs (e.g., authentication, patient data) or hardware interfaces.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser"]:::ext-orange
    Browser --> ReactApp["React Application"]:::infra-gray

    subgraph "React Application"
        Entry["Entry Point<br/>(main.tsx)"]:::infra-gray
        Entry --> Routing

        subgraph "Routing"
            Index["Index Page"]:::blue
            Login["Login Page"]:::blue
            NotFound["NotFound Page"]:::blue
        end
        Routing --> Index
        Routing --> Login
        Routing --> NotFound

        subgraph "Features"
            PatientReg["PatientRegistration"]:::blue
            PatientProfile["PatientProfile"]:::blue
            Emergency["Emergency Workflow"]:::blue
            Comprehensive["ComprehensiveAnalysis"]:::blue
        end

        subgraph "Detection Modules"
            BalanceTest["BalanceTest"]:::blue
            EyeTracking["EyeTrackingTest"]:::blue
            SpeechTest["SpeechTest"]:::blue

            subgraph "Balance Details"
                Instr["InstructionsScreen"]:::blue
                Live["LiveTestScreen"]:::blue
                Result["ResultScreen"]:::blue
                Diag["SensorDiagnostics"]:::blue
                UtilsBalance["balanceUtils"]:::logic-green
                HookBalance["useSensorData"]:::logic-green
            end
            BalanceTest --> Instr
            BalanceTest --> Live
            BalanceTest --> Result
            BalanceTest --> Diag
            BalanceTest --> UtilsBalance
            BalanceTest --> HookBalance

            subgraph "Eye-Tracking Details"
                CameraView["CameraView"]:::blue
                DirectionGrid["DirectionGrid"]:::blue
                WelcomeET["WelcomeScreen"]:::blue
                Model["eyeTrackingModel"]:::logic-green
                HookEye["useEyeTracking"]:::logic-green
            end
            EyeTracking --> CameraView
            EyeTracking --> DirectionGrid
            EyeTracking --> WelcomeET
            EyeTracking --> Model
            EyeTracking --> HookEye
        end

        subgraph "Education Module"
            StrokeEd["StrokeEducation"]:::blue
        end

        subgraph "Dashboard"
            DashboardMain["Main Dashboard View"]:::blue
            Header["DashboardHeader"]:::blue
            DetPreview["DetectionModules"]:::blue
            QuickInfo["QuickInformation"]:::blue
            RecentAct["RecentActivity"]:::blue
            WelcomeCard["WelcomeCard"]:::blue
        end
        DashboardMain --> Header
        DashboardMain --> DetPreview
        DashboardMain --> QuickInfo
        DashboardMain --> RecentAct
        DashboardMain --> WelcomeCard

        subgraph "UI Primitives"
            UIP["components/ui/*"]:::blue
        end

        subgraph "Services & Hooks"
            AuthService["authService"]:::logic-green
            UseMobile["use-mobile"]:::logic-green
            UseToast["use-toast"]:::logic-green
            Utils["utils"]:::logic-green
        end

        Index --> PatientReg
        Index --> PatientProfile
        Index --> Emergency
        Index --> Comprehensive

        Login --> AuthService
        PatientReg --> AuthService
        PatientProfile --> AuthService
        Emergency --> AuthService
        Comprehensive --> AuthService

        PatientReg --> UIP
        PatientProfile --> UIP
        Emergency --> UIP
        Comprehensive --> UIP
        StrokeEd --> UIP
        DashboardMain --> UIP

        BalanceTest --> SensorDevice
        HookBalance --> SensorDevice
        HookEye --> CameraDevice
        SpeechTest --> MicDevice

        AuthService --> AuthAPI
        Utils --> PatientAPI

        Entry --> Vite
        Vite --> Hosting
    end

    subgraph "External Systems"
        AuthAPI["Auth API"]:::ext-orange
        PatientAPI["Patient Data API"]:::ext-orange
        SensorDevice["Balance Sensor"]:::ext-orange
        CameraDevice["Camera"]:::ext-orange
        MicDevice["Microphone"]:::ext-orange
    end

    subgraph "Build & Deployment"
        NodeNPM["Node.js/NPM"]:::infra-gray
        Vite["Vite (Dev/Build)"]:::infra-gray
        Hosting["Lovable Platform"]:::infra-gray
    end

    classDef blue fill:#cfe2ff,stroke:#0d47a1,color:#0d47a1
    classDef logic-green fill:#dcedc8,stroke:#33691e,color:#33691e
    classDef ext-orange fill:#ffe0b2,stroke:#e65100,color:#e65100
    classDef infra-gray fill:#eceff1,stroke:#37474f,color:#37474f

    click Entry "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/main.tsx"
    click Index "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/pages/Index.tsx"
    click Login "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/pages/Login.tsx"
    click NotFound "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/pages/NotFound.tsx"
    click PatientReg "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/PatientRegistration.tsx"
    click PatientProfile "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/PatientProfile.tsx"
    click Emergency "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/Emergency.tsx"
    click Comprehensive "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/analysis/ComprehensiveAnalysis.tsx"
    click BalanceTest "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/BalanceTest.tsx"
    click Instr "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/balance/InstructionsScreen.tsx"
    click Live "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/balance/LiveTestScreen.tsx"
    click Result "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/balance/ResultScreen.tsx"
    click Diag "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/balance/SensorDiagnostics.tsx"
    click UtilsBalance "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/balance/balanceUtils.ts"
    click HookBalance "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/balance/useSensorData.ts"
    click EyeTracking "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/EyeTrackingTest.tsx"
    click CameraView "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/eyeTracking/CameraView.tsx"
    click DirectionGrid "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/eyeTracking/DirectionGrid.tsx"
    click WelcomeET "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/eyeTracking/WelcomeScreen.tsx"
    click Model "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/eyeTracking/eyeTrackingModel.ts"
    click HookEye "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/eyeTracking/useEyeTracking.ts"
    click SpeechTest "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/detection/SpeechTest.tsx"
    click StrokeEd "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/education/StrokeEducation.tsx"
    click DashboardMain "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/Dashboard.tsx"
    click Header "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/dashboard/DashboardHeader.tsx"
    click DetPreview "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/dashboard/DetectionModules.tsx"
    click QuickInfo "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/dashboard/QuickInformation.tsx"
    click RecentAct "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/dashboard/RecentActivity.tsx"
    click WelcomeCard "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/components/dashboard/WelcomeCard.tsx"
    click UseMobile "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/hooks/use-mobile.tsx"
    click UseToast "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/hooks/use-toast.ts"
    click Utils "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/lib/utils.ts"
    click AuthService "https://github.com/fluffyspy/stroke-guardian-angel-app/blob/main/src/services/authService.ts"
```
