# azufrecs/alertas_public architecture

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

- Interactive diagram: https://gitdiagram.com/azufrecs/alertas_public
- Repository: https://github.com/azufrecs/alertas_public

## Overview

##### Project type and purpose
- This is a lightweight full-stack PHP web application whose primary role is to collect or receive alerts from Squid and e2Guardian proxy servers and dispatch email notifications.
- The README (“Alertas desde squid y e2guardian”) confirms the goal: process proxy-generated alerts and send out emails.

##### File structure
- Top-level PHP entry points:
- index.php (likely the web UI or dashboard)
- alerta.php (the alert-processing script)
- class/ : contains PHPMailer & SMTP helper classes
- css/, js/, img/ : static assets for the front-end (Bootstrap, jQuery, custom styles and scripts)
- text/: HTML templates for email body or rule/code descriptions
- View: index.php + static assets
- Controller: alerta.php
- Model: text templates + any configuration/settings embedded in PHP

##### Diagramming recommendations
- “Squid/e2Guardian”
- “Web Server + PHP” (annotation: index.php, alerta.php)
- “PHPMailer Module”
- “SMTP Server”
- “Browser (UI)”
- Proxy → alerta.php
- alerta.php → PHPMailer → SMTP
- Browser ↔ Web Server
- Front-end assets (CSS/JS/index.php) in another
- Back-end logic (alerta.php + class/) in a third
- Interactions (e.g., “HTTP POST alert”, “SMTP SEND”, “HTTP GET UI”).

##### Essential details
- Template directory (text/) as part of the email generation sub-component.
- Static asset delivery (css/, js/, img/) as part of the Web Server’s responsibilities.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "External Systems"
        Proxy["Squid / e2Guardian"]:::external
        SMTP["SMTP Server"]:::external
    end

    subgraph "Frontend Layer"
        Browser["Browser (UI)"]:::frontend
        UI["index.php"]:::frontend
        Assets_css["css/"]:::frontend
        Assets_js["js/"]:::frontend
        Assets_img["img/"]:::frontend
    end

    subgraph "Backend Layer"
        Processor["alerta.php"]:::backend
    end

    subgraph "Library & Templates"
        PHPMailerCore["class.phpmailer.php"]:::library
        PHPMailersmtp["class.smtp.php"]:::library
        Template1["code.html"]:::template
        Template2["rule.html"]:::template
    end

    Proxy -->|"HTTP POST alert"| Processor
    Browser -->|"HTTP GET UI"| UI
    UI -->|"serves static"| Assets_css
    UI --> Assets_js
    UI --> Assets_img
    Processor -->|"load template"| Template1
    Processor --> Template2
    Processor -->|"invoke mailer"| PHPMailerCore
    PHPMailerCore --> PHPMailersmtp
    PHPMailersmtp -->|"SMTP SEND"| SMTP

    click UI "https://github.com/azufrecs/alertas_public/blob/master/index.php"
    click Processor "https://github.com/azufrecs/alertas_public/blob/master/alerta.php"
    click PHPMailerCore "https://github.com/azufrecs/alertas_public/blob/master/class/class.phpmailer.php"
    click PHPMailersmtp "https://github.com/azufrecs/alertas_public/blob/master/class/class.smtp.php"
    click Template1 "https://github.com/azufrecs/alertas_public/blob/master/text/code.html"
    click Template2 "https://github.com/azufrecs/alertas_public/blob/master/text/rule.html"
    click Assets_css "https://github.com/azufrecs/alertas_public/tree/master/css/"
    click Assets_js "https://github.com/azufrecs/alertas_public/tree/master/js/"
    click Assets_img "https://github.com/azufrecs/alertas_public/tree/master/img/"

    classDef external fill:#fde2e2,stroke:#d6336c,stroke-width:2px;
    classDef frontend fill:#e7f5ff,stroke:#339af0,stroke-width:2px;
    classDef backend fill:#e6fcf5,stroke:#20c997,stroke-width:2px;
    classDef library fill:#fff3bf,stroke:#ff922b,stroke-width:2px;
    classDef template fill:#f8f9fa,stroke:#adb5bd,stroke-width:2px;
```
