# devrajdc/mlh-peaceout-hacks architecture

> Architecture diagram of the GitHub repository devrajdc/mlh-peaceout-hacks, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devrajdc/mlh-peaceout-hacks
- Repository: https://github.com/devrajdc/mlh-peaceout-hacks

## Overview

##### Project Type and Purpose
- This is a purely front-end, static web application (“Peace in Space”) that uses client-side machine learning (Face API via face-api.js) to detect a user’s facial emotion in real time, and then redirects the user to a mood-specific static page with tailored content (audio, PDFs, JSON data).
- There is no backend service or database; all assets (HTML, CSS, JS, models, media) are served as static files (e.g., via Vercel or any static host).

##### File-Structure Analysis
- Top-level files: index.html (entry point), api.js (initialization/orchestration of face detection), package.json.
- `/css`, `/js`: UI styling and client-side libraries (jQuery, Lodash).
- `/models`: pre-trained weight manifests and shards for face-api.js models.
- `/pages`: mood pages (angry.html, happy.html, neutral.html, sad.html) and a team page.
- `/src`: supplementary static assets (audio clips, PDFs, JSON with motivational data).

##### README Insights
- Tech stack: HTML, CSS, JavaScript, face-api.js (Deep Learning in the browser), Figma (design).
- Flow described: face recognition → expression detection → redirect to mood page.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Entities
    User("User"):::external
    StaticHost("Static File Server / CDN"):::host
    AssetStorage("Static Asset Storage\n(assets/, src/)"):::storage

    %% Browser Container
    subgraph "Browser / Client"
        direction TB
        UI["UI Layer\n(index.html + CSS)"]:::ui
        Orch["Orchestration Layer\n(api.js + jQuery + Lodash)"]:::orchestration
        ML["ML Engine\n(face-api.js + models)"]:::ml
        Routing["Routing Module\n(redirect logic)"]:::orchestration
        AssetLoader["Asset Loader\n(audio, JSON, PDFs)"]:::asset
    end

    %% Mood Pages
    subgraph "Mood Pages (Static HTML)" 
        direction TB
        Angry["angry.html"]:::pages
        Happy["happy.html"]:::pages
        Neutral["neutral.html"]:::pages
        Sad["sad.html"]:::pages
        Team["team.html"]:::pages
    end

    %% User Interaction
    User -->|"open index.html"| UI

    %% Static asset delivery to Browser
    StaticHost -->|"GET index.html, CSS"| UI
    StaticHost -->|"GET api.js, jQuery, Lodash"| Orch
    StaticHost -->|"GET face-api.js models"| ML
    StaticHost -->|"GET audio, JSON, PDFs"| AssetLoader

    %% In-browser flows
    UI -->|"initialize"| Orch
    Orch -->|"load models & video feed"| ML
    ML -->|"Inference result"| Routing
    Routing -->|"redirect"| Angry
    Routing -->|"redirect"| Happy
    Routing -->|"redirect"| Neutral
    Routing -->|"redirect"| Sad
    Routing -->|"redirect"| Team

    %% Mood page asset loading
    Angry -->|"GET media"| AssetLoader
    Happy -->|"GET media"| AssetLoader
    Neutral -->|"GET media"| AssetLoader
    Sad -->|"GET media"| AssetLoader
    Team -->|"GET media"| AssetLoader

    AssetLoader -->|"fetch assets"| AssetStorage

    %% Click Events UI Layer
    click UI "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/index.html"
    click UI "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/css/style.css"
    click UI "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/css/expressionpage.css"
    click UI "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/css/team.css"

    %% Click Events Orchestration Layer
    click Orch "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/api.js"
    click Orch "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/js/jquery-1.js"
    click Orch "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/lodash.js"

    %% Click Events ML Engine Models
    click ML "https://github.com/devrajdc/mlh-peaceout-hacks/tree/main/models/face_expression_model-shard1"
    click ML "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/models/face_expression_model-weights_manifest.json"
    click ML "https://github.com/devrajdc/mlh-peaceout-hacks/tree/main/models/face_landmark_68_model-shard1"
    click ML "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/models/face_landmark_68_model-weights_manifest.json"
    click ML "https://github.com/devrajdc/mlh-peaceout-hacks/tree/main/models/face_landmark_68_tiny_model-shard1"
    click ML "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/models/face_landmark_68_tiny_model-weights_manifest.json"
    click ML "https://github.com/devrajdc/mlh-peaceout-hacks/tree/main/models/face_recognition_model-shard1"
    click ML "https://github.com/devrajdc/mlh-peaceout-hacks/tree/main/models/face_recognition_model-shard2"
    click ML "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/models/face_recognition_model-weights_manifest.json"
    click ML "https://github.com/devrajdc/mlh-peaceout-hacks/tree/main/models/tiny_face_detector_model-shard1"
    click ML "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/models/tiny_face_detector_model-weights_manifest.json"

    %% Click Event Routing Module
    click Routing "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/api.js"

    %% Click Events Mood Pages
    click Angry "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/pages/angry.html"
    click Happy "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/pages/happy.html"
    click Neutral "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/pages/neutral.html"
    click Sad "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/pages/sad.html"
    click Team "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/pages/team.html"

    %% Click Events Asset Loader
    click AssetLoader "https://github.com/devrajdc/mlh-peaceout-hacks/tree/main/src/audio/"
    click AssetLoader "https://github.com/devrajdc/mlh-peaceout-hacks/blob/main/src/json/data.json"
    click AssetLoader "https://github.com/devrajdc/mlh-peaceout-hacks/tree/main/src/pdfs/"

    %% Click Events Asset Storage
    click AssetStorage "https://github.com/devrajdc/mlh-peaceout-hacks/tree/main/assets/svgs/"
    click AssetStorage "https://github.com/devrajdc/mlh-peaceout-hacks/tree/main/assets/svgs/socials/"
    click AssetStorage "https://github.com/devrajdc/mlh-peaceout-hacks/tree/main/assets/svgs/team/"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#6699cc;
    classDef orchestration fill:#e0ccff,stroke:#9966cc;
    classDef ml fill:#ccffcc,stroke:#66cc66;
    classDef asset fill:#ffffcc,stroke:#cccc66;
    classDef storage fill:#fff0b3,stroke:#e6b800;
    classDef pages fill:#ffd9b3,stroke:#e68a00;
    classDef host fill:#f2f2f2,stroke:#999;
    classDef external fill:#f9e6e6,stroke:#cc6666;
```
