# royservillanueva2004/planificati architecture

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

- Interactive diagram: https://gitdiagram.com/royservillanueva2004/planificati
- Repository: https://github.com/royservillanueva2004/planificati

## Overview

##### Project type and purpose
- This is a full-stack web application (“PlanificaTI”) built with Laravel (PHP) following the MVC pattern.
- It supports strategic planning exercises (FODA, Porter’s Five Forces, BCG matrix, CAME, PEST) and user authentication/authorization.

##### Main architectural components
a. Client Layer (Browser)
- HTML/CSS/JS delivered by Blade templates in resources/views
- Assets built by Vite (resources/js, resources/css, tailwind.config.js, postcss.config.js, vite.config.js)
b. Web Server / HTTP Layer
- public/index.php → bootstrap/app.php → routes/web.php & routes/auth.php
- Middleware pipeline (app/Http/Middleware/CheckPlanSelected, auth middleware)
c. Application Layer (Laravel MVC)
- Routing → app/Http/Controllers/*.php (AnalisisFodaController, PestController, Auth controllers, etc.)
- Business logic in Controllers & Form Requests (app/Http/Requests)
- Domain models & persistence via Eloquent (app/Models/*.php)
- Service Providers (app/Providers/AppServiceProvider.php) configure container bindings (e.g., OpenAI client)
d. Data Layer
- Relational database (MySQL/Postgres) defined in config/database.php
- Migrations (database/migrations/*.php) & seeders (database/seeders)
- Queues (database/jobs table) if any background tasks are used
e. External Services
- OpenAI API (config/openai.php, invoked from controllers or services)
- Mail/Queue services (config/mail.php, config/queue.php)

##### Relationships & Data Flows
- Browser → HTTP Request → public/index.php → Middleware → Route → Controller
- Controller ↔ Eloquent Models → Database
- Controller → Blade view → Rendered HTML → Browser
- Asset requests (JS/CSS) served via Vite dev server or compiled assets in public/
- Controller or Service → OpenAI API over HTTPS → results fed back to Controller → View

##### Key architectural patterns & principles
- MVC (Model–View–Controller) separation
- Eloquent ORM for data mapping
- Service Container / Providers for dependency injection (OpenAI client, app services)
- RESTful controllers for each strategic-planning module
- Form Request validation layer (app/Http/Requests)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        Browser["Browser\n(HTML/CSS/JS)"]:::frontend
        Blade["Blade Templates\n(resources/views)"]:::frontend
        JS["App JS\n(resources/js/app.js)"]:::frontend
        CSS["App CSS\n(resources/css/app.css)"]:::frontend
        Tailwind["Tailwind Config\n(tailwind.config.js)"]:::frontend
        PostCSS["PostCSS Config\n(postcss.config.js)"]:::frontend
        ViteConfig["Vite Config\n(vite.config.js)"]:::frontend
    end

    %% Web Server / HTTP Layer
    subgraph "Web Server / HTTP Layer"
        direction TB
        Index["public/index.php"]:::backend
        Bootstrap["bootstrap/app.php"]:::backend
        RoutesWeb["routes/web.php"]:::backend
        RoutesAuth["routes/auth.php"]:::backend
        MiddlewareGroup["Middleware Pipeline"]:::backend
        CheckPlan["CheckPlanSelected"]:::backend
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        Controllers["Controllers"]:::backend
        subgraph "Strategic Modules"
            AnalisisFoda["AnalisisFodaController"]:::backend
            CadenaValor["CadenaValorController"]:::backend
            Porter["FuerzaPorterController"]:::backend
            BCG["MatrizBCGController"]:::backend
            CAME["MatrizCAMEController"]:::backend
            Pest["PestController"]:::backend
            PlanEstrategico["PlanEstrategicoController"]:::backend
            Objetivo["ObjetivoController"]:::backend
        end
        AuthControllers["Auth Controllers"]:::backend
        ProfileCtrl["ProfileController"]:::backend

        Requests["Form Requests"]:::backend
        LoginReq["LoginRequest"]:::backend
        ProfileReq["ProfileUpdateRequest"]:::backend

        Models["Eloquent Models"]:::backend
        subgraph "Domain Models"
            MAnalisisFoda["AnalisisFoda"]:::backend
            MCadenaValor["CadenaValor"]:::backend
            MPorter["FuerzaPorter"]:::backend
            MBCG["MatrizBCG"]:::backend
            MCAME["MatrizCAME"]:::backend
            MPest["Pest"]:::backend
            MPlan["PlanEstrategico"]:::backend
            MObjetivo["Objetivo"]:::backend
            MUser["User"]:::backend
            MIniciativa["Iniciativa"]:::backend
            MMapa["MapaEstrategico"]:::backend
        end

        ServiceProv["AppServiceProvider"]:::backend
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DB[(Database\nMySQL/Postgres)]:::database
        Migrations["Migrations\n(database/migrations/*.php)"]:::database
        Seeder["DatabaseSeeder\n(database/seeders)"]:::database
        Factory["UserFactory\n(database/factories)"]:::database
        Jobs[(Jobs Queue\ndatabase/jobs)]:::database
    end

    %% External Services
    subgraph "External Services"
        direction TB
        OpenAI["OpenAI API"]:::external
        MailSvc["Mail Service"]:::external
        QueueSvc["Queue Backend"]:::external
    end

    %% Flows
    Browser -->|Requests| Index
    Blade -->|Rendered| Browser
    JS -->|Assets| Browser
    CSS -->|Assets| Browser

    Index --> Bootstrap
    Bootstrap --> RoutesWeb
    Bootstrap --> RoutesAuth
    RoutesWeb --> MiddlewareGroup
    RoutesAuth --> MiddlewareGroup
    MiddlewareGroup --> CheckPlan
    CheckPlan --> AnalisisFoda

    Controllers --> AnalisisFoda
    Controllers --> CadenaValor
    Controllers --> Porter
    Controllers --> BCG
    Controllers --> CAME
    Controllers --> Pest
    Controllers --> PlanEstrategico
    Controllers --> Objetivo
    Controllers --> AuthControllers
    Controllers --> ProfileCtrl

    AnalisisFoda -->|GET/POST| MAnalisisFoda
    CadenaValor -->|GET/POST| MCadenaValor
    Porter -->|GET/POST| MPorter
    BCG -->|GET/POST| MBCG
    CAME -->|GET/POST| MCAME
    Pest -->|GET/POST| MPest
    PlanEstrategico -->|GET/POST| MPlan
    Objetivo -->|GET/POST| MObjetivo
    AuthControllers -->|Auth| MUser
    ProfileCtrl -->|GET/POST| MUser

    AnalisisFoda -->|validate| LoginReq
    ProfileCtrl -->|validate| ProfileReq

    Controllers --> DB
    MAnalisisFoda --> DB
    MCadenaValor --> DB
    MPorter --> DB
    MBCG --> DB
    MCAME --> DB
    MPest --> DB
    MPlan --> DB
    MObjetivo --> DB
    MUser --> DB
    MIniciativa --> DB
    MMapa --> DB

    Controllers --> OpenAI
    Controllers --> MailSvc
    Controllers --> QueueSvc

    ServiceProv --> OpenAI
    ServiceProv --> MailSvc
    ServiceProv --> QueueSvc

    %% Click Events
    click Blade "https://github.com/royservillanueva2004/planificati/tree/main/resources/views"
    click JS "https://github.com/royservillanueva2004/planificati/blob/main/resources/js/app.js"
    click CSS "https://github.com/royservillanueva2004/planificati/blob/main/resources/css/app.css"
    click Tailwind "https://github.com/royservillanueva2004/planificati/blob/main/tailwind.config.js"
    click PostCSS "https://github.com/royservillanueva2004/planificati/blob/main/postcss.config.js"
    click ViteConfig "https://github.com/royservillanueva2004/planificati/blob/main/vite.config.js"
    click Index "https://github.com/royservillanueva2004/planificati/blob/main/public/index.php"
    click Bootstrap "https://github.com/royservillanueva2004/planificati/blob/main/bootstrap/app.php"
    click RoutesWeb "https://github.com/royservillanueva2004/planificati/blob/main/routes/web.php"
    click RoutesAuth "https://github.com/royservillanueva2004/planificati/blob/main/routes/auth.php"
    click CheckPlan "https://github.com/royservillanueva2004/planificati/blob/main/app/Http/Middleware/CheckPlanSelected.php"
    click AnalisisFoda "https://github.com/royservillanueva2004/planificati/blob/main/app/Http/Controllers/AnalisisFodaController.php"
    click CadenaValor "https://github.com/royservillanueva2004/planificati/blob/main/app/Http/Controllers/CadenaValorController.php"
    click Porter "https://github.com/royservillanueva2004/planificati/blob/main/app/Http/Controllers/FuerzaPorterController.php"
    click BCG "https://github.com/royservillanueva2004/planificati/blob/main/app/Http/Controllers/MatrizBCGController.php"
    click CAME "https://github.com/royservillanueva2004/planificati/blob/main/app/Http/Controllers/MatrizCAMEController.php"
    click Pest "https://github.com/royservillanueva2004/planificati/blob/main/app/Http/Controllers/PestController.php"
    click PlanEstrategico "https://github.com/royservillanueva2004/planificati/blob/main/app/Http/Controllers/PlanEstrategicoController.php"
    click Objetivo "https://github.com/royservillanueva2004/planificati/blob/main/app/Http/Controllers/ObjetivoController.php"
    click AuthControllers "https://github.com/royservillanueva2004/planificati/tree/main/app/Http/Controllers/Auth"
    click ProfileCtrl "https://github.com/royservillanueva2004/planificati/blob/main/app/Http/Controllers/ProfileController.php"
    click LoginReq "https://github.com/royservillanueva2004/planificati/blob/main/app/Http/Requests/Auth/LoginRequest.php"
    click ProfileReq "https://github.com/royservillanueva2004/planificati/blob/main/app/Http/Requests/ProfileUpdateRequest.php"
    click MAnalisisFoda "https://github.com/royservillanueva2004/planificati/blob/main/app/Models/AnalisisFoda.php"
    click MCadenaValor "https://github.com/royservillanueva2004/planificati/blob/main/app/Models/CadenaValor.php"
    click MPorter "https://github.com/royservillanueva2004/planificati/blob/main/app/Models/FuerzaPorter.php"
    click MBCG "https://github.com/royservillanueva2004/planificati/blob/main/app/Models/MatrizBCG.php"
    click MCAME "https://github.com/royservillanueva2004/planificati/blob/main/app/Models/MatrizCAME.php"
    click MPest "https://github.com/royservillanueva2004/planificati/blob/main/app/Models/Pest.php"
    click MPlan "https://github.com/royservillanueva2004/planificati/blob/main/app/Models/PlanEstrategico.php"
    click MObjetivo "https://github.com/royservillanueva2004/planificati/blob/main/app/Models/Objetivo.php"
    click MUser "https://github.com/royservillanueva2004/planificati/blob/main/app/Models/User.php"
    click MIniciativa "https://github.com/royservillanueva2004/planificati/blob/main/app/Models/Iniciativa.php"
    click MMapa "https://github.com/royservillanueva2004/planificati/blob/main/app/Models/MapaEstrategico.php"
    click ServiceProv "https://github.com/royservillanueva2004/planificati/blob/main/app/Providers/AppServiceProvider.php"
    click Migrations "https://github.com/royservillanueva2004/planificati/tree/main/database/migrations"
    click Seeder "https://github.com/royservillanueva2004/planificati/blob/main/database/seeders/DatabaseSeeder.php"
    click Factory "https://github.com/royservillanueva2004/planificati/blob/main/database/factories/UserFactory.php"
    click OpenAI "https://github.com/royservillanueva2004/planificati/blob/main/config/openai.php"
    click MailSvc "https://github.com/royservillanueva2004/planificati/blob/main/config/mail.php"
    click QueueSvc "https://github.com/royservillanueva2004/planificati/blob/main/config/queue.php"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#2196F3,stroke-width:1px
    classDef backend fill:#E8F5E9,stroke:#4CAF50,stroke-width:1px
    classDef database fill:#FFF3E0,stroke:#FF9800,stroke-width:1px
    classDef external fill:#F3E5F5,stroke:#9C27B0,stroke-width:1px
```
