# hjosuelb/ceo-orbe_pruebatecnica architecture

> Architecture diagram of the GitHub repository hjosuelb/ceo-orbe_pruebatecnica, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hjosuelb/ceo-orbe_pruebatecnica
- Repository: https://github.com/hjosuelb/ceo-orbe_pruebatecnica

## Overview

##### Main Components

- Client/Frontend:
- The user interacts with the system via a web browser.
- Frontend technologies include HTML and CSS (with styling files located under the “estilos” directory), along with Bootstrap for responsive design.
- The “index.php” file serves as the entry point.

- Backend Components:
- PHP files handle the server-side logic. These include the main page (index.php) and the files in “Modulos” which implement different functionalities such as listing students (estudiantes.php), adding new students (estudiantesAgregar.php), and editing student data (estudiantesEditar.php).
- Shared UI components (like header, footer, and navigation menus) are located in the “componentes” folder under “Recursos/componentes”. These files are reused across various pages to maintain consistency.

- Database Layer:
- The “BaseDatos” folder contains:
- db_conexion.php – responsible for establishing the database connection.
- db_query.sql – containing the SQL queries and likely instructions for stored procedures (as indicated by the README).
- MySQL is used for the data storage, and stored procedures are invoked to manage the CRUD operations.

##### Relationships and Interactions

- The user (via a browser) sends HTTP requests which hit the main entry point “index.php”.
- “index.php” then calls the appropriate module (from the “Modulos” folder) depending on the user’s actions (list, add, or edit a student).
- Each module includes UI components (from the “Recursos/componentes” directory) to maintain a consistent look and feel.
- When a database operation is required, the PHP scripts use the connection details in “BaseDatos/db_conexion.php” to connect to the MySQL server and run queries or stored procedures described in “BaseDatos/db_query.sql”.
- Feedback from the backend (like confirmation messages or errors) is then passed back to the user interface, potentially enhanced by JavaScript or SweetAlert2 for alerts.

##### Architectural Patterns/Design Principles

- Separation of Concerns: Different directories separate the application’s UI (“estilos”, “componentes”), business logic (“Modulos”), and data access (“BaseDatos”).
- Modular Design: Each PHP module handles a specific function (list, add, edit), making it easier to maintain and extend the system.
- Reusability: Shared components and styles ensure consistency and simplify updates across the system.
- Client-Server Interaction: Clear layering separates the frontend (client) from the backend (server) and the database layer.

##### Final Touches

- Block has a title reflecting its role (e.g., “Frontend”, “Backend – PHP Modules”, “Database – MySQL”).
- Adding annotations or notes for clarity—for example, explain that stored procedures handle database operations, or mention that “estilos” contains custom styles.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client / Frontend"
        Browser["Web Browser"]:::client
    end

    subgraph "Backend - PHP Application"
        Entry["index.php"]:::php
        M_List["Modulos/estudiantes.php"]:::php
        M_Add["Modulos/estudiantesAgregar.php"]:::php
        M_Edit["Modulos/estudiantesEditar.php"]:::php
        Navbar["Recursos/componentes/navbar.php"]:::ui
        NavbarIndex["Recursos/componentes/navbar-index.php"]:::ui
        Footer["Recursos/componentes/footer.php"]:::ui
        CSS_Index["estilos/index.css"]:::static
        CSS_Estud["estilos/estudiantes.css"]:::static
        CSS_Add["estilos/estudiantesAgregar.css"]:::static
        CSS_Edit["estilos/estudiantesEditar.css"]:::static
    end

    subgraph "Database - MySQL"
        DBConn["BaseDatos/db_conexion.php"]:::db
        DBQuery["BaseDatos/db_query.sql"]:::db
    end

    Browser -->|"sendsHTTPrequest"| Entry
    Entry -->|"callsModule"| M_List
    Entry -->|"callsModule"| M_Add
    Entry -->|"callsModule"| M_Edit
    Entry -->|"rendersUI"| Navbar
    Entry -->|"rendersUI"| NavbarIndex
    Entry -->|"rendersUI"| Footer
    Entry -->|"loadsStyles"| CSS_Index
    Entry -->|"loadsStyles"| CSS_Estud
    Entry -->|"loadsStyles"| CSS_Add
    Entry -->|"loadsStyles"| CSS_Edit

    M_List -->|"CRUDops"| DBConn
    M_Add -->|"CRUDops"| DBConn
    M_Edit -->|"CRUDops"| DBConn
    M_List -->|"executesSQL"| DBQuery
    M_Add -->|"executesSQL"| DBQuery
    M_Edit -->|"executesSQL"| DBQuery

    DBConn -->|"returnsFeedback"| Entry
    DBQuery -->|"returnsResults"| Entry

    click Entry "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/index.php"
    click CSS_Index "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/estilos/index.css"
    click CSS_Estud "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/estilos/estudiantes.css"
    click CSS_Add "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/estilos/estudiantesAgregar.css"
    click CSS_Edit "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/estilos/estudiantesEditar.css"
    click M_List "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/Modulos/estudiantes.php"
    click M_Add "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/Modulos/estudiantesAgregar.php"
    click M_Edit "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/Modulos/estudiantesEditar.php"
    click Navbar "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/Recursos/componentes/navbar.php"
    click NavbarIndex "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/Recursos/componentes/navbar-index.php"
    click Footer "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/Recursos/componentes/footer.php"
    click DBConn "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/BaseDatos/db_conexion.php"
    click DBQuery "https://github.com/hjosuelb/ceo-orbe_pruebatecnica/blob/main/BaseDatos/db_query.sql"

    classDef client fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef php fill:#ABEBC6,stroke:#1D8348,stroke-width:2px;
    classDef ui fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef static fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;
    classDef db fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
```
