# hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069 architecture

> Architecture diagram of the GitHub repository hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069
- Repository: https://github.com/hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069

## Overview

##### Project Type and Purpose
- This is a client-side Single-Page Application (SPA) for managing food orders (“Sistema de Gestión de Pedidos”).
- It has no separate backend – all logic and data storage run in the user’s browser (using localStorage).

##### Main Components
a. User Interface Layer
- index.html + style.css
- src/views (modal.js, store.js) – view controllers and DOM renderers
b. Application Logic / Services
- src/services
– categories.js (manages category data)
– products.js (manages product listings and details)
– searchBar.js (handles search/filter interactions)
c. Persistence Layer
- src/persistence/localStorage.js – wrapper around window.localStorage for saving orders, cart state, etc.
d. Entry Point and Bundler
- main.js – imports views, services, persistence; wires up event listeners and initial rendering
- package.json / npm scripts (npm run dev) – local development server and module bundling

##### Relationships and Data Flow
- The Browser loads index.html, which pulls in the bundled main.js & style.css.
- main.js initializes the views (store page, modals) and passes them references to service modules.
- When the user interacts (e.g., selects a category, adds a product), the view invokes a service method.
- Services read/write data via localStorage.js.
- After persistence updates, services emit events or return updated data to views for re-rendering.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
– Views handle UI.
– Services handle business logic.
– Persistence module handles data storage.
- Event-Driven Updates: Services notify views when data changes.
- Module-Based Structure: Clear directory boundaries and single-responsibility modules.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser / UI Layer
    subgraph "Browser/UI Layer"
        Index["index.html"]:::ui
        Style["style.css"]:::ui
    end

    %% Entry Point & Bundler
    subgraph "Entry Point & Bundler"
        Main["main.js"]:::build
        Package["package.json"]:::build
    end

    %% Views Layer
    subgraph "Views Layer"
        Modal["modal.js"]:::ui
        Store["store.js"]:::ui
    end

    %% Services Layer
    subgraph "Services Layer"
        Categories["categories.js"]:::services
        Products["products.js"]:::services
        Search["searchBar.js"]:::services
    end

    %% Persistence Layer
    LocalStorage["localStorage.js"]:::persistence

    %% Connections
    Index -->|"loads"| Main
    Style --> Main
    Main -->|"initializes"| Modal
    Main -->|"initializes"| Store

    Modal -->|"getCategories() / selectCategory()"| Categories
    Store -->|"getProducts() / addToCart() / search() "| Search
    Store -->|"getProducts() / addToCart() "| Products

    Categories -->|"saveCategory()"| LocalStorage
    Products -->|"saveProduct()"| LocalStorage
    Search -->|"saveSearchState()"| LocalStorage

    LocalStorage -->|"onDataChange()"| Categories
    LocalStorage -->|"onDataChange()"| Products
    LocalStorage -->|"onDataChange()"| Search

    Categories ---|"updateView()"| Modal
    Products ---|"updateView()"| Store
    Search ---|"updateView()"| Store

    %% Click Events
    click Index "https://github.com/hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069/blob/master/index.html"
    click Style "https://github.com/hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069/blob/master/style.css"
    click Main "https://github.com/hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069/blob/master/main.js"
    click Package "https://github.com/hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069/blob/master/package.json"
    click Modal "https://github.com/hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069/blob/master/src/views/modal.js"
    click Store "https://github.com/hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069/blob/master/src/views/store.js"
    click Categories "https://github.com/hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069/blob/master/src/services/categories.js"
    click Products "https://github.com/hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069/blob/master/src/services/products.js"
    click Search "https://github.com/hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069/blob/master/src/services/searchBar.js"
    click LocalStorage "https://github.com/hsinyulin03/trabajo-practico-integrador_html_css_javascript-lin-50069/blob/master/src/persistence/localStorage.js"

    %% Styles
    classDef ui fill:#9cf,stroke:#000;
    classDef services fill:#9f9,stroke:#000;
    classDef persistence fill:#ffa,stroke:#000;
    classDef build fill:#ddd,stroke:#000,stroke-dasharray: 5 5;
```
