# sagedko/fidospark_public architecture

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

- Interactive diagram: https://gitdiagram.com/sagedko/fidospark_public
- Repository: https://github.com/sagedko/fidospark_public

## Overview

##### Project type and purpose
- This is a single-page interactive onboarding web app built entirely in React (v18.2.0) and delivered via Vite.
- Its purpose is to guide and quiz new hires, store progress in localStorage, and provide an admin view for content oversight.

##### File structure
- Top level:
– public/
– src/ (assets/, components/, data/, App.jsx, main.jsx, CSS files)
– config files (tailwind.config.js, postcss.config.js, vite.config.js, eslint.config.js)
- src/components: modular UI views (Login, Welcome, LearningMode, QuizView, AdminDashboard, etc.)
- src/data: static content modules (learningData.js, departmentalLearningData.js, quizData.js, tailoredContentData.js)
- Build & tooling: Vite for dev server/build, Tailwind CSS, PostCSS, Framer Motion, ESLint

##### Extract additional insights from README
- No backend/API yet—data is static and persisted via localStorage
- UI routing is driven by App.jsx state logic
- Future scope: replace localStorage with real API and database, expand admin functionality

##### Main components
a. Browser / Client
– Index.html + Vite dev server or production bundle
– React runtime
b. Build Toolchain
– Vite (serving & bundling)
– Plugins: @vitejs/plugin-react
– PostCSS & Tailwind CSS processor
c. Frontend Modules
– App Shell (App.jsx + main.jsx)
– Component Layer (Login, Welcome, LearningMode, QuizView, UserScoresView, AdminDashboard, AnimatedBackground, CustomCursor, etc.)
– Asset Layer (static images, CSS)
– Data Layer (static JS data files under src/data)
d. Client-Side Persistence
– localStorage (user session, scores, progress)
e. (Future) Backend/API & Database
– Database (e.g., SQL/NoSQL store for users, content, scores)

##### Relationships & interactions
- Browser ←→ Vite Dev Server (HTTP)
- Browser loads index.html → main.jsx → mounts React App
- App.jsx orchestrates view state → renders child components
- Components read static data modules for content & quizzes
- Components read/write user state to localStorage
- AdminDashboard reads from localStorage (or in future from API)
- (Future) Components call API endpoints → persist/retrieve to/from database

##### Architectural patterns & principles
- Single-Page Application (SPA)
- Unidirectional data flow via React Hooks (useState/useEffect)
- Separation of concerns:
– UI (components) vs. content (data modules) vs. styling (Tailwind/PostCSS)
- Build-time vs. run-time separation: static bundling vs. dynamic rendering
- Future extensibility: clear adapter for replacing localStorage with HTTP API calls

##### Technologies & frameworks
- React, Vite, Tailwind CSS, PostCSS, Framer Motion
- JavaScript modules (ESM) for data
- localStorage for persistence
- ESLint for code quality

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & Toolchain Layer
    subgraph "Build & Toolchain"
        direction TB
        VITE["Vite Dev Server & Bundler"]:::build
        PLUGIN["@vitejs/plugin-react"]:::build
        POSTCSS["PostCSS Processor"]:::build
        TAILWIND["Tailwind CSS Processor"]:::build
        ESLINTCFG["ESLint Config"]:::build
        PACKAGE["npm Packages & Scripts"]:::build
    end

    %% Browser / Client Entry
    subgraph "Browser / Client"
        direction TB
        INDEX["index.html"]:::runtime
        MAIN["main.jsx"]:::runtime
        APPSHELL["App.jsx (React App Shell)"]:::runtime
    end

    %% Runtime Components
    subgraph "React Runtime & Components"
        direction TB
        REACT["React v18 Runtime"]:::runtime
        subgraph "Component Layer"
            direction TB
            LOGIN["WelcomeMessageView"]:::runtime
            LEARNING["LearningMode"]:::runtime
            QUIZ["QuizView"]:::runtime
            SCORES["UserScoresView"]:::runtime
            ADMIN["AdminDashboard"]:::runtime
            ANIMBG["AnimatedBackground"]:::runtime
            CURSOR["CustomCursor"]:::runtime
            BUBBLES["FloatingBubbles"]:::runtime
        end
        subgraph "Asset & Styles"
            direction TB
            ASSETS["Assets (images, icons)"]:::runtime
            GLOBALCSS["index.css"]:::runtime
            APPCSS["App.css"]:::runtime
        end
    end

    %% Data Layer
    subgraph "Static Data Modules"
        direction TB
        DEPTDATA["departmentalLearningData.js"]:::data
        GENERIC["learningData.js"]:::data
        QUIZDATA["quizData.js"]:::data
        TAILORED["tailoredContentData.js"]:::data
    end

    %% Persistence
    LOCAL["localStorage"]:::data

    %% Future Services
    subgraph "Future Services" 
        direction TB
        API["Onboarding API"]:::future
        DB["Database"]:::future
    end

    %% Connections - Build to Browser
    VITE -->|serves bundle| INDEX
    PLUGIN --> VITE
    POSTCSS --> VITE
    TAILWIND --> VITE
    PACKAGE --> VITE
    ESLINTCFG -.-> PACKAGE

    %% Browser bootstrap
    INDEX -->|loads| MAIN
    MAIN -->|mounts| APPSHELL
    APPSHELL --> REACT

    %% React runtime to components
    REACT --> LOGIN
    REACT --> LEARNING
    REACT --> QUIZ
    REACT --> SCORES
    REACT --> ADMIN
    REACT --> ANIMBG
    REACT --> CURSOR
    REACT --> BUBBLES
    REACT --> ASSETS
    REACT --> GLOBALCSS
    REACT --> APPCSS

    %% Components access static data
    LOGIN -->|reads| DEPTDATA
    LEARNING -->|reads| GENERIC
    QUIZ -->|reads| QUIZDATA
    LEARNING -->|reads| TAILORED
    LOGIN -->|reads| TAILORED

    %% Components persist state
    LOGIN -->|writes/reads| LOCAL
    LEARNING -->|writes/reads| LOCAL
    QUIZ -->|writes/reads| LOCAL
    SCORES -->|reads| LOCAL
    ADMIN -->|reads| LOCAL

    %% Future API flow
    QUIZ -->|calls| API
    LEARNING -->|calls| API
    ADMIN -->|calls| API
    API -->|queries| DB

    %% Click events for component mapping
    click INDEX "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/index.html"
    click MAIN "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/main.jsx"
    click APPSHELL "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/App.jsx"
    click VITE "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/vite.config.js"
    click POSTCSS "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/postcss.config.js"
    click TAILWIND "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/tailwind.config.js"
    click LOGIN "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/components/WelcomeMessageView.jsx"
    click LEARNING "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/components/LearningMode.jsx"
    click QUIZ "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/components/QuizView.jsx"
    click SCORES "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/components/UserScoresView.jsx"
    click ADMIN "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/components/AdminDashboard.jsx"
    click ANIMBG "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/components/AnimatedBackground.jsx"
    click CURSOR "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/components/CustomCursor.jsx"
    click BUBBLES "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/components/FloatingBubbles.jsx"
    click DEPTDATA "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/data/departmentalLearningData.js"
    click GENERIC "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/data/learningData.js"
    click QUIZDATA "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/data/quizData.js"
    click TAILORED "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/data/tailoredContentData.js"
    click GLOBALCSS "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/index.css"
    click APPCSS "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/src/App.css"
    click PACKAGE "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/package.json"
    click ESLINTCFG "https://github.com/sagedko/fidospark_public/blob/main/fido-spark/eslint.config.js"

    %% Styles
    classDef build fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef runtime fill:#add8e6,stroke:#333,stroke-width:1px
    classDef data fill:#90ee90,stroke:#333,stroke-width:1px
    classDef future fill:#fff,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5
```
