# luisandovalu/challenge-amigo-secreto architecture

> Architecture diagram of the GitHub repository luisandovalu/challenge-amigo-secreto, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luisandovalu/challenge-amigo-secreto
- Repository: https://github.com/luisandovalu/challenge-amigo-secreto

## Overview

##### Project Type and Purpose
- This is a single‐page, client‐side web application (“Amigo Secreto” raffle) built with vanilla HTML, CSS and JavaScript.
- There is no backend service or database—everything runs in the browser.

##### File Structure Analysis
- index.html – entry point, loads style.css and app.js.
- style.css – contains all presentation styles.
- assets/ – static media (demo.gif) used for README or in‐page demonstrations.
- README.md – describes features, tech stack, and how to open index.html locally or via GitHub Pages.

##### Components
A. Static Web Host
– GitHub Pages or any static file server that serves index.html, style.css, assets and app.js.
B. Browser / Client
– Fetches static files.
– Renders UI, applies styles, executes app.js.
C. UI Layer
– HTML structure (forms, buttons, list container).
– CSS styling.
D. Logic Layer
– JavaScript module (app.js) handling:
- Participant management (add/remove).
- DOM manipulation for realtime updates.
E. User Interactions
– Events (clicks, form submissions).

##### Relationships and Data Flows
1. Browser requests index.html → static server responds.
2. index.html makes parallel requests for style.css, app.js.
3. Browser parses HTML/CSS, applies styles, then executes app.js.
4. User actions trigger JavaScript event handlers.
5. app.js updates the DOM directly—no external API calls.

##### Architectural Patterns and Design Principles
- Single‐page pattern: all logic lives in one JS file, manipulating the DOM in response to events.
- Separation of concerns:
– index.html holds structure,
– style.css holds presentation,
– app.js holds behavior.
- No external dependencies—zero build step, zero runtime services.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Static Hosting Layer
    subgraph "Static Hosting"
        SF["Static File Server"]:::server
    end

    %% Static Files
    SF -->|"HTTP GET index.html"| Browser
    Browser -->|"parses HTML, requests CSS & JS"| SF
    SF -->|"HTTP GET style.css & app.js"| Browser
    SF -->|"serves assets & docs"| Browser

    %% Browser / Client Layer
    subgraph "Browser / Client"
        Browser["Browser Environment"]:::browser

        subgraph "UI & Logic"
            HTML_DOM["HTML Structure<br/>(DOM)"]:::ui
            CSS_STYLE["CSS Styling"]:::ui
            JS_LOGIC["JS Logic (app.js)"]:::logic
            DOM["DOM"]:::ui
        end

        UI_EVENTS["User Events<br/>(clicks, form submits)"]:::ui
    end

    %% Data and Event Flows
    Browser -->|"renders HTML & CSS"| HTML_DOM
    Browser -->|"executes JS"| JS_LOGIC
    UI_EVENTS -->|"triggers handlers"| JS_LOGIC
    JS_LOGIC -->|"updates"| DOM
    DOM -->|"reflects in UI"| HTML_DOM

    %% Click Events
    click HTML_DOM "https://github.com/luisandovalu/challenge-amigo-secreto/blob/main/index.html"
    click CSS_STYLE "https://github.com/luisandovalu/challenge-amigo-secreto/blob/main/style.css"
    click JS_LOGIC "https://github.com/luisandovalu/challenge-amigo-secreto/blob/main/app.js"
    click ASSETS "https://github.com/luisandovalu/challenge-amigo-secreto/tree/main/assets/"
    click README "https://github.com/luisandovalu/challenge-amigo-secreto/blob/main/README.md"

    %% Styles
    classDef server fill:#e2e3e5,stroke:#999;
    classDef staticFile fill:#cce5ff,stroke:#339;
    classDef browser fill:#d4edda,stroke:#2a7;
    classDef ui fill:#f8d7da,stroke:#a85;
    classDef logic fill:#fff3cd,stroke:#bb8;
    class SF,Browser staticFile
```
