# juanmamtr/bolsatrabajo architecture

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

- Interactive diagram: https://gitdiagram.com/juanmamtr/bolsatrabajo
- Repository: https://github.com/juanmamtr/bolsatrabajo

## Overview

##### Main Components Identification
- Frontend Client: Represented by the React application found in the “src” directory (App.js, components folder, public/index.html, etc.). This client handles user interaction (login, listing users, and other pages).
- API/Backend Server: The PHP backend is located under “src/php”. It includes:
– Authentication components (src/php/authentication/autenticacion.php).
– Configuration and database connection (src/php/configdb.php).
– Controllers (src/php/controller) that implement endpoints for various entities (e.g., c_login.php, c_usuarios.php, c_ciclos.php, etc.).
– Models (src/php/model) performing business logic and data handling.
- Database: The SQL directory contains scripts (database.sql, instalacion.sql) for setting up the underlying database for this application.
- External Libraries & Dependencies: Notably, Firebase JWT integrated via Composer (composer.json, composer.lock) provides JWT authentication. Several vendor files and composer-installed libraries indicate dependency management for PHP.

##### Architectural Patterns & Design Principles
- MVC Pattern on the PHP side is evident: Controllers, Models, and (possibly) Views (even though the frontend is in React, the PHP might output some views or simply serve as an API layer). Label these parts clearly.
- Use of JWT for secure authentication establishes an important security and session management layer.

##### Technologies and Frameworks to Highlight
- React and Create React App (frontend)
- PHP with a custom MVC style (backend)
- Composer for dependency management (including Firebase JWT)
- SQL database (as defined by the SQL scripts)
- Additional design frameworks/tools like Tailwind (tailwind.config.js) used by the frontend, if applicable.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FE_App["App.js"]:::frontend
        FE_Index["index.js"]:::frontend
        FE_Comps["Components"]:::frontend
        FE_Public["Public index.html"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BE_Index["Index.php"]:::backend
        BE_Auth["Authentication (autenticacion.php)"]:::backend
        BE_Config["DB Config (configdb.php)"]:::backend

        subgraph "Controllers"
            BE_C1["c_login.php"]:::backend
            BE_C2["c_usuarios.php"]:::backend
            BE_C3["c_ciclos.php"]:::backend
            BE_C4["c_familiasProfesionales.php"]:::backend
            BE_C5["c_idiomas.php"]:::backend
            BE_C6["c_instalacion.php"]:::backend
        end

        subgraph "Models"
            BE_M1["m_login.php"]:::backend
            BE_M2["m_usuarios.php"]:::backend
            BE_M3["m_ciclos.php"]:::backend
            BE_M4["m_familiasProfesionales.php"]:::backend
            BE_M5["m_idiomas.php"]:::backend
            BE_M6["m_instalacion.php"]:::backend
        end
    end

    %% Database Layer
    subgraph "Database"
        DB1["database.sql"]:::database
        DB2["instalacion.sql"]:::database
        DB3["usuariosPrueba.sql"]:::database
    end

    %% External Dependencies
    subgraph "External Dependencies"
        EX1["composer.json"]:::external
        EX2["composer.lock"]:::external
        EX3["vendor"]:::external
    end

    %% Documentation & Design
    subgraph "Documentation & Design"
        DOC1["PHPDoc"]:::documentation
        DOC2["Design Mockups"]:::documentation
    end

    %% Build & Deployment (Automation Scripts)
    subgraph "Build & Deployment"
        BD1["Build/Deployment Scripts"]:::external
    end

    %% Connections between Frontend and Backend
    FE_Comps -->|"HTTP_Request"| BE_C1
    %% Entry point routing in Backend
    BE_Index --> BE_Auth
    BE_Index --> BE_C1
    %% Controllers call Models
    BE_C1 -->|"calls"| BE_M1
    %% Models interact with Database
    BE_M1 -->|"DB_Query"| DB1
    %% DB Config used by Models (dashed line)
    BE_Config -.->|"configures"| BE_M1
    %% Authentication validates requests at Controller level
    BE_Auth -->|"validates_token"| BE_C1
    %% External Dependencies used by Backend
    EX1 -.-> BE_Auth
    EX2 -.-> BE_M1
    EX3 -.-> BE_Index
    %% Automation scripts trigger Frontend and Backend builds
    BD1 -->|"automates"| FE_Comps
    BD1 -->|"automates"| BE_Index

    %% Class Definitions for color coding
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef backend fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef database fill:#d4edda,stroke:#155724,stroke-width:2px,stroke-dasharray: 4 2;
    classDef external fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef documentation fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;

    %% Click Events for Frontend
    click FE_App "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/App.js"
    click FE_Index "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/index.js"
    click FE_Comps "https://github.com/juanmamtr/bolsatrabajo/tree/master/src/components"
    click FE_Public "https://github.com/juanmamtr/bolsatrabajo/blob/master/public/index.html"

    %% Click Events for Backend
    click BE_Index "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/index.php"
    click BE_Auth "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/authentication/autenticacion.php"
    click BE_Config "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/configdb.php"
    click BE_C1 "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/controller/c_login.php"
    click BE_C2 "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/controller/c_usuarios.php"
    click BE_C3 "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/controller/c_ciclos.php"
    click BE_C4 "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/controller/c_familiasProfesionales.php"
    click BE_C5 "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/controller/c_idiomas.php"
    click BE_C6 "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/controller/c_instalacion.php"
    click BE_M1 "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/model/m_login.php"
    click BE_M2 "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/model/m_usuarios.php"
    click BE_M3 "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/model/m_ciclos.php"
    click BE_M4 "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/model/m_familiasProfesionales.php"
    click BE_M5 "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/model/m_idiomas.php"
    click BE_M6 "https://github.com/juanmamtr/bolsatrabajo/blob/master/src/php/model/m_instalacion.php"

    %% Click Events for Database
    click DB1 "https://github.com/juanmamtr/bolsatrabajo/blob/master/sql/database.sql"
    click DB2 "https://github.com/juanmamtr/bolsatrabajo/blob/master/sql/instalacion.sql"
    click DB3 "https://github.com/juanmamtr/bolsatrabajo/blob/master/sql/usuariosPrueba.sql"

    %% Click Events for External Dependencies
    click EX1 "https://github.com/juanmamtr/bolsatrabajo/blob/master/composer.json"
    click EX2 "https://github.com/juanmamtr/bolsatrabajo/blob/master/composer.lock"
    click EX3 "https://github.com/juanmamtr/bolsatrabajo/tree/master/vendor"

    %% Click Events for Documentation & Design
    click DOC1 "https://github.com/juanmamtr/bolsatrabajo/blob/master/.phpdoc"
    click DOC2 "https://github.com/juanmamtr/bolsatrabajo/tree/master/design/mockups"
```
