# bjornlb21/amigo-secreto architecture

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

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

## Overview

##### Main Components
- User Interface (UI):
- index.html: The main web page that users interact with.
- style.css: The stylesheet that defines the look and feel.
- Application Logic:
- app.js: Contains the core functionality including adding a friend, sorting a friend pairing, validating user input, and resetting lists.
- Assets:

##### Component Interactions and Relationships
- User Interaction Flow:
- Users open index.html in a browser.
- The browser loads style.css to style the HTML and app.js to provide dynamic behavior.
- JavaScript Functionality:
- In app.js, UI events (e.g., button clicks to "Agregar Amigo" or "Sortear Amigo") trigger functions that handle data validation, friend addition, friend drawing, and list resetting.
- These functions update the DOM elements on index.html to reflect state changes.
- Assets Integration:
- The assets folder is used to load any supporting media, such as images or the video referenced in the README, ensuring the app remains visually engaging.

##### Important Architectural Patterns
- Separation of Concerns:
- The project is organized so that the presentation (HTML/CSS) is separate from the business logic (JavaScript).
- Event-Driven Design:
- The web app responds to user events (clicks, inputs), which drive the application logic in app.js.
- Lightweight, Client-Side Application:
- There is no backend involved; all functionality is implemented in the client’s browser.

## Diagram (Mermaid)

```mermaid
graph TD
    User["User"]:::user
    UI["index.html (UI)"]:::ui
    CSS["style.css (Styling)"]:::static
    JS["app.js (Application Logic)"]:::logic
    Assets["Assets (Media/Resources)"]:::asset

    User -->|"opens"| UI
    UI -->|"loads"| CSS
    UI -->|"loads"| JS
    JS -->|"updates"| UI
    JS -->|"loads"| Assets

    click UI "https://github.com/bjornlb21/amigo-secreto/blob/main/index.html"
    click CSS "https://github.com/bjornlb21/amigo-secreto/blob/main/style.css"
    click JS "https://github.com/bjornlb21/amigo-secreto/blob/main/app.js"
    click Assets "https://github.com/bjornlb21/amigo-secreto/tree/main/assets"

    classDef user fill:#ffcccb,stroke:#990000,stroke-width:2px;
    classDef ui fill:#cce5ff,stroke:#003366,stroke-width:2px;
    classDef static fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef logic fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef asset fill:#e2e3e5,stroke:#41464b,stroke-width:2px;
```
