# alejo9009/sets architecture

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

- Interactive diagram: https://gitdiagram.com/alejo9009/sets
- Repository: https://github.com/alejo9009/sets

## Overview

##### Project Type and Purpose
- This is a monolithic, full-stack web application for community facility management (admin, resident, security guard portals), built on a PHP MVC backend with multiple role-specific views and a separate modern React front-end under VIEW/frontend. It uses a relational database (MySQL) and serves both server-rendered pages and a SPA.

##### File-Structure Analysis
- Top-level MVC separation:
- CONTROLLER/: PHP scripts handling requests and routing to business logic.
- MODEL/: PHP classes and scripts for data access, business rules, backend auth, password recovery, user management, plus SQL “sets” for schema.
- VIEW/: Role-based UI layers—subdirectories for admin, residente, seguridad—each containing PHP views, CSS, JS, chat endpoints and uploads. Also VIEW/frontend/ holds a React SPA (package.json, public/, src/).
- Configuration and assets:
- Shared DB connection scripts (MODEL/conexion.php, CONTROLLER/conexion.php, VIEW/*/conexion.php).
- SQL seed files (sets (1).sql, sets (19).sql, etc.).
- Static media under img/ and VIEW/*/img/ for MP4 assets.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients
    subgraph "Clients" 
        direction TB
        BrowserAdmin["Browser (Admin, Resident, Security)"]:::client
        SPAClient["React SPA"]:::frontend
    end

    %% Server
    subgraph "Web Server / PHP Runtime" 
        direction TB
        subgraph "MVC Controller Layer"
            direction TB
            Controllers["PHP Controllers (CONTROLLER/)"]:::backend
        end
        subgraph "Business Logic / Models"
            direction TB
            Models["PHP Models (MODEL/)"]:::backend
        end
        subgraph "View Layer"
            direction TB
            subgraph "Admin Portal Views"
                VIEWAdmin["VIEW/admin/"]:::view
            end
            subgraph "Resident Portal Views"
                VIEWResidente["VIEW/residente/"]:::view
            end
            subgraph "Security Portal Views"
                VIEWSeguridad["VIEW/seguridad/"]:::view
            end
            subgraph "React SPA Front-End"
                VIEWFrontend["VIEW/frontend/"]:::frontend
            end
        end
        StaticAssets["Static Media Store (img/, VIEW/*/img/, uploads)"]:::storage
    end

    %% Data Storage
    Database["MySQL Database"]:::database
    FileStorage["File Storage (uploads, media)"]:::storage

    %% Connections
    BrowserAdmin -->|"HTTP(S) Requests"| Controllers
    SPAClient -->|"REST API Calls"| Controllers
    Controllers -->|"invoke"| Models
    Controllers -->|"render HTML"| VIEWAdmin
    Controllers -->|"render HTML"| VIEWResidente
    Controllers -->|"render HTML"| VIEWSeguridad
    Controllers -->|"return JSON"| VIEWFrontend
    Models -->|"SQL Queries"| Database
    Controllers -->|"store/retrieve files"| FileStorage
    VIEWFrontend -->|"serves static assets"| StaticAssets

    %% Click Events
    click Controllers "https://github.com/alejo9009/sets/tree/main/CONTROLLER/"
    click Models "https://github.com/alejo9009/sets/tree/main/MODEL/"
    click VIEWAdmin "https://github.com/alejo9009/sets/tree/main/VIEW/admin/"
    click VIEWResidente "https://github.com/alejo9009/sets/tree/main/VIEW/residente/"
    click VIEWSeguridad "https://github.com/alejo9009/sets/tree/main/VIEW/seguridad/"
    click VIEWFrontend "https://github.com/alejo9009/sets/tree/main/VIEW/frontend/"
    click StaticAssets "https://github.com/alejo9009/sets/tree/main/img/"
    click Database "https://github.com/alejo9009/sets/blob/main/MODEL/backend/sets (1).sql"

    %% Styles
    classDef client fill:#FFD966,stroke:#B58900,color:#000000
    classDef frontend fill:#B3DDF2,stroke:#2B7B9E,color:#000000
    classDef backend fill:#F4CCCC,stroke:#CC0000,color:#000000
    classDef view fill:#D9EAD3,stroke:#38761D,color:#000000
    classDef database fill:#C9C9FF,stroke:#000080,color:#000000
    classDef storage fill:#FFE599,stroke:#B06B00,color:#000000
```
