# manuelrisco/sistema-notificaciones-test architecture

> Architecture diagram of the GitHub repository manuelrisco/sistema-notificaciones-test, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manuelrisco/sistema-notificaciones-test
- Repository: https://github.com/manuelrisco/sistema-notificaciones-test

## Overview

This is a PHP stock-alert and notification system, with a web interface for managing stock thresholds and a scheduled/manual process that evaluates inventory and emails grouped alerts. The principal alert path is the scheduled processor, which coordinates stock evaluation, persistence, and email delivery; the web path also supports authenticated inventory configuration and manual execution. The README lists dependencies but does not document capabilities, so web relationships are included only where the source index or excerpts support them; unsampled route internals are represented cautiously.

Main entry points: [`public/seguridad.php`](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/seguridad.php) (Session and CSRF), [`bin/procesar_alertas.php`](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/bin/procesar_alertas.php) (Alert runner), [`src/StockNotificationService.php`](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/src/StockNotificationService.php) (Notification coordinator), [`src/StockRepository.php`](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/src/StockRepository.php) (Stock repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web management"]
  node_web_ui["Inventory dashboard<br/>[index.php]"]
  node_auth_routes["Authentication<br/>[autenticacion.php]"]
  node_web_security["Session and CSRF<br/>[seguridad.php]"]
  node_login["Login<br/>[login.php]"]
  node_logout["Logout<br/>[logout.php]"]
  node_create_config["Create threshold<br/>[crear.php]"]
  node_edit_config["Edit threshold<br/>[editar.php]"]
  node_article_lookup["Article lookup"]
  node_toggle_state["Toggle availability<br/>[cambiar_estado.php]"]
  node_manual_run["Manual execution"]
end

subgraph group_alert["Alert processing"]
  node_alert_runner["Alert runner"]
  node_notification["Notification coordinator"]
  node_evaluate["Stock evaluation"]
end

subgraph group_infra["Persistence and delivery"]
  node_repository["Stock repository"]
  node_database_config["SQL connection<br/>[database.php]"]
  node_sqlserver[("SQL Server")]
  node_email["Email service<br/>[EmailService.php]"]
  node_smtp["SMTP server"]
end

node_operator(("Operator"))
node_scheduler(("Scheduler"))

node_operator -->|"uses"| node_web_ui
node_web_ui -->|"loads"| node_web_security
node_web_security -->|"requires auth"| node_auth_routes
node_operator -.->|"signs in"| node_login
node_operator -.->|"signs out"| node_logout
node_operator -.->|"sets threshold"| node_create_config
node_operator -.->|"edits threshold"| node_edit_config
node_operator -.->|"searches catalog"| node_article_lookup
node_operator -.->|"changes state"| node_toggle_state
node_operator -.->|"runs alerts"| node_manual_run
node_login -->|"loads"| node_web_security
node_logout -->|"loads"| node_web_security
node_create_config -->|"loads"| node_web_security
node_edit_config -->|"loads"| node_web_security
node_article_lookup -->|"loads"| node_web_security
node_toggle_state -->|"loads"| node_web_security
node_manual_run -->|"loads"| node_web_security
node_scheduler -.->|"invokes"| node_alert_runner
node_operator -.->|"invokes manually"| node_alert_runner
node_alert_runner -->|"loads connection"| node_database_config
node_database_config -.->|"connects"| node_sqlserver
node_alert_runner -->|"constructs"| node_repository
node_alert_runner -->|"constructs"| node_evaluate
node_alert_runner -->|"constructs"| node_email
node_alert_runner -.->|"invokes"| node_notification
node_notification -->|"processes through"| node_evaluate
node_evaluate -->|"reads and updates"| node_repository
node_notification -->|"sends alerts"| node_email
node_notification -->|"marks sent"| node_repository
node_repository -.->|"queries and writes"| node_sqlserver
node_email -.->|"delivers mail"| node_smtp

click node_web_ui "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/index.php"
click node_auth_routes "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/autenticacion.php"
click node_web_security "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/seguridad.php"
click node_login "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/login.php"
click node_logout "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/logout.php"
click node_create_config "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/crear.php"
click node_edit_config "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/editar.php"
click node_article_lookup "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/consultar_articulo.php"
click node_toggle_state "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/cambiar_estado.php"
click node_manual_run "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/ejecutar_manual.php"
click node_alert_runner "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/bin/procesar_alertas.php"
click node_notification "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/src/StockNotificationService.php"
click node_evaluate "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/src/StockAlertService.php"
click node_repository "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/src/StockRepository.php"
click node_database_config "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/config/database.php"
click node_email "https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/src/EmailService.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_ui,node_auth_routes,node_web_security,node_login,node_logout,node_create_config,node_edit_config,node_article_lookup,node_toggle_state,node_manual_run toneBlue
class node_alert_runner,node_notification,node_evaluate toneAmber
class node_repository,node_database_config,node_sqlserver,node_email,node_smtp toneMint
class node_operator toneIndigo
class node_scheduler toneRose
```

## Components

### Web management

- [Inventory dashboard](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/index.php): `public/index.php`
- [Authentication](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/autenticacion.php): `public/autenticacion.php`
- [Session and CSRF](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/seguridad.php): `public/seguridad.php`
- [Login](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/login.php): `public/login.php`
- [Logout](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/logout.php): `public/logout.php`
- [Create threshold](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/crear.php): `public/crear.php`
- [Edit threshold](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/editar.php): `public/editar.php`
- [Article lookup](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/consultar_articulo.php): `public/consultar_articulo.php`
- [Toggle availability](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/cambiar_estado.php): `public/cambiar_estado.php`
- [Manual execution](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/public/ejecutar_manual.php): `public/ejecutar_manual.php`

### Alert processing

- [Alert runner](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/bin/procesar_alertas.php): `bin/procesar_alertas.php`
- [Notification coordinator](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/src/StockNotificationService.php): `src/StockNotificationService.php`
- [Stock evaluation](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/src/StockAlertService.php): `src/StockAlertService.php`

### Persistence and delivery

- [Stock repository](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/src/StockRepository.php): `src/StockRepository.php`
- [SQL connection](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/config/database.php): `config/database.php`
- **SQL Server**
- [Email service](https://github.com/manuelrisco/sistema-notificaciones-test/blob/main/src/EmailService.php): `src/EmailService.php`
- **SMTP server**

### Other components

- **Operator**
- **Scheduler**

## Connections

- Operator → Inventory dashboard: uses (evidence: `public/index.php`)
- Inventory dashboard → Session and CSRF: loads (evidence: `public/index.php`)
- Session and CSRF → Authentication: requires auth (evidence: `public/seguridad.php`)
- Operator → Login: signs in
- Operator → Logout: signs out
- Operator → Create threshold: sets threshold
- Operator → Edit threshold: edits threshold
- Operator → Article lookup: searches catalog
- Operator → Toggle availability: changes state
- Operator → Manual execution: runs alerts
- Login → Session and CSRF: loads (evidence: `public/login.php`)
- Logout → Session and CSRF: loads (evidence: `public/logout.php`)
- Create threshold → Session and CSRF: loads (evidence: `public/crear.php`)
- Edit threshold → Session and CSRF: loads (evidence: `public/editar.php`)
- Article lookup → Session and CSRF: loads (evidence: `public/consultar_articulo.php`)
- Toggle availability → Session and CSRF: loads (evidence: `public/cambiar_estado.php`)
- Manual execution → Session and CSRF: loads (evidence: `public/ejecutar_manual.php`)
- Scheduler → Alert runner: invokes
- Operator → Alert runner: invokes manually
- Alert runner → SQL connection: loads connection (evidence: `bin/procesar_alertas.php`)
- SQL connection → SQL Server: connects
- Alert runner → Stock repository: constructs (evidence: `bin/procesar_alertas.php`)
- Alert runner → Stock evaluation: constructs (evidence: `bin/procesar_alertas.php`)
- Alert runner → Email service: constructs (evidence: `bin/procesar_alertas.php`)
- Alert runner → Notification coordinator: invokes (evidence: `bin/procesar_alertas.php`)
- Notification coordinator → Stock evaluation: processes through (evidence: `src/StockNotificationService.php`)
- Stock evaluation → Stock repository: reads and updates (evidence: `src/StockAlertService.php`)
- Notification coordinator → Email service: sends alerts (evidence: `src/StockNotificationService.php`)
- Notification coordinator → Stock repository: marks sent (evidence: `src/StockNotificationService.php`)
- Stock repository → SQL Server: queries and writes
- Email service → SMTP server: delivers mail
