# elihjz/bienesraicesmvc architecture

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

- Interactive diagram: https://gitdiagram.com/elihjz/bienesraicesmvc
- Repository: https://github.com/elihjz/bienesraicesmvc

## Overview

##### Main Components
- Front Controller & Routing – The project features a central "Router.php" (and likely public/index.php) that acts as the entry point to the application. It directs incoming HTTP requests to the appropriate controllers.
- Controllers – The "controllers" directory contains various controllers (e.g., LoginController, PaginasController, PropiedadController, VendedoresController) which handle request processing, application logic, and delegate tasks.
- Models – In the "models" folder, you have classes like ActiveRecord, Admin, Propiedad, and Vendedor; this suggests an ActiveRecord-based approach to interact with the database.
- Views & Templates – The "views" folder (with subdirectories for auth, paginas, propiedades, vendedores) along with the "includes/templates" folder handle presentation. They render the HTML views for the end-user.
- Configuration & Utilities – Files under "includes" (like app.php, config/database.php, funciones.php) provide bootstrapping, configuration, and common functions.
- Frontend Asset Pipeline – The "src" folder (with SCSS, JS, images) and accompanying gulpfile.js indicate the use of Gulp for processing assets (CSS, JS) which are then outputted to "public/build".
- External Dependencies – The project uses Composer (composer.json, composer.lock) for PHP dependency management (including PHPMailer) and Node (package.json, package-lock.json) for frontend dependencies.

##### Relationships and Data Flow
- Controllers interact with Models (using ActiveRecord patterns) to retrieve or modify data, and then pass data to the Views.
- Views pull templated fragments from the "includes/templates" to build the final output.
- Meanwhile, configuration and utility functions (from includes/) support these operations.
- Asset pipeline flow: source files in "src" are transformed (via Gulp tasks as specified in gulpfile.js) into production-ready files in "public/build" (CSS, JS, images).
- External services such as the database (configured in includes/config/database.php) and the mailing service (PHPMailer via Composer) should be included as connected components.

##### Architectural Patterns and Technologies
- MVC Pattern – Clearly separate the Model (data), View (presentation), and Controller (logic) layers.
- ActiveRecord – Use of an ActiveRecord class indicates dynamic interaction with the database.
- Asset Management – The use of Gulp and a clear division between source (src) and build (public/build) assets.
- PHP Dependency Management – Composer for managing libraries (like PHPMailer) and ensuring dependencies are properly injected.
- Frontend Assets – SCSS and modern JavaScript (located in the src directory) indicate modern web practices.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Client Browser"]:::client

    subgraph "Front Controller & Routing"
        B["Entry Point"]:::routing
        C["Router"]:::routing
    end

    subgraph "Controllers"
        D["Login Controller"]:::controller
        E["Pages Controller"]:::controller
        F["Property Controller"]:::controller
        G["Seller Controller"]:::controller
    end

    subgraph "Models"
        H["ActiveRecord Model"]:::model
        I["Admin Model"]:::model
        J["Property Model"]:::model
        K["Seller Model"]:::model
    end

    subgraph "Views & Templates"
        L["Views"]:::view
        M["Templates"]:::view
    end

    subgraph "Configuration & Utilities"
        N["App Config"]:::config
        O["Database Config"]:::config
        P["Utility Functions"]:::config
    end

    subgraph "Asset Pipeline"
        Q["Source Assets"]:::asset
        R["Gulp Tasks"]:::asset
        S["Build Assets"]:::asset
    end

    subgraph "External Dependencies"
        T["Composer File"]:::ext
        U["Composer Lock"]:::ext
        V["Package File"]:::ext
        W["Package Lock"]:::ext
        X["Vendor Directory"]:::ext
    end

    Y["Database Server"]:::ext
    Z["Mail Service (PHPMailer)"]:::ext

    %% Data Flow Connections
    A --> B
    B --> C
    C --> D
    C --> E
    C --> F
    C --> G

    %% Controllers interact with Models
    D --> H
    D --> I
    D --> J
    D --> K
    E --> H
    E --> I
    E --> J
    E --> K
    F --> H
    F --> I
    F --> J
    F --> K
    G --> H
    G --> I
    G --> J
    G --> K

    %% Controllers render Views
    D --> L
    E --> L
    F --> L
    G --> L

    %% Views use Templates
    L --> M

    %% Configuration supports Controllers and Models
    N --- D
    N --- E
    P --- D
    P --- E
    P --- F
    P --- G
    O --- H
    O --- I
    O --- J
    O --- K

    %% Asset Pipeline flow
    Q --> S
    R --> S
    S --> L

    %% External Dependencies connect to configuration and asset tasks
    T --> N
    U --> N
    V --> R
    W --> R
    X --> N

    %% Models connect to external Database
    H --> Y
    I --> Y
    J --> Y
    K --> Y

    %% Controllers use external Mail Service
    D --> Z
    E --> Z
    F --> Z
    G --> Z

    %% Class Definitions
    classDef client fill:#f9c74f,stroke:#000,stroke-width:1px;
    classDef routing fill:#90be6d,stroke:#000,stroke-width:1px;
    classDef controller fill:#f9844a,stroke:#000,stroke-width:1px;
    classDef model fill:#f94144,stroke:#000,stroke-width:1px;
    classDef view fill:#577590,stroke:#000,stroke-width:1px;
    classDef config fill:#f8961e,stroke:#000,stroke-width:1px;
    classDef asset fill:#277da1,stroke:#000,stroke-width:1px;
    classDef ext fill:#7209b7,stroke:#000,stroke-width:1px;

    %% Click Events for Front Controller & Routing
    click B "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/public/index.php"
    click C "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/Router.php"

    %% Click Events for Controllers
    click D "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/controllers/LoginController.php"
    click E "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/controllers/PaginasController.php"
    click F "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/controllers/PropiedadController.php"
    click G "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/controllers/VendedoresController.php"

    %% Click Events for Models
    click H "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/models/ActiveRecord.php"
    click I "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/models/Admin.php"
    click J "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/models/Propiedad.php"
    click K "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/models/Vendedor.php"

    %% Click Events for Views & Templates
    click L "https://github.com/elihjz/bienesraicesmvc/tree/mmainmvc/views"
    click M "https://github.com/elihjz/bienesraicesmvc/tree/mmainmvc/includes/templates"

    %% Click Events for Configuration & Utilities
    click N "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/includes/app.php"
    click O "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/includes/config/database.php"
    click P "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/includes/funciones.php"

    %% Click Events for Asset Pipeline
    click Q "https://github.com/elihjz/bienesraicesmvc/tree/mmainmvc/src"
    click R "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/gulpfile.js"
    click S "https://github.com/elihjz/bienesraicesmvc/tree/mmainmvc/public/build"

    %% Click Events for External Dependencies
    click T "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/composer.json"
    click U "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/composer.lock"
    click V "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/package.json"
    click W "https://github.com/elihjz/bienesraicesmvc/blob/mmainmvc/package-lock.json"
    click X "https://github.com/elihjz/bienesraicesmvc/tree/mmainmvc/vendor"
```
