# duckmoron/proyecto-reactjs architecture

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

- Interactive diagram: https://gitdiagram.com/duckmoron/proyecto-reactjs
- Repository: https://github.com/duckmoron/proyecto-reactjs

## Overview

##### Project type and purpose
- This is a React single-page application (SPA) scaffolded with Vite.
- Purpose: a simple product gallery/e-commerce demo with pages for browsing products, an admin section to add/edit products, a shopping cart, and user authentication (protected routes).

##### File structure
Top level
- package.json / package-lock.json, Vite & React plugins, ESLint config
- index.html – the SPA entry point
- public/ – static assets & JSON data (public/data/data.json, users.json) served at runtime
- src/ – application code
– main.jsx – mounts React into index.html
– App.jsx + App.css – root component, router setup
– auth/RutaProtegida.jsx – route guard component for protected pages
– pages/ – top-level routes (Home, Admin, Login, etc.)
– components/ – reusable UI pieces (ProductList, Cart, Forms, Header/Footer)
– context/ – React Context providers (AuthContext, CartContext, AdminContext)
– utils/ – helper modules (e.g. datas2.js)

##### README
- Confirms minimal React + Vite setup, HMR via official plugins
- No backend; static JSON files are used for demo data

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Environment
    subgraph "Developer Environment"
        VITE["Vite Dev Server & Build Pipeline"]:::build
        ESLINT["ESLint Configuration"]:::build
    end
    VITE -->|bundles src/| BROWSER
    ESLINT -->|lints code| VITE

    %% Browser Client
    BROWSER(["Browser"]):::runtime
    BROWSER -->|loads SPA| APP["React App"]:::runtime

    %% React App Structure
    subgraph "React App"
        ROUTER["Router"]:::runtime
        CONTEXT["Context Providers"]:::runtime
        subgraph "Pages"
            HOME["Home Page"]:::runtime
            GALLERY["GaleriaDeProductos"]:::runtime
            ADMINPAGE["Admin Dashboard Page"]:::runtime
            LOGIN["Login Page"]:::runtime
            CONTACT["Contact Page"]:::runtime
            ABOUT["About Page"]:::runtime
            NOTFOUND["NotFound (404) Page"]:::runtime
        end
        subgraph "Components"
            PROD_LIST["Product List Component"]:::runtime
            CART["Shopping Cart Component"]:::runtime
            DETAILS["Product Details Component"]:::runtime
            PRODUCTS["Product Display Component"]:::runtime
            NEW_FORM["New Product Form Component"]:::runtime
            EDIT_FORM["Edit Product Form Component"]:::runtime
            HEADER["Header (static) Component"]:::runtime
            FOOTER["Footer (static) Component"]:::runtime
        end
    end

    %% Interactions
    APP -->|uses| ROUTER
    APP -->|wraps with| CONTEXT
    ROUTER -->|routes to| HOME
    ROUTER -->|routes to| GALLERY
    ROUTER -->|routes to| ADMINPAGE
    ROUTER -->|routes to| LOGIN
    ROUTER -->|routes to| CONTACT
    ROUTER -->|routes to| ABOUT
    ROUTER -->|routes to| NOTFOUND

    HOME -->|"renders"| PROD_LIST
    GALLERY -->|"renders"| PROD_LIST
    ADMINPAGE -->|"renders"| NEW_FORM
    ADMINPAGE -->|"renders"| EDIT_FORM

    PROD_LIST <-->|"state update"| CONTEXT
    CART <-->|"state update"| CONTEXT
    DETAILS <-->|"state update"| CONTEXT

    PROD_LIST -->|fetch data| DATA_JSON
    DETAILS -->|fetch data| DATA_JSON

    %% Static Data Layer
    subgraph "Static Data Layer"
        DATA_JSON["public/data/data.json"]:::data
        USERS_JSON["public/data/users.json"]:::data
    end
    APP -->|HTTP fetch| DATA_JSON
    APP -->|HTTP fetch| USERS_JSON

    %% Click Events
    click VITE "https://github.com/duckmoron/proyecto-reactjs/blob/main/vite.config.js"
    click ESLINT "https://github.com/duckmoron/proyecto-reactjs/blob/main/eslint.config.js"
    click BROWSER "https://github.com/duckmoron/proyecto-reactjs/blob/main/index.html"
    click APP "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/main.jsx"
    click APP "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/App.jsx"
    click ROUTER "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/App.jsx"
    click CONTEXT "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/context/AuthContext.jsx"
    click CONTEXT "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/context/CartContext.jsx"
    click CONTEXT "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/context/AdminContext.jsx"
    click HOME "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/pages/Home.jsx"
    click GALLERY "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/pages/GaleriaDeProductos.jsx"
    click ADMINPAGE "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/pages/Admin.jsx"
    click LOGIN "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/pages/Login.jsx"
    click CONTACT "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/pages/Contacto.jsx"
    click ABOUT "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/pages/AcercaDe.jsx"
    click NOTFOUND "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/pages/NotFound.jsx"
    click PROD_LIST "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/components/ProductList.jsx"
    click CART "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/components/Cart.jsx"
    click DETAILS "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/components/DetallesProductos.jsx"
    click PRODUCTS "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/components/Productos.jsx"
    click NEW_FORM "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/components/FormularioProducto.jsx"
    click EDIT_FORM "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/components/FormularioEdicion.jsx"
    click HEADER "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/components/estaticos/Header.jsx"
    click FOOTER "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/components/estaticos/Footer.jsx"
    click PROD_LIST "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/components/styleProductos.css"
    click CART "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/components/styleCart.css"
    click PROD_LIST "https://github.com/duckmoron/proyecto-reactjs/blob/main/src/utils/datas2.js"
    click DATA_JSON "https://github.com/duckmoron/proyecto-reactjs/blob/main/public/data/data.json"
    click USERS_JSON "https://github.com/duckmoron/proyecto-reactjs/blob/main/public/data/users.json"

    %% Styles
    classDef build fill:#ffa500,stroke:#333,stroke-width:1px
    classDef runtime fill:#87cefa,stroke:#333,stroke-width:1px
    classDef data fill:#98fb98,stroke:#333,stroke-width:1px
```
