# pablo-f42/preentrega2-faz architecture

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

- Interactive diagram: https://gitdiagram.com/pablo-f42/preentrega2-faz
- Repository: https://github.com/pablo-f42/preentrega2-faz

## Overview

##### Project type and purpose
- This is a single‑page front‑end application (an e‑commerce demo) built with React, bundled by Vite, and using a local mock service for data. No backend is included; data is returned from `src/asyncmock.js`.
- Purpose: to display lists of items, show item details, and manage a cart widget in a lightweight React+Vite setup.

##### File structure
- Top level:
- `index.html` + `public/` → static HTML and assets (images, favicon, etc.)
- `src/` → all React code and stylesheets
- `vite.config.js` → build & dev‑server configuration
- `.eslintrc.cjs`, `package.json` → linting and dependency management
- Inside `src/`:
- `main.jsx` → React app entry point
- `App.jsx` & `App.css` → root component and global styles
- Component folders: each has its `.jsx` + `.css`:
– Presentational: `Item/`, `ItemDetail/`, `CartWidget/`, `NavBar/`
– Container: `ItemListContainer/`, `ItemDetailContainer/`
– Composite: `ItemList/`
- `asyncmock.js` → mock data service
- `assets/`, CSS in `src/index.css`

##### README
- Confirms React+Vite template with Hot Module Replacement.
- Mentions two official plugins (`@vitejs/plugin-react` or `-swc`) for fast refresh.
- No runtime backend—data comes from local mocks.

##### Detail
- Sub‑components (NavBar, Item, ItemDetail, etc.)
- Don’t omit the mock service or the build pipeline
- CSS modules alongside components to highlight styling boundaries

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External actors
    User["User"]:::external
    Browser["Browser"]:::external

    User --> Browser

    %% Development Tools
    subgraph "Development Environment"
        ESLint["ESLint"]:::tool
        PackageMgmt["npm / package.json"]:::tool
        ViteConfig["Vite Config"]:::tool
        DevServer["Vite Dev Server"]:::tool
    end

    Browser --> DevServer
    DevServer --> Browser

    %% Static Assets
    subgraph "Static Assets"
        Public["public/"]:::asset
        IndexHTML["index.html"]:::asset
        AssetsDir["src/assets/"]:::asset
    end

    Browser --> Public
    Browser --> AssetsDir

    %% React Application
    subgraph "React Application"
        Main["Entry Point"]:::frontend
        AppComp["App Component"]:::frontend
        AppCSS["App Stylesheet"]:::asset

        NavBarComp["NavBar Component"]:::frontend
        NavBarCSS["NavBar Stylesheet"]:::asset

        ItemListContainer["ItemListContainer"]:::frontend
        ItemListComp["ItemList"]:::frontend

        ItemDetailContainer["ItemDetailContainer"]:::frontend
        ItemDetailComp["ItemDetail Component"]:::frontend
        ItemDetailCSS["ItemDetail Stylesheet"]:::asset

        ItemComp["Item Component"]:::frontend
        ItemCSS["Item Stylesheet"]:::asset

        CartWidgetComp["CartWidget"]:::frontend
        CartWidgetCSS["CartWidget Stylesheet"]:::asset

        IndexCSS["Global Stylesheet"]:::asset

        MockService["Mock Data Service"]:::data

        Main --> AppComp
        AppComp --> AppCSS
        AppComp --> NavBarComp
        AppComp --> ItemListContainer
        AppComp --> ItemDetailContainer
        AppComp --> CartWidgetComp
        AppComp --> IndexCSS

        NavBarComp --> NavBarCSS

        ItemListContainer --> MockService
        ItemListContainer --> ItemListComp
        ItemListComp --> ItemComp
        ItemComp --> ItemCSS

        ItemDetailContainer --> MockService
        ItemDetailContainer --> ItemDetailComp
        ItemDetailComp --> ItemDetailCSS

        CartWidgetComp --> CartWidgetCSS
        MockService -.->|"provides data"| AppComp
    end

    Browser --> Main

    %% Build & Deployment
    subgraph "Build & Deployment"
        Build["Vite Build"]:::tool
        Dist["dist/"]:::asset
        StaticHost["Static Web Host"]:::external
    end

    ViteConfig --> Build
    Build --> Dist
    Dist -->|"Deploy"| StaticHost
    Public --> StaticHost

    %% Click Events
    click Main "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/main.jsx"
    click AppComp "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/App.jsx"
    click AppCSS "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/App.css"
    click NavBarComp "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/NavBar/NavBar.jsx"
    click NavBarCSS "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/NavBar/NavBar.css"
    click ItemListContainer "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/ItemListContainer/ItemListContainer.jsx"
    click ItemListComp "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/ItemList/ItemList.jsx"
    click ItemDetailContainer "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/ItemDetailContainer/ItemDetailContainer.jsx"
    click ItemDetailComp "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/ItemDetail/ItemDetail.jsx"
    click ItemDetailCSS "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/ItemDetail/ItemDetail.css"
    click ItemComp "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/Item/Item.jsx"
    click ItemCSS "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/Item/item.css"
    click CartWidgetComp "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/CartWidget/CartWidget.jsx"
    click CartWidgetCSS "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/CartWidget/CartWidget.css"
    click MockService "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/asyncmock.js"
    click IndexCSS "https://github.com/pablo-f42/preentrega2-faz/blob/main/src/index.css"
    click AssetsDir "https://github.com/pablo-f42/preentrega2-faz/tree/main/src/assets/"
    click Public "https://github.com/pablo-f42/preentrega2-faz/tree/main/public/"
    click ViteConfig "https://github.com/pablo-f42/preentrega2-faz/blob/main/vite.config.js"
    click ESLint "https://github.com/pablo-f42/preentrega2-faz/blob/main/.eslintrc.cjs"
    click PackageMgmt "https://github.com/pablo-f42/preentrega2-faz/blob/main/package.json"
    click PackageMgmt "https://github.com/pablo-f42/preentrega2-faz/blob/main/package-lock.json"

    %% Styles
    classDef external fill:#f9f,stroke:#333,stroke-width:1px
    classDef frontend fill:#bbf,stroke:#333,stroke-width:1px
    classDef data fill:#bfb,stroke:#333,stroke-width:1px
    classDef tool fill:#fb3,stroke:#333,stroke-width:1px
    classDef asset fill:#ddd,stroke:#333,stroke-width:1px
```
