# xxpakogamer10xx/prueba architecture

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

- Interactive diagram: https://gitdiagram.com/xxpakogamer10xx/prueba
- Repository: https://github.com/xxpakogamer10xx/prueba

## Overview

##### Project type and purpose
- This is a full-stack, modular ERP web application built on Laravel 11.
- Purpose: Centralized management for clinical operations with three domain modules:
- Ginecología (patient records, surgical planning, materials)
- Odontología (inventory, consumables, lab requests)
- Servicios (equipment inventory, maintenance, decommission workflow)

##### File structure
- Top-level directory: Laravel MVC scaffold plus Livewire components.
- app/Http/Controllers: MVC controllers grouped by domain (Auth, Ginecologia, Servicios).
- app/Livewire: Reactive UI components mapped to domain modules.
- app/Models: Eloquent models by domain.
- resources/views: Blade views and Livewire templates organized per module.
- config, database/migrations & seeders: DB schema and environment setups.
- public, resources/js/css: Front-end assets with Vite, Tailwind CSS, Alpine.js.
- CI/CD: .github/workflows (tests, lint).

##### Key insights from README
- Uses MVC + Livewire 3 for reactive components.
- Middleware for RBAC (CheckRole).
- Eloquent ORM with migrations for MySQL/Postgres/SQLite.
- Test suite with Pest & PHPUnit.
- CI via GitHub Actions; linting via Laravel Pint.

##### Main components
a. Presentation Layer (Client)
- Browser running HTML/CSS/JS (Tailwind + Alpine.js).
- Livewire websocket/Ajax channel for dynamic updates.
b. Web Tier
- Nginx/Apache → PHP-FPM container or process.
- Laravel app entry point (public/index.php).
- Route layer (routes/web.php, routes/auth.php).
- Middleware (auth, RBAC).
- Controllers (app/Http/Controllers).
- Livewire components (app/Livewire).
c. Domain Modules (inside Laravel)
- Ginecologia, Odontologia, Servicios packages:
– Eloquent Models (app/Models/…).
– Business logic in Controllers & Services.
– Blade views & Livewire templates.
d. Data Tier
- Relational Database (MySQL/PostgreSQL) hosting tables for each domain.
- Redis (optional) for cache, session, queues.
- File storage (local or S3) for uploads.
e. Background Jobs & Queues
- Laravel Queue with workers processing maintenance tasks, email notifications.
f. External Services
- Email provider (SMTP, Mailgun, SES).
- GitHub Actions for CI/CD.

##### Relationships & interactions
- Browser ←→ Laravel via HTTP and Livewire channels (Ajax/WebSockets).
- Controllers livewire callbacks invoke Model→Migration→Database.
- Controllers dispatch Jobs to Queue and publish to Redis.
- Laravel Scheduler (cron) triggers periodic maintenance.
- CI/CD pipelines pull code, run lint/tests, deploy to staging/production.

##### Architectural patterns & principles
- MVC with clear separation of Models, Views (Blade + Livewire), Controllers.
- Modular domain design: each clinical domain in its own namespace.
- Reactive components via Livewire reduce front-end JS complexity.
- RBAC enforced through middleware.
- Infrastructure as code implied by Vite config, GitHub workflows.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Browser["Browser"]:::frontend
        PublicIndex["public/index.php"]:::frontend
        CSS["resources/css/app.css"]:::frontend
        JSApp["resources/js/app.js"]:::frontend
        JSBootstrap["resources/js/bootstrap.js"]:::frontend
        ViteConfig["vite.config.js"]:::frontend
        ViewsLayouts["resources/views/components/layouts"]:::frontend
        ViewsDomains["resources/views/{ginecologia,odontologia,servicios}"]:::frontend
    end

    Browser -->|HTTP| PublicIndex
    PublicIndex -->|serves| CSS
    PublicIndex -->|serves| JSApp
    PublicIndex -->|serves| JSBootstrap
    PublicIndex -->|bundled by| ViteConfig
    PublicIndex -->|renders| ViewsLayouts
    PublicIndex -->|renders| ViewsDomains

    %% Web Tier
    subgraph "Web Tier"
        direction TB
        Nginx["Nginx/Apache"]:::app
        PHPFPM["PHP-FPM"]:::app
        Routes["routes/web.php\nroutes/auth.php\nroutes/console.php"]:::app
        Middleware["app/Http/Middleware/CheckRole.php"]:::app
        ControllerBase["app/Http/Controllers/Controller.php"]:::app
        AuthController["app/Http/Controllers/Auth/VerifyEmailController.php"]:::app
        GineControllers["app/Http/Controllers/Ginecologia/*.php"]:::app
        ServControllers["app/Http/Controllers/Servicios/*.php"]:::app
        LivewireAuth["app/Livewire/Actions/Logout.php"]:::app
        LivewireOdonto["app/Livewire/Odontologia/*.php"]:::app
        LivewireServ["app/Livewire/Servicios/*.php"]:::app
        LivewireViews["resources/views/livewire/{auth,odontologia,servicios}"]:::app
    end

    PublicIndex -->|HTTP| Nginx
    Nginx -->|FastCGI| PHPFPM
    PHPFPM -->|bootstrap| Routes
    Routes -->|apply| Middleware
    Middleware -->|calls| ControllerBase
    ControllerBase -->|extends| AuthController
    ControllerBase -->|extends| GineControllers
    ControllerBase -->|extends| ServControllers
    ControllerBase -->|uses| LivewireAuth
    ControllerBase -->|uses| LivewireOdonto
    ControllerBase -->|uses| LivewireServ
    LivewireAuth --> LivewireViews
    LivewireOdonto --> LivewireViews
    LivewireServ --> LivewireViews

    %% Domain Models
    subgraph "Domain Models" 
        direction TB
        GineModels["app/Models/Ginecologia/*.php"]:::app
        OdontoModels["app/Models/Odontologia/*.php"]:::app
        ServModels["app/Models/Servicios/*.php"]:::app
        UserModel["app/Models/User.php"]:::app
    end

    GineControllers -->|CRUD| GineModels
    ServControllers -->|CRUD| ServModels
    LivewireOdonto -->|CRUD| OdontoModels
    ControllerBase -->|Auth| UserModel

    %% Data Tier
    subgraph "Data & External"
        direction TB
        DB["Relational DB\n(MySQL/PostgreSQL)"]:::datastore
        Redis["Redis Cache/Queue"]:::datastore
        Storage["File Storage\n(local/S3)"]:::datastore
        DBConfig["config/database.php\nconfig/cache.php"]:::datastore
        SessionQueueConfig["config/session.php\nconfig/queue.php"]:::datastore
        Migrations["database/migrations"]:::datastore
        Seeders["database/seeders/DatabaseSeeder.php"]:::datastore
        Factories["database/factories/UserFactory.php"]:::datastore
        JobsMigration["database/migrations/0001_01_01_000002_create_jobs_table.php"]:::datastore
        MailConfig["config/mail.php"]:::datastore
        FilesystemsConfig["config/filesystems.php"]:::datastore
        CI_Lint[".github/workflows/lint.yml"]:::external
        CI_Tests[".github/workflows/tests.yml"]:::external
        TestsConfig["phpunit.xml\ntests/Pest.php"]:::external
        FeatureTests["tests/Feature"]:::external
        UnitTests["tests/Unit"]:::external
        EmailService["SMTP/Mailgun/SES"]:::external
    end

    ControllerBase -->|SQL| DB
    GineModels -->|SQL| DB
    OdontoModels -->|SQL| DB
    ServModels -->|SQL| DB
    ControllerBase -->|cache read/write| Redis
    ControllerBase -->|dispatch jobs| Redis
    JobsMigration -->|defines| Redis
    LaravelScheduler["Scheduler (cron)"]:::app
    LaravelScheduler -->|triggers| ControllerBase
    ControllerBase -->|store files| Storage

    CI_Lint -->|runs| TestsConfig
    CI_Tests -->|runs| FeatureTests
    CI_Tests -->|runs| UnitTests
    CI_Lint --- CI_Tests
    CI_Lint --> CI_Tests
    CI_Lint -->|configures| MailConfig

    EmailService -->|SMTP| ControllerBase

    %% Click Events
    click PublicIndex "https://github.com/xxpakogamer10xx/prueba/blob/main/public/index.php"
    click CSS "https://github.com/xxpakogamer10xx/prueba/blob/main/resources/css/app.css"
    click JSApp "https://github.com/xxpakogamer10xx/prueba/blob/main/resources/js/app.js"
    click JSBootstrap "https://github.com/xxpakogamer10xx/prueba/blob/main/resources/js/bootstrap.js"
    click ViteConfig "https://github.com/xxpakogamer10xx/prueba/blob/main/vite.config.js"
    click ViewsLayouts "https://github.com/xxpakogamer10xx/prueba/blob/main/resources/views/components/layouts/app.blade.php"
    click ViewsLayouts "https://github.com/xxpakogamer10xx/prueba/blob/main/resources/views/components/layouts/ginecologia/nav-ginecologia.blade.php"
    click ViewsLayouts "https://github.com/xxpakogamer10xx/prueba/blob/main/resources/views/components/layouts/odontologia/navbar.blade.php"
    click ViewsLayouts "https://github.com/xxpakogamer10xx/prueba/blob/main/resources/views/components/layouts/servicios/nav-servicios.blade.php"
    click ViewsDomains "https://github.com/xxpakogamer10xx/prueba/tree/main/resources/views/ginecologia"
    click ViewsDomains "https://github.com/xxpakogamer10xx/prueba/tree/main/resources/views/odontologia"
    click ViewsDomains "https://github.com/xxpakogamer10xx/prueba/tree/main/resources/views/servicios"
    click Nginx "https://github.com/xxpakogamer10xx/prueba/blob/main/routes/web.php"
    click Routes "https://github.com/xxpakogamer10xx/prueba/blob/main/routes/auth.php"
    click Routes "https://github.com/xxpakogamer10xx/prueba/blob/main/routes/console.php"
    click Middleware "https://github.com/xxpakogamer10xx/prueba/blob/main/app/Http/Middleware/CheckRole.php"
    click ControllerBase "https://github.com/xxpakogamer10xx/prueba/blob/main/app/Http/Controllers/Controller.php"
    click AuthController "https://github.com/xxpakogamer10xx/prueba/blob/main/app/Http/Controllers/Auth/VerifyEmailController.php"
    click GineControllers "https://github.com/xxpakogamer10xx/prueba/tree/main/app/Http/Controllers/Ginecologia"
    click ServControllers "https://github.com/xxpakogamer10xx/prueba/tree/main/app/Http/Controllers/Servicios"
    click LivewireAuth "https://github.com/xxpakogamer10xx/prueba/blob/main/app/Livewire/Actions/Logout.php"
    click LivewireOdonto "https://github.com/xxpakogamer10xx/prueba/tree/main/app/Livewire/Odontologia"
    click LivewireServ "https://github.com/xxpakogamer10xx/prueba/tree/main/app/Livewire/Servicios"
    click LivewireViews "https://github.com/xxpakogamer10xx/prueba/tree/main/resources/views/livewire/auth"
    click LivewireViews "https://github.com/xxpakogamer10xx/prueba/tree/main/resources/views/livewire/odontologia"
    click LivewireViews "https://github.com/xxpakogamer10xx/prueba/tree/main/resources/views/livewire/servicios"
    click GineModels "https://github.com/xxpakogamer10xx/prueba/tree/main/app/Models/Ginecologia"
    click OdontoModels "https://github.com/xxpakogamer10xx/prueba/tree/main/app/Models/Odontologia"
    click ServModels "https://github.com/xxpakogamer10xx/prueba/tree/main/app/Models/Servicios"
    click UserModel "https://github.com/xxpakogamer10xx/prueba/blob/main/app/Models/User.php"
    click DBConfig "https://github.com/xxpakogamer10xx/prueba/blob/main/config/database.php"
    click DBConfig "https://github.com/xxpakogamer10xx/prueba/blob/main/config/cache.php"
    click SessionQueueConfig "https://github.com/xxpakogamer10xx/prueba/blob/main/config/session.php"
    click SessionQueueConfig "https://github.com/xxpakogamer10xx/prueba/blob/main/config/queue.php"
    click Migrations "https://github.com/xxpakogamer10xx/prueba/tree/main/database/migrations"
    click Seeders "https://github.com/xxpakogamer10xx/prueba/blob/main/database/seeders/DatabaseSeeder.php"
    click Factories "https://github.com/xxpakogamer10xx/prueba/blob/main/database/factories/UserFactory.php"
    click JobsMigration "https://github.com/xxpakogamer10xx/prueba/blob/main/database/migrations/0001_01_01_000002_create_jobs_table.php"
    click MailConfig "https://github.com/xxpakogamer10xx/prueba/blob/main/config/mail.php"
    click FilesystemsConfig "https://github.com/xxpakogamer10xx/prueba/blob/main/config/filesystems.php"
    click CI_Lint "https://github.com/xxpakogamer10xx/prueba/blob/main/.github/workflows/lint.yml"
    click CI_Tests "https://github.com/xxpakogamer10xx/prueba/blob/main/.github/workflows/tests.yml"
    click TestsConfig "https://github.com/xxpakogamer10xx/prueba/blob/main/phpunit.xml"
    click TestsConfig "https://github.com/xxpakogamer10xx/prueba/blob/main/tests/Pest.php"
    click FeatureTests "https://github.com/xxpakogamer10xx/prueba/tree/main/tests/Feature"
    click UnitTests "https://github.com/xxpakogamer10xx/prueba/tree/main/tests/Unit"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#006064,color:#006064
    classDef app fill:#E8F5E9,stroke:#2E7D32,color:#2E7D32
    classDef datastore fill:#FFF3E0,stroke:#EF6C00,color:#EF6C00
    classDef external fill:#ECEFF1,stroke:#607D8B,color:#607D8B
```
