# pgap22/muo architecture

> Architecture diagram of the GitHub repository pgap22/muo, 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/pgap22/muo
- Repository: https://github.com/pgap22/muo

## Overview

##### Main Components
- Client/User Interface: Represent the public website (pages, home, CSS, JS, images) that end users interact with in their web browsers.
- Administration Portal: The “admin” directory holds pages for managing items (categorías, expo, museos). This is a separate UI layer for admins.
- API Endpoints: The “api” folder contains PHP scripts (addFavorite, changeLanguage, getData, etc.) that likely serve AJAX or external requests.
- Authentication & Authorization: The “auth” folder handles login, logout, email verification, and password reset functionality.
- Business Logic Layer: The “clases” directory provides the core logic – classes for ActiveRecord, Handling categories, expositions, museums, comments, favorites, and so on. This is your domain/model layer.
- Supporting Libraries & Templates: The “includes” directory (with subdirectories for PHPMailer, DB, functions, and templates) handles database connections, utility functions, email notifications, and shared header/footer templates.
- Database: Although not a physical PHP file, the MySQL database (set up via the provided SQL files) is central to storing users, items, and other site data.
- Assets: CSS (organized by feature and responsive design-related directories) and JavaScript (various functionality including general interactions, admin scripts, language switching, search, and dynamic content) that provide front-end behavior and styles.

##### Relationships and Interactions
- The front-end code (JS and CSS) loads template components (header, footer) from the “includes/templates” directory.
- Both the public pages and API scripts call into the “clases” to execute business logic and interact with the database through “includes/db.php.”
- The authentication processes (in the “auth” folder) interact with the user model (in “clases/Usuarios.php”) and involve sending emails using PHPMailer (in “includes/PHPMailer”).
- The API endpoints are used to facilitate AJAX requests (managing favorites, language change, etc.) and further interact with the core models.

##### Architectural Patterns and Design Principles
- The project structure suggests an MVC-like separation even if it’s not a full framework – you have visual presentation (pages/templates/CSS/JS), business logic (clases), and a data access layer (MySQL via includes/db.php).
- There is a clear separation between public user paths and admin paths (directories “home,” “pages” vs. “admin”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    A("Client Browser"):::client
    B("Public Website (Pages, index.php, Assets)"):::ui
    C("Administration Portal (Admin Interface)"):::ui
    D("API Endpoints (AJAX PHP Scripts)"):::api
    E("Authentication (Login/Registration)"):::auth
    F("Business Logic Layer (Clases)"):::logic
    G("Supporting Libraries & Templates (Includes)"):::includes
    H("Database (MySQL)"):::database

    A -->|"HTTP"| B
    A -->|"HTTP"| C
    A -->|"AJAX"| D
    A -->|"AuthRequests"| E

    B -->|"CallsBusinessLogic"| F
    C -->|"CallsBusinessLogic"| F
    D -->|"CallsBusinessLogic"| F
    E -->|"ValidatesUser"| F

    B -->|"LoadsTemplates"| G
    C -->|"LoadsAdminTemplates"| G
    D -->|"LoadsTemplates"| G
    E -->|"SendsEmail"| G

    F -->|"DBQuery"| H
    G -->|"DBConnection"| H

    click B "https://github.com/pgap22/muo/tree/main/home"
    click C "https://github.com/pgap22/muo/tree/main/admin"
    click D "https://github.com/pgap22/muo/tree/main/api"
    click E "https://github.com/pgap22/muo/tree/main/auth"
    click F "https://github.com/pgap22/muo/tree/main/clases"
    click G "https://github.com/pgap22/muo/tree/main/includes"
    click H "https://github.com/pgap22/muo/blob/main/dbMostRecent.sql"

    classDef client fill:#f5f,stroke:#333,stroke-width:2px
    classDef ui fill:#bbf,stroke:#333,stroke-width:2px
    classDef api fill:#cfc,stroke:#333,stroke-width:2px
    classDef auth fill:#ff9,stroke:#333,stroke-width:2px
    classDef logic fill:#fc9,stroke:#333,stroke-width:2px
    classDef includes fill:#ddd,stroke:#333,stroke-width:2px
    classDef database fill:#fcc,stroke:#333,stroke-width:2px
```
