# andresprograming11/parcial-tienda architecture

> Architecture diagram of the GitHub repository andresprograming11/parcial-tienda, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/andresprograming11/parcial-tienda
- Repository: https://github.com/andresprograming11/parcial-tienda

## Overview

##### Project type and purpose
- This is a full-stack “shopping cart” application (“Carrito compras”) comprised of:
- A React + Vite SPA (frontend)
- A set of PHP scripts acting as a REST-style API (backend)
- A relational database (implied by conexion.php) storing users and articles
- Purpose: allow end users to browse products, register/login, manage a cart; allow admins to CRUD articles and users.

##### File structure
- Frontend (root and “Carrito compras” / src):
- src/components: UI building blocks (Navbar, NavbarTop)
- src/views: route-level pages (Productos, Login, Registro, AdminPanel, etc.)
- src/controllers: orchestrate data flow between services & views
- src/services: HTTP clients for each endpoint (articulos, carritoItem, login, registro, gestionar_usuarios, etc.)
- src/routes/AppRouter.jsx: client-side navigation
- vite.config.js, package.json: build & dev config
- Backend (carrito-backend folder):
- conexion.php: DB connection
- login.php, registro.php: auth endpoints
- listar_articulos.php, crear_articulo.php, gestionar_usuarios.php, etc.: CRUD endpoints
- Build artifacts: dist/ (frontend production bundle)

##### Key architectural insights (README + structure)
- Frontend: React component → view layer; controllers/services abstract API calls
- Backend: procedural PHP scripts exposing JSON endpoints
- Communication pattern: HTTPS REST calls

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend"
        direction TB
        StaticServer["Static Server / CDN"]:::build
        Vite["Vite Dev Server"]:::build
        Vite -->|Build| Dist
        Dist["dist/ (Production Bundle)"]:::build
        click Dist "https://github.com/andresprograming11/parcial-tienda/tree/main/Carrito compras/dist/"
        Dist -->|Serves| StaticServer

        subgraph "SPA (React + Vite)" 
            direction TB
            Browser["Browser"]:::frontend
            Entry["main.jsx"]:::frontend
            click Entry "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/main.jsx"
            Router["AppRouter.jsx"]:::frontend
            click Router "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/routes/AppRouter.jsx"
            
            subgraph "UI Components"
                direction TB
                Navbar["Navbar.jsx"]:::frontend
                click Navbar "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/components/Navbar.jsx"
                NavbarTop["NavbarTop.jsx"]:::frontend
                click NavbarTop "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/components/NavbarTop.jsx"
            end

            subgraph "Views (Pages)"
                direction TB
                Productos["Productos.jsx"]:::frontend
                click Productos "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/Productos.jsx"
                LoginView["Login.jsx"]:::frontend
                click LoginView "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/Login.jsx"
                RegistroView["Registro.jsx"]:::frontend
                click RegistroView "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/Registro.jsx"
                AdminPanel["AdminPanel.jsx"]:::frontend
                click AdminPanel "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/AdminPanel.jsx"
                AdminArticulos["AdminArticulos.jsx"]:::frontend
                click AdminArticulos "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/AdminArticulos.jsx"
                AdminUsuarios["AdminUsuarios.jsx"]:::frontend
                click AdminUsuarios "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/AdminUsuarios.jsx"
                ModalCamisa["ModalCamisa.jsx"]:::frontend
                click ModalCamisa "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/ModalCamisa.jsx"
                ModalProducto["ModalProducto.jsx"]:::frontend
                click ModalProducto "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/ModalProducto.jsx"
                PantalonesYSudaderas["PantalonesYSudaderas.jsx"]:::frontend
                click PantalonesYSudaderas "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/PantalonesYSudaderas.jsx"
                Uniformes["Uniformes.jsx"]:::frontend
                click Uniformes "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/Uniformes.jsx"
                Camisas["camisas.jsx"]:::frontend
                click Camisas "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/camisas.jsx"
                TodosLosProductos["todosLosProductos.jsx"]:::frontend
                click TodosLosProductos "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/todosLosProductos.jsx"
                RestablecerPass["Restablecerpass.jsx"]:::frontend
                click RestablecerPass "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/views/Restablecerpass.jsx"
            end

            Controllers["controllers.jsx"]:::frontend
            click Controllers "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/controllers/controllers.jsx"
            Models["modelo.jsx"]:::frontend
            click Models "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/models/modelo.jsx"

            subgraph "Services (API Wrappers)"
                direction TB
                ArticulosService["articulos.jsx"]:::frontend
                click ArticulosService "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/services/articulos.jsx"
                CarritoItemService["carritoItem.jsx"]:::frontend
                click CarritoItemService "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/services/carritoItem.jsx"
                GestionarArticulos["gestionar_articulos.jsx"]:::frontend
                click GestionarArticulos "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/services/gestionar_articulos.jsx"
                GestionarUsuarios["gestionar_usuarios.jsx"]:::frontend
                click GestionarUsuarios "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/services/gestionar_usuarios.jsx"
                LoginService["login.jsx"]:::frontend
                click LoginService "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/services/login.jsx"
                RegistroService["registro.jsx"]:::frontend
                click RegistroService "https://github.com/andresprograming11/parcial-tienda/blob/main/Carrito compras/src/services/registro.jsx"
            end

            Browser --> Entry --> Router
            Router --> UIComponents
            UIComponents --> Views
            Views --> Controllers --> Services
            Services -->|HTTPS REST| BackendAPI
        end
    end

    %% Backend Layer
    subgraph "Backend API (PHP)" 
        direction TB
        subgraph "Auth Endpoints"
            direction TB
            Conexion["conexion.php"]:::backend
            click Conexion "https://github.com/andresprograming11/parcial-tienda/blob/main/carrito-backend/conexion.php"
            Registro["registro.php"]:::backend
            click Registro "https://github.com/andresprograming11/parcial-tienda/blob/main/carrito-backend/registro.php"
            Login["login.php"]:::backend
            click Login "https://github.com/andresprograming11/parcial-tienda/blob/main/carrito-backend/login.php"
            Token["send_tokend.php"]:::backend
            click Token "https://github.com/andresprograming11/parcial-tienda/blob/main/carrito-backend/send_tokend.php"
        end
        subgraph "Articles Endpoints"
            direction TB
            ListArticulos["listar_articulos.php"]:::backend
            click ListArticulos "https://github.com/andresprograming11/parcial-tienda/blob/main/carrito-backend/listar_articulos.php"
            ObtenerArticulos["obtener_articulos.php"]:::backend
            click ObtenerArticulos "https://github.com/andresprograming11/parcial-tienda/blob/main/carrito-backend/obtener_articulos.php"
            CrearArticulo["crear_articulo.php"]:::backend
            click CrearArticulo "https://github.com/andresprograming11/parcial-tienda/blob/main/carrito-backend/crear_articulo.php"
        end
        subgraph "User Management"
            direction TB
            GestionarUsuariosBE["gestionar_usuarios.php"]:::backend
            click GestionarUsuariosBE "https://github.com/andresprograming11/parcial-tienda/blob/main/carrito-backend/gestionar_usuarios.php"
        end
        BackendAPI --> Conexion
        Conexion --> Database
    end

    %% Database
    Database["Database (MySQL)"]:::db

    %% Flows
    BackendAPI -->|Queries| Database
    Database -->|Results JSON| BackendAPI

    %% Styles
    classDef frontend fill:#add8e6,stroke:#333,stroke-width:1px
    classDef backend fill:#90ee90,stroke:#333,stroke-width:1px
    classDef db fill:#f0e68c,stroke:#333,stroke-width:1px
    classDef build fill:#d3d3d3,stroke:#333,stroke-width:1px
```
