# saulzarate/dv-produccion_web-tp_final architecture

> Architecture diagram of the GitHub repository saulzarate/dv-produccion_web-tp_final, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saulzarate/dv-produccion_web-tp_final
- Repository: https://github.com/saulzarate/dv-produccion_web-tp_final

## Overview

1. **Project type and runtime**
   - This is a classic **server-rendered PHP + MySQL** application for a clothing store.
   - The architecture is **MVC**, with PHP handling request/response rendering and MySQL persisting users, products, and categories.

2. **Request entry point**
   - `index.php` is the main entry point and likely acts as the **front controller**.
   - It coordinates bootstrapping, routing to controllers, and loading the appropriate view for each request.

3. **Bootstrap and configuration boundary**
   - `autoload.php` provides class loading for the app’s own code.
   - `config/parameters.php` centralizes application path/base URL settings.
   - `config/db.php` holds the database connection settings, so environment-specific values are isolated from the app logic.

4. **Controller layer**
   - `controllers/ProductoController.php` handles product-facing flows such as listing, featured products, category views, product detail, and admin product creation/editing.
   - `controllers/UsuarioController.php` handles authentication and user flows such as login and registration.
   - Controllers are the orchestration layer: they gather model data, apply access rules, and pass variables into views.

5. **Model layer and data access**
   - `models/Producto.php`, `models/Categoria.php`, and `models/Usuario.php` represent the main domain entities.
   - These models are the boundary to the MySQL database and encapsulate queries/CRUD for products, categories, and users.
   - The app’s persistent structure is defined by the SQL dump in `database/dv-produccion_web-tienda.sql`.

6. **View layer and page composition**
   - Views are organized by feature: `views/producto/*` and `views/usuario/*`.
   - Shared layout pieces live in `views/layout/*` (`header`, `footer`, `nav`, `meta`, `links`, `scriptBootstrap`), indicating a reusable page shell around content views.
   - This layout structure suggests a consistent rendered HTML site with common navigation and styling.

7. **Authentication and role separation**
   - The README indicates **two roles: admin and normal user**.
   - User registration/login live in the `UsuarioController` and `views/usuario/*`.
   - Role checks likely gate admin-only product management screens versus public catalog browsing.

8. **Catalog and content flow**
   - Public-facing product browsing appears to include:
     - featured/home content in `views/producto/destacados.php`
     - category/product listings in `views/producto/producto.php`
     - product detail in `views/producto/ver.php`
   - The main flow is: request → controller fetches products/categories from models → view renders catalog page.

9. **Admin product management**
   - `views/producto/crear.php` and the admin screenshots in the README indicate a back-office UI for creating and modifying products.
   - This is likely the main write path in the app: admin submits product data through a controller, which persists it via the `Producto` model.

10. **Helpers and pagination**
    - `helpers/Paginador.php` suggests list pages are paginated rather than loading all products at once.
    - `helpers/Utils.php` likely contains shared utility functions for formatting, validation, or common view/controller operations.
    - These helpers sit between controllers and views to reduce repeated logic.

11. **Static and uploaded assets**
    - `assets/css/style.css` is the main custom stylesheet, alongside image assets in `assets/img`.
    - `uploads/images` is the writable content area for product images, separating user/admin uploaded media from source assets.
    - Product detail and listing pages likely render images from this upload directory.

12. **Overall architectural boundary**
    - The application is split into:
      - **web entry/bootstrap** (`index.php`, `autoload.php`, `config/*`)
      - **business and request handling** (`controllers/*`, `helpers/*`)
      - **persistence/domain** (`models/*`, `database/*.sql`)
      - **presentation** (`views/*`, `assets/*`, `uploads/*`)
    - There are no visible external APIs or services; the system is self-contained around PHP, Bootstrap-styled HTML, and MySQL.

Main entry points: [`controllers/ProductoController.php`](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/controllers/ProductoController.php) (ProductoController), [`index.php`](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/index.php) (index.php), [`controllers/UsuarioController.php`](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/controllers/UsuarioController.php) (UsuarioController), [`views/producto/producto.php`](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/views/producto/producto.php) (producto views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_web["Web entry"]
  node_index_php["index.php<br/>front controller<br/>[index.php]"]
  node_autoload_php["autoload.php<br/>autoloading<br/>[autoload.php]"]
  node_cfg_params["parameters<br/>config<br/>[parameters.php]"]
  node_cfg_db["db config<br/>[db.php]"]
end

subgraph group_grp_app["App logic"]
  node_producto_ctrl["ProductoController"]
  node_usuario_ctrl["UsuarioController"]
  node_producto_model[("Producto<br/>model<br/>[Producto.php]")]
  node_categoria_model[("Categoria<br/>model<br/>[Categoria.php]")]
  node_usuario_model[("Usuario<br/>model<br/>[Usuario.php]")]
  node_paginador{{"Paginador<br/>helper<br/>[Paginador.php]"}}
  node_utils{{"Utils<br/>helper<br/>[Utils.php]"}}
end

subgraph group_grp_presentation["Presentation"]
  node_layout_shell["layout<br/>[header.php]"]
  node_producto_views["producto views<br/>feature views<br/>[producto.php]"]
  node_usuario_views["usuario views<br/>feature views<br/>[login.php]"]
end

subgraph group_grp_data["Data"]
  node_schema_sql[("schema SQL<br/>database schema")]
end

subgraph group_grp_assets["Assets"]
  node_uploads_img(("uploads/images<br/>media store"))
  node_style_css["style.css<br/>stylesheet<br/>[style.css]"]
end

node_index_php -->|"loads"| node_autoload_php
node_index_php -->|"reads"| node_cfg_params
node_index_php -->|"reads"| node_cfg_db
node_index_php -->|"dispatches to"| node_producto_ctrl
node_index_php -->|"dispatches to"| node_usuario_ctrl
node_producto_ctrl -->|"queries"| node_producto_model
node_producto_ctrl -->|"queries"| node_categoria_model
node_producto_ctrl -->|"uses"| node_paginador
node_producto_ctrl -->|"uses"| node_utils
node_usuario_ctrl -->|"queries"| node_usuario_model
node_usuario_ctrl -->|"uses"| node_utils
node_producto_ctrl -->|"renders"| node_producto_views
node_usuario_ctrl -->|"renders"| node_usuario_views
node_producto_views -->|"wraps with"| node_layout_shell
node_usuario_views -->|"wraps with"| node_layout_shell
node_producto_views -->|"styles with"| node_style_css
node_usuario_views -->|"styles with"| node_style_css
node_producto_views -->|"displays"| node_uploads_img
node_producto_model -->|"maps to"| node_schema_sql
node_categoria_model -->|"maps to"| node_schema_sql
node_usuario_model -->|"maps to"| node_schema_sql

click node_index_php "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/index.php"
click node_autoload_php "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/autoload.php"
click node_cfg_params "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/config/parameters.php"
click node_cfg_db "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/config/db.php"
click node_producto_ctrl "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/controllers/ProductoController.php"
click node_usuario_ctrl "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/controllers/UsuarioController.php"
click node_producto_model "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/models/Producto.php"
click node_categoria_model "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/models/Categoria.php"
click node_usuario_model "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/models/Usuario.php"
click node_paginador "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/helpers/Paginador.php"
click node_utils "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/helpers/Utils.php"
click node_layout_shell "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/views/layout/header.php"
click node_producto_views "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/views/producto/producto.php"
click node_usuario_views "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/views/usuario/login.php"
click node_schema_sql "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/database/dv-produccion_web-tienda.sql"
click node_uploads_img "https://github.com/saulzarate/dv-produccion_web-tp_final/tree/main/uploads/images"
click node_style_css "https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/assets/css/style.css"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_index_php,node_autoload_php,node_cfg_params,node_cfg_db toneBlue
class node_producto_ctrl,node_usuario_ctrl,node_producto_model,node_categoria_model,node_usuario_model,node_paginador,node_utils toneAmber
class node_layout_shell,node_producto_views,node_usuario_views toneMint
class node_schema_sql toneRose
class node_uploads_img,node_style_css toneIndigo
```

## Components

### Web entry

Front controller, autoloading, and configuration boundary

- [index.php](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/index.php): front controller · Main request entry point and route dispatcher · `index.php`
- [autoload.php](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/autoload.php): autoloading · Loads application classes · `autoload.php`
- [parameters](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/config/parameters.php): config · Application path and base URL settings · `config/parameters.php`
- [db config](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/config/db.php): config · Database connection settings · `config/db.php`

### App logic

Controllers, helpers, and domain models

- [ProductoController](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/controllers/ProductoController.php): controller · Product browsing and admin product flows · `controllers/ProductoController.php`
- [UsuarioController](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/controllers/UsuarioController.php): controller · Login and registration flows · `controllers/UsuarioController.php`
- [Producto](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/models/Producto.php): model · Product domain and persistence access · `models/Producto.php`
- [Categoria](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/models/Categoria.php): model · Category domain and persistence access · `models/Categoria.php`
- [Usuario](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/models/Usuario.php): model · User domain and persistence access · `models/Usuario.php`
- [Paginador](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/helpers/Paginador.php): helper · Pagination support for list pages · `helpers/Paginador.php`
- [Utils](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/helpers/Utils.php): helper · Shared utility functions · `helpers/Utils.php`

### Presentation

Reusable layout and feature views

- [layout](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/views/layout/header.php): view layout · Shared page shell and chrome · `views/layout/header.php`
- [producto views](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/views/producto/producto.php): feature views · Catalog, detail, featured, and admin product screens · `views/producto/producto.php`
- [usuario views](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/views/usuario/login.php): feature views · Login and registration screens · `views/usuario/login.php`

### Data

Database schema and persisted content

- [schema SQL](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/database/dv-produccion_web-tienda.sql): database schema · MySQL structure and sample data dump · `database/dv-produccion_web-tienda.sql`

### Assets

Static and uploaded media

- [uploads/images](https://github.com/saulzarate/dv-produccion_web-tp_final/tree/main/uploads/images): media store · Writable product image directory · `uploads/images`
- [style.css](https://github.com/saulzarate/dv-produccion_web-tp_final/blob/main/assets/css/style.css): stylesheet · Custom site styling · `assets/css/style.css`

## Connections

- index.php → autoload.php: loads · Bootstraps class loading before handling requests
- index.php → parameters: reads · Uses app path and base URL settings
- index.php → db config: reads · Connects application runtime to the database
- index.php → ProductoController: dispatches to · Routes catalog and admin product requests
- index.php → UsuarioController: dispatches to · Routes auth and user requests
- ProductoController → Producto: queries · Fetches and persists products
- ProductoController → Categoria: queries · Loads categories for catalog and forms
- ProductoController → Paginador: uses · Paginates product listings
- ProductoController → Utils: uses · Shares formatting and controller utilities
- UsuarioController → Usuario: queries · Authenticates and creates users
- UsuarioController → Utils: uses · Shares validation and helper routines
- ProductoController → producto views: renders · Composes catalog, detail, and admin product pages
- UsuarioController → usuario views: renders · Composes login and registration pages
- producto views → layout: wraps with · Uses common header, nav, meta, and footer pieces
- usuario views → layout: wraps with · Uses common header, nav, meta, and footer pieces
- producto views → style.css: styles with · Applies the shared site stylesheet
- usuario views → style.css: styles with · Applies the shared site stylesheet
- producto views → uploads/images: displays · Renders product images from the upload area
- Producto → schema SQL: maps to · Persists product records in MySQL
- Categoria → schema SQL: maps to · Persists category records in MySQL
- Usuario → schema SQL: maps to · Persists user records in MySQL
