# clausbackner/parroquiasanagustin architecture

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

- Interactive diagram: https://gitdiagram.com/clausbackner/parroquiasanagustin
- Repository: https://github.com/clausbackner/parroquiasanagustin

## Overview

This repository is a single Laravel monolith for a parish management system. It is server-rendered with Blade views, backed by MySQL, and packaged for local development with Docker Compose.

1. Core domain areas
- The app is organized around parish operations: personas, actas, ceremonias, caja, itinerarios, usuarios/roles, consultas/reportes, and auditoría.
- Each area has its own controller set, views, model(s), and in some cases request validation, policies, and specialized documents.

2. Request handling flow
- HTTP requests enter through `routes/web.php`, then pass through middleware and authorization checks.
- Controllers in `app/Http/Controllers` orchestrate reads/writes, call models, and return Blade views.
- For forms, several modules use dedicated Form Request classes in `app/Http/Requests` to validate create/update operations before persistence.

3. Authentication and account security
- Authentication is built on Laravel Fortify, with custom actions under `app/Actions/Fortify`.
- Security features include two-factor authentication, password confirmation, password reset, and session invalidation on password change.
- Middleware such as `RequiereDosFA`, `SecurityHeaders`, and `EnsureUserHasRole` enforce login/session hardening and access control.

4. Authorization model
- The app uses explicit roles and permissions rather than only default Laravel gates.
- `Role`, `User`, and the pivot/mapping migrations support role assignment and permission linking.
- Policies exist for operational modules like `Caja`, `Ceremonia`, and `Itinerario`, indicating per-resource authorization boundaries.

5. Data persistence and domain models
- Eloquent models represent the main entities: `Persona`, `Acta`, `ActaBautizo`, `ActaMatrimonio`, `Ceremonia`, `MovimientoCaja`, `ItinerarioEvento`, `ItinerarioIntencion`, `AuditLog`, `Role`, and `User`.
- The database schema is evolved through migrations, including later additions for roles, audit logs, two-factor fields, PII expansion, and domain-specific tables.
- Factories and seeders provide initial data and test fixtures for users, roles, caja, ceremonias, and itinerarios.

6. Audit and traceability
- Auditing is a first-class subsystem.
- `AuditObserver` and the `Auditable` model concern suggest entity-change tracking is automatic, with data written to `audit_logs`.
- This creates a separate cross-cutting flow: user action -> model mutation -> observer -> audit record.

7. Operational modules
- `CajaController` and its views handle financial movements and receipt/boleta rendering.
- `CeremoniaController` manages ceremonial records, likely tied to scheduling and monetary or pastoral workflow.
- `ItinerarioController` manages event/intention planning across the parish calendar.
- `PersonaController` and `Acta*Controller` support parish registry/certificate management, with dedicated certificate templates for baptism and marriage.

8. Document and report generation
- Several modules render specialized Blade documents rather than only CRUD screens, such as certificates and receipts.
- `Reportecontroller`, `ConsultaController`, and views under `consultas` and `facturas` indicate read-oriented outputs and printable/report-style pages.
- The presence of `dompdf` config suggests PDFs are generated from server-side views.

9. UI structure
- Presentation is Blade-based, with shared layouts in `resources/views/layouts`, reusable components under `resources/views/components`, and module-specific screens in subfolders like `actas`, `caja`, `itinerario`, `personas`, `roles`, and `usuarios`.
- Static assets are split between `resources` for build-time assets and `public` for deployed CSS/JS/images.
- Vite is used for frontend asset bundling.

10. Background and maintenance tasks
- There is at least one Artisan command, `EncriptarPersonasExistentes`, which suggests a one-time or administrative data migration for existing personal records.
- Console routes and the `artisan` entrypoint imply standard Laravel CLI workflows for maintenance and automation.

11. Deployment/runtime boundary
- Docker is the primary runtime boundary: `docker-compose.yml`, the `Dockerfile`, and MySQL init scripts define the local stack.
- The app runs as PHP/Laravel inside a container, with a separate database container and persistent storage under `storage`.
- `backup.sql` indicates a seed/backup artifact for restoring or mirroring production-like data.

12. Testing and quality gates
- Feature tests cover authentication, dashboard access, profile/security settings, and other user flows.
- CI workflows in `.github/workflows` run linting and tests, so the repo is set up for automated verification on pull requests.

Overall, the architecture is a conventional Laravel monolith with clear domain separation, role-based access control, auditability, and server-rendered document-centric workflows rather than a thin API-first design.

Main entry points: [`routes/web.php`](https://github.com/clausbackner/parroquiasanagustin/blob/main/routes/web.php) (Web routes), [`app/Models/User.php`](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/User.php) (User), [`database/seeders/DatabaseSeeder.php`](https://github.com/clausbackner/parroquiasanagustin/blob/main/database/seeders/DatabaseSeeder.php) (Seed data), [`app/Http/Controllers/CajaController.php`](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/CajaController.php) (Caja)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP layer"]
  node_routes_web["Web routes<br/>routing<br/>[web.php]"]
  node_ctrl_persona["Personas<br/>controller"]
  node_ctrl_acta["Actas<br/>controller<br/>[ActaController.php]"]
  node_ctrl_caja["Caja<br/>controller<br/>[CajaController.php]"]
  node_ctrl_ceremonia["Ceremonias<br/>controller"]
  node_ctrl_itinerario["Itinerario<br/>controller"]
  node_ctrl_usuarios["Usuarios<br/>controller"]
  node_req_caja["Caja requests<br/>form requests"]
end

subgraph group_auth["Auth & security"]
  node_mw_role["Role guard<br/>middleware"]
  node_mw_2fa["2FA guard<br/>middleware<br/>[RequiereDosFA.php]"]
  node_mw_headers["Security headers<br/>middleware"]
  node_fortify_create["Create user<br/>fortify action<br/>[CreateNewUser.php]"]
  node_fortify_reset["Reset password<br/>fortify action"]
end

subgraph group_domain["Domain model"]
  node_model_user[("User<br/>eloquent model<br/>[User.php]")]
  node_model_persona[("Persona<br/>eloquent model<br/>[Persona.php]")]
  node_model_caja[("Movimiento caja<br/>eloquent model<br/>[MovimientoCaja.php]")]
  node_model_ceremonia[("Ceremonia<br/>eloquent model<br/>[Ceremonia.php]")]
  node_model_itin[("Itinerario evento<br/>eloquent model")]
  node_audit_concern["Auditable<br/>model concern<br/>[Auditable.php]"]
  node_audit_observer["Audit observer<br/>[AuditObserver.php]"]
  node_audit_log[("Audit log<br/>audit model<br/>[AuditLog.php]")]
end

subgraph group_ui["Presentation"]
  node_view_app["App layout<br/>blade layout<br/>[app.blade.php]"]
  node_view_personas["Personas view<br/>blade screens<br/>[index.blade.php]"]
  node_view_actas["Actas docs<br/>blade documents"]
end

subgraph group_data["Data & runtime"]
  node_db_config["Database config<br/>runtime config<br/>[database.php]"]
  node_mig_audit["Audit migration<br/>schema migration"]
  node_seed_main["Seed data<br/>seeders<br/>[DatabaseSeeder.php]"]
  node_docker_compose["Docker stack<br/>runtime stack<br/>[docker-compose.yml]"]
end

subgraph group_quality["Quality gates"]
  node_tests_auth["Auth tests<br/>feature tests"]
  node_ci_tests["CI workflow<br/>github actions<br/>[tests.yml]"]
end

node_routes_web -->|"protected by"| node_mw_role
node_routes_web -->|"secured by"| node_mw_2fa
node_routes_web -->|"hardened by"| node_mw_headers
node_routes_web -->|"dispatches"| node_ctrl_persona
node_routes_web -->|"dispatches"| node_ctrl_acta
node_routes_web -->|"dispatches"| node_ctrl_caja
node_routes_web -->|"dispatches"| node_ctrl_ceremonia
node_routes_web -->|"dispatches"| node_ctrl_itinerario
node_routes_web -->|"dispatches"| node_ctrl_usuarios
node_ctrl_caja -->|"validates via"| node_req_caja
node_ctrl_persona -->|"reads/writes"| node_model_persona
node_ctrl_acta -->|"uses"| node_model_persona
node_ctrl_caja -->|"reads/writes"| node_model_caja
node_ctrl_ceremonia -->|"reads/writes"| node_model_ceremonia
node_ctrl_itinerario -->|"reads/writes"| node_model_itin
node_ctrl_usuarios -->|"manages"| node_model_user
node_fortify_create -->|"creates"| node_model_user
node_fortify_reset -->|"updates"| node_model_user
node_model_user -->|"may use"| node_audit_concern
node_audit_concern -->|"triggers"| node_audit_observer
node_audit_observer -->|"writes"| node_audit_log
node_ctrl_persona -->|"renders"| node_view_personas
node_ctrl_acta -->|"renders"| node_view_actas
node_ctrl_caja -->|"renders"| node_view_app
node_ctrl_ceremonia -->|"renders"| node_view_app
node_ctrl_itinerario -->|"renders"| node_view_app
node_db_config -->|"backed by"| node_docker_compose
node_seed_main -->|"seeds"| node_model_user
node_seed_main -->|"seeds"| node_model_caja
node_seed_main -->|"seeds"| node_model_ceremonia
node_seed_main -->|"seeds"| node_model_itin
node_tests_auth -->|"covers"| node_routes_web
node_ci_tests -->|"runs"| node_tests_auth

click node_routes_web "https://github.com/clausbackner/parroquiasanagustin/blob/main/routes/web.php"
click node_mw_role "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Middleware/EnsureUserHasRole.php"
click node_mw_2fa "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Middleware/RequiereDosFA.php"
click node_mw_headers "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Middleware/SecurityHeaders.php"
click node_ctrl_persona "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/PersonaController.php"
click node_ctrl_acta "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/ActaController.php"
click node_ctrl_caja "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/CajaController.php"
click node_ctrl_ceremonia "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/CeremoniaController.php"
click node_ctrl_itinerario "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/ItinerarioController.php"
click node_ctrl_usuarios "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/UsuarioController.php"
click node_req_caja "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Requests/StoreCajaRequest.php"
click node_fortify_create "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Actions/Fortify/CreateNewUser.php"
click node_fortify_reset "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Actions/Fortify/ResetUserPassword.php"
click node_model_user "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/User.php"
click node_model_persona "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/Persona.php"
click node_model_caja "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/MovimientoCaja.php"
click node_model_ceremonia "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/Ceremonia.php"
click node_model_itin "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/ItinerarioEvento.php"
click node_audit_concern "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/Concerns/Auditable.php"
click node_audit_observer "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Observers/AuditObserver.php"
click node_audit_log "https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/AuditLog.php"
click node_view_app "https://github.com/clausbackner/parroquiasanagustin/blob/main/resources/views/layouts/app.blade.php"
click node_view_personas "https://github.com/clausbackner/parroquiasanagustin/blob/main/resources/views/personas/index.blade.php"
click node_view_actas "https://github.com/clausbackner/parroquiasanagustin/blob/main/resources/views/actas/certificado-bautizo.blade.php"
click node_db_config "https://github.com/clausbackner/parroquiasanagustin/blob/main/config/database.php"
click node_mig_audit "https://github.com/clausbackner/parroquiasanagustin/blob/main/database/migrations/2026_04_28_150000_create_audit_logs_table.php"
click node_seed_main "https://github.com/clausbackner/parroquiasanagustin/blob/main/database/seeders/DatabaseSeeder.php"
click node_docker_compose "https://github.com/clausbackner/parroquiasanagustin/blob/main/docker-compose.yml"
click node_tests_auth "https://github.com/clausbackner/parroquiasanagustin/blob/main/tests/Feature/Auth/AuthenticationTest.php"
click node_ci_tests "https://github.com/clausbackner/parroquiasanagustin/blob/main/.github/workflows/tests.yml"

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_routes_web,node_ctrl_persona,node_ctrl_acta,node_ctrl_caja,node_ctrl_ceremonia,node_ctrl_itinerario,node_ctrl_usuarios,node_req_caja toneBlue
class node_mw_role,node_mw_2fa,node_mw_headers,node_fortify_create,node_fortify_reset toneAmber
class node_model_user,node_model_persona,node_model_caja,node_model_ceremonia,node_model_itin,node_audit_concern,node_audit_observer,node_audit_log toneMint
class node_view_app,node_view_personas,node_view_actas toneRose
class node_db_config,node_mig_audit,node_seed_main,node_docker_compose toneIndigo
class node_tests_auth,node_ci_tests toneTeal
```

## Components

### HTTP layer

Routing, middleware, controllers, and request validation.

- [Web routes](https://github.com/clausbackner/parroquiasanagustin/blob/main/routes/web.php): routing · Entry point for browser requests and module dispatch. · `routes/web.php`
- [Personas](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/PersonaController.php): controller · Parish person registry workflows. · `app/Http/Controllers/PersonaController.php`
- [Actas](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/ActaController.php): controller · Certificate and registry record workflows. · `app/Http/Controllers/ActaController.php`
- [Caja](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/CajaController.php): controller · Financial movements and receipt rendering. · `app/Http/Controllers/CajaController.php`
- [Ceremonias](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/CeremoniaController.php): controller · Ceremonial records and related operations. · `app/Http/Controllers/CeremoniaController.php`
- [Itinerario](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/ItinerarioController.php): controller · Calendar, events, and intentions management. · `app/Http/Controllers/ItinerarioController.php`
- [Usuarios](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Controllers/UsuarioController.php): controller · User administration and account management. · `app/Http/Controllers/UsuarioController.php`
- [Caja requests](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Requests/StoreCajaRequest.php): form requests · Validates caja create/update submissions. · `app/Http/Requests/StoreCajaRequest.php`

### Auth & security

Fortify actions, account security, roles, and access checks.

- [Role guard](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Middleware/EnsureUserHasRole.php): middleware · Enforces role-based access on protected screens. · `app/Http/Middleware/EnsureUserHasRole.php`
- [2FA guard](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Middleware/RequiereDosFA.php): middleware · Requires two-factor completion for sensitive access. · `app/Http/Middleware/RequiereDosFA.php`
- [Security headers](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Http/Middleware/SecurityHeaders.php): middleware · Adds session and browser hardening headers. · `app/Http/Middleware/SecurityHeaders.php`
- [Create user](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Actions/Fortify/CreateNewUser.php): fortify action · Creates new accounts during registration or admin flows. · `app/Actions/Fortify/CreateNewUser.php`
- [Reset password](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Actions/Fortify/ResetUserPassword.php): fortify action · Updates passwords and related security state. · `app/Actions/Fortify/ResetUserPassword.php`

### Domain model

Core parish entities and audit support.

- [User](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/User.php): eloquent model · Application account and role-bearing identity. · `app/Models/User.php`
- [Persona](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/Persona.php): eloquent model · Parish person registry entity. · `app/Models/Persona.php`
- [Movimiento caja](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/MovimientoCaja.php): eloquent model · Financial movement and receipt data. · `app/Models/MovimientoCaja.php`
- [Ceremonia](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/Ceremonia.php): eloquent model · Ceremonial record entity. · `app/Models/Ceremonia.php`
- [Itinerario evento](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/ItinerarioEvento.php): eloquent model · Calendar event entity for parish itineraries. · `app/Models/ItinerarioEvento.php`
- [Auditable](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/Concerns/Auditable.php): model concern · Shared change-tracking behavior for audited entities. · `app/Models/Concerns/Auditable.php`
- [Audit observer](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Observers/AuditObserver.php): observer · Captures model mutations and writes audit records. · `app/Observers/AuditObserver.php`
- [Audit log](https://github.com/clausbackner/parroquiasanagustin/blob/main/app/Models/AuditLog.php): audit model · Persistent trace of important entity changes. · `app/Models/AuditLog.php`

### Presentation

Blade views and layout composition.

- [App layout](https://github.com/clausbackner/parroquiasanagustin/blob/main/resources/views/layouts/app.blade.php): blade layout · Shared server-rendered shell for authenticated pages. · `resources/views/layouts/app.blade.php`
- [Personas view](https://github.com/clausbackner/parroquiasanagustin/blob/main/resources/views/personas/index.blade.php): blade screens · Representative module screens for CRUD and listing. · `resources/views/personas/index.blade.php`
- [Actas docs](https://github.com/clausbackner/parroquiasanagustin/blob/main/resources/views/actas/certificado-bautizo.blade.php): blade documents · Printable baptism and marriage certificates. · `resources/views/actas/certificado-bautizo.blade.php`

### Data & runtime

Migrations, database config, Docker, and seed data.

- [Database config](https://github.com/clausbackner/parroquiasanagustin/blob/main/config/database.php): runtime config · MySQL connection and persistence settings. · `config/database.php`
- [Audit migration](https://github.com/clausbackner/parroquiasanagustin/blob/main/database/migrations/2026_04_28_150000_create_audit_logs_table.php): schema migration · Creates the audit log persistence layer. · `database/migrations/2026_04_28_150000_create_audit_logs_table.php`
- [Seed data](https://github.com/clausbackner/parroquiasanagustin/blob/main/database/seeders/DatabaseSeeder.php): seeders · Bootstraps roles, admin, and domain fixtures. · `database/seeders/DatabaseSeeder.php`
- [Docker stack](https://github.com/clausbackner/parroquiasanagustin/blob/main/docker-compose.yml): runtime stack · Local PHP/MySQL development environment. · `docker-compose.yml`

### Quality gates

Feature tests and CI workflows.

- [Auth tests](https://github.com/clausbackner/parroquiasanagustin/blob/main/tests/Feature/Auth/AuthenticationTest.php): feature tests · Covers login, registration, password, and 2FA flows. · `tests/Feature/Auth/AuthenticationTest.php`
- [CI workflow](https://github.com/clausbackner/parroquiasanagustin/blob/main/.github/workflows/tests.yml): github actions · Runs linting and automated tests in CI. · `.github/workflows/tests.yml`

## Connections

- Web routes → Role guard: protected by · Routes pass through role-based access checks.
- Web routes → 2FA guard: secured by · Sensitive areas require two-factor verification.
- Web routes → Security headers: hardened by · Browser/session protections are applied globally.
- Web routes → Personas: dispatches · Browser requests reach the parish registry controller.
- Web routes → Actas: dispatches · Routes map to registry/certificate workflows.
- Web routes → Caja: dispatches · Routes map to financial workflows.
- Web routes → Ceremonias: dispatches · Routes map to ceremonial workflows.
- Web routes → Itinerario: dispatches · Routes map to itinerary planning.
- Web routes → Usuarios: dispatches · Routes map to account administration.
- Caja → Caja requests: validates via · Caja write operations use form requests.
- Personas → Persona: reads/writes · Registry changes are persisted through Eloquent.
- Actas → Persona: uses · Acta workflows depend on parish person data.
- Caja → Movimiento caja: reads/writes · Financial movements are stored in Eloquent models.
- Ceremonias → Ceremonia: reads/writes · Ceremonial records flow through the domain model.
- Itinerario → Itinerario evento: reads/writes · Event scheduling uses itinerary models.
- Usuarios → User: manages · Account administration acts on users.
- Create user → User: creates · Fortify registration builds user records.
- Reset password → User: updates · Password resets mutate user credentials and security state.
- User → Auditable: may use · Auditing behavior is shared where enabled.
- Auditable → Audit observer: triggers · Auditable models are observed for changes.
- Audit observer → Audit log: writes · Model changes are persisted as audit records.
- Personas → Personas view: renders · Controller returns Blade screens for personas.
- Actas → Actas docs: renders · Controller returns printable acta documents.
- Caja → App layout: renders · Financial pages share the main application layout.
- Ceremonias → App layout: renders · Ceremony pages use the shared layout shell.
- Itinerario → App layout: renders · Itinerary pages use the shared layout shell.
- Database config → Docker stack: backed by · Database settings align with the local Docker stack.
- Seed data → User: seeds · Seeders bootstrap users and admin accounts.
- Seed data → Movimiento caja: seeds · Seeders populate financial fixtures.
- Seed data → Ceremonia: seeds · Seeders populate ceremony fixtures.
- Seed data → Itinerario evento: seeds · Seeders populate itinerary fixtures.
- Auth tests → Web routes: covers · Feature tests exercise browser-facing auth flows.
- CI workflow → Auth tests: runs · CI executes the test suite on changes.
