# iamkazbrekker/empowerher architecture

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

- Interactive diagram: https://gitdiagram.com/iamkazbrekker/empowerher
- Repository: https://github.com/iamkazbrekker/empowerher

## Overview

##### Project type and purpose
- This is a full-stack web application called “EmpowerHer.”
- The Node.js server (server.js) serves a static front end under /public and reads a local JSON data store (/data/testimonials.json).
- The client side is a multi-page, gamified learning platform: home, login/signup, profile, training modules (“functions”), all built in vanilla HTML/CSS/JS.

##### File structure
- Top-level
- server.js – the HTTP server entrypoint
- data/testimonials.json – static data used by the UI
- utils/ – helper code to map file extensions to MIME types and to route URLs to file paths
- public/ – the entire client-side codebase, organized by feature:
- public/home – landing page and video demo modules
- public/login – login and signup pages
- public/profile – user profile, edit-profile, shop pages
- public/functions – interactive lesson pages (testimonials, resources, stories, help)
- package.json – metadata and dependencies

##### Key technology insights from README
- Front end: Vanilla JavaScript, CSS, HTML, YouTube IFrame API for videos, LocalStorage for progress
- Back end: Node.js (no external framework), static file serving, potential future integration with Firebase/MongoDB for cloud-persisted progress

##### Main components
a. Client Browser
- Modules: Home, Login/Signup, Profile, Training Lessons
- LocalStorage for storing lesson progress and user badges
- YouTube IFrame API embedded in lesson pages
b. Node.js Server
- HTTP server that:
- Serves static assets (HTML/CSS/JS from /public)
- Reads data/testimonials.json to populate the testimonials module
- Uses utils/getContentType.js and utils/redirectToPath.js to handle MIME types and friendly URLs
c. Data Store
- Local JSON file (testimonials.json)
- (Future) Optional Cloud DB (Firebase or MongoDB) for user accounts & persisted progress
d. External Services
- YouTube as video host via IFrame API

##### Relationships and data flow
- Client → Server: HTTP GET for HTML/CSS/JS assets
- Client → Local JSON: Server reads and injects JSON into client lesson pages
- Client ↔ YouTube IFrame API: load videos, track completion
- Client → LocalStorage: persist progress, badges
- (Optional) Client ↔ Cloud DB: fetch/save user profiles and progress

##### Architectural patterns and principles
- Separation of concerns:
- Static asset layer under /public (UI)
- Data layer under /data (testimonials)
- Server logic (routing + file serving) in server.js + utils/
- Feature-based directory structure on the front end (modules grouped by functionality)
- Progressive enhancement: offline-first with LocalStorage, cloud sync as a future step

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Browser
    subgraph "Client Browser" 
        direction TB
        UI["UI Modules"]:::frontend
        LS["LocalStorage"]:::frontend
    end

    subgraph "UI Modules" 
        direction TB
        Home["Home Module"]:::frontend
        Login["Login/Signup Module"]:::frontend
        Profile["Profile Module"]:::frontend
        Functions["Training Lessons Module"]:::frontend
    end

    %% Node.js Server
    subgraph "Node.js Server" 
        direction TB
        ServerJS["server.js"]:::server
        Utils1["getContentType.js"]:::server
        Utils2["redirectToPath.js"]:::server
    end

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        Testimonials["testimonials.json"]:::datastore
        CloudDB["Cloud DB (future)"]:::datastore
    end

    %% External Services
    subgraph "External Services"
        direction TB
        YouTube["YouTube IFrame API"]:::external
    end

    %% Connections
    UI -->|"HTTP GET /assets"| ServerJS
    ServerJS -->|"uses"| Utils1
    ServerJS -->|"uses"| Utils2
    ServerJS -->|"reads"| Testimonials
    Home -->|"fetch testimonials"| ServerJS
    Functions -->|"fetch testimonials"| ServerJS
    UI -->|"read/write"| LS
    UI -->|"load videos / track events"| YouTube
    UI -.->|"(future) sync"| CloudDB

    %% Click Events - Server
    click ServerJS "https://github.com/iamkazbrekker/empowerher/blob/main/server.js"
    click Utils1 "https://github.com/iamkazbrekker/empowerher/blob/main/utils/getContentType.js"
    click Utils2 "https://github.com/iamkazbrekker/empowerher/blob/main/utils/redirectToPath.js"

    %% Click Events - Data
    click Testimonials "https://github.com/iamkazbrekker/empowerher/blob/main/data/testimonials.json"

    %% Click Events - Client UI Modules
    click Home "https://github.com/iamkazbrekker/empowerher/blob/main/public/home/home.html"
    click Login "https://github.com/iamkazbrekker/empowerher/blob/main/public/login/index.html"
    click Profile "https://github.com/iamkazbrekker/empowerher/blob/main/public/profile/profile.html"
    click Functions "https://github.com/iamkazbrekker/empowerher/blob/main/public/functions/testimonials.html"

    %% Styles
    classDef frontend fill:#B3DDF2,stroke:#333,stroke-width:1px
    classDef server fill:#C2F0C2,stroke:#333,stroke-width:1px
    classDef datastore fill:#FAD8A5,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
