# jallamas/gestion-hermandad architecture

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

- Interactive diagram: https://gitdiagram.com/jallamas/gestion-hermandad
- Repository: https://github.com/jallamas/gestion-hermandad

## Overview

##### Main Components
- Client / Browser: The user interface, which is implemented using Thymeleaf templates (located in the “templates” directory) along with static assets (CSS, JavaScript, images in “static”).
- Web Server / Application: A Spring Boot application built with Maven (pom.xml, Maven wrapper files). This component includes several layers:
- Presentation Layer: Controllers (e.g., HermanoController, WebController, PapeletaSitioAdminController) that handle HTTP requests and drive the UI.
- Service Layer: Service classes (e.g., HermanoServicio, HermanoHistoricoServicio) that encapsulate the business logic.
- Persistence / Repository Layer: Repository interfaces (e.g., HermanoRepository, PuestoRepository) to interact with the database.
- Model Layer: Domain entities (e.g., Hermano, HermanoHistorico, HermanoProvisional) representing your data.
- Configuration & Security: Configuration classes such as MvcConfig and SecurityConfig along with UserDetailsServiceImpl, indicating use of Spring Security.
- Database: An embedded or file-based database (the “db” folder contains files like basededatos.mv.db) that stores the application’s data.
- Testing Frameworks: Test packages for unit and integration tests (located in “src/test”), ensuring application robustness.

##### Representing Relationships and Interactions
- Browser/client making HTTP requests to the Controller layer in the web server.
- Controllers forward requests to the respective Service layer components where business rules are applied.
- Service classes then interact with the Repository layer to perform CRUD operations on the Database.
- A separate path for security where requests are intercepted and validated by SecurityConfig/UserDetailsServiceImpl.
- Optionally, note the build and deployment aspects (e.g., Maven build process) as supportive infrastructure.

##### Architectural Patterns and Technologies
- MVC Pattern: Clearly note the separation of concerns with Controllers (Presentation), Services (Business Logic), and Repositories (Data Persistence).
- Spring Boot: Indicate that the backend is powered by Spring Boot, which simplifies dependency injection and configuration.
- Thymeleaf: Mark this as the view/template engine used for composing dynamic HTML pages.
- Spring Security: Emphasize the security configuration aspect providing authentication/authorization.
- Embedded Database: Make a note that the project uses either an embedded H2 or similar database (as evidenced from the “db” directory).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend: Client / Browser
    subgraph "Client / Browser"
        C1("Thymeleaf Templates"):::frontend
        C2("Static Assets"):::frontend
    end

    %% Backend: Application layers
    subgraph "Spring Boot Application"
        %% Configuration & Security Layer
        subgraph "Configuration & Security"
            SEC("Spring Security"):::security
            CONF1("MvcConfig"):::config
            CONF2("SecurityConfig"):::config
            CONF3("UserDetailsServiceImpl"):::config
        end

        %% Presentation Layer
        subgraph "Presentation Layer (Controllers)"
            PC1("HermanoController"):::controller
            PC2("WebController"):::controller
            PC3("PapeletaSitioAdminController"):::controller
        end

        %% Service Layer
        subgraph "Service Layer"
            SVC1("HermanoServicio"):::service
            SVC2("HermanoHistoricoServicio"):::service
            SVC3("HermanoProvisionalServicio"):::service
        end

        %% Repository Layer
        subgraph "Repository Layer"
            R1("HermanoRepository"):::repository
            R2("PuestoRepository"):::repository
        end

        %% Model Layer
        subgraph "Model Layer"
            M1("Hermano"):::model
            M2("HermanoHistorico"):::model
            M3("HermanoProvisional"):::model
            M4("Puesto"):::model
        end

        DS("Maven Build"):::build
    end

    %% Database
    DB("Database"):::database

    %% Testing
    subgraph "Testing"
        TST("Test Cases"):::testing
    end

    %% Connections
    C1 -->|"HTTP"| SEC
    C2 -->|"HTTP"| SEC
    DS -->|"build"| SEC
    SEC -->|"authenticates"| PC1
    %% Controllers to Services
    PC1 -->|"calls"| SVC1
    PC2 -->|"calls"| SVC1
    PC3 -->|"calls"| SVC1
    %% Services to Repositories
    SVC1 -->|"invokes"| R1
    SVC2 -->|"invokes"| R1
    SVC3 -->|"invokes"| R2
    %% Repositories to Database
    R1 -->|"CRUD"| DB
    R2 -->|"CRUD"| DB
    %% Business logic uses Data Models
    SVC1 -->|"uses"| M1
    R1 -->|"maps to"| M1

    %% Click Events for Frontend
    click C1 "https://github.com/jallamas/gestion-hermandad/tree/master/gestionhermandad/src/main/resources/templates"
    click C2 "https://github.com/jallamas/gestion-hermandad/tree/master/gestionhermandad/src/main/resources/static"

    %% Click Events for Controllers
    click PC1 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/controller/HermanoController.java"
    click PC2 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/controller/WebController.java"
    click PC3 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/controller/PapeletaSitioAdminController.java"

    %% Click Events for Services
    click SVC1 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/services/HermanoServicio.java"
    click SVC2 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/services/HermanoHistoricoServicio.java"
    click SVC3 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/services/HermanoProvisionalServicio.java"

    %% Click Events for Repositories
    click R1 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/repositorios/HermanoRepository.java"
    click R2 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/repositorios/PuestoRepository.java"

    %% Click Events for Models
    click M1 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/model/Hermano.java"
    click M2 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/model/HermanoHistorico.java"
    click M3 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/model/HermanoProvisional.java"
    click M4 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/model/Puesto.java"

    %% Click Events for Configuration & Security
    click CONF1 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/configuracion/MvcConfig.java"
    click CONF2 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/seguridad/SecurityConfig.java"
    click CONF3 "https://github.com/jallamas/gestion-hermandad/blob/master/gestionhermandad/src/main/java/com/salesianostriana/dam/gestionhermandad/seguridad/UserDetailsServiceImpl.java"

    %% Click Event for Database
    click DB "https://github.com/jallamas/gestion-hermandad/tree/master/gestionhermandad/db"

    %% Click Event for Testing
    click TST "https://github.com/jallamas/gestion-hermandad/tree/master/gestionhermandad/src/test/java/com/salesianostriana/dam/gestionhermandad"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef security fill:#FFCCCB,stroke:#000,stroke-width:1px;
    classDef controller fill:#FDB813,stroke:#000,stroke-width:1px;
    classDef service fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef repository fill:#FFB6C1,stroke:#000,stroke-width:1px;
    classDef model fill:#D3D3D3,stroke:#000,stroke-width:1px;
    classDef config fill:#C0C0C0,stroke:#000,stroke-width:1px;
    classDef build fill:#D8BFD8,stroke:#000,stroke-width:1px;
    classDef database fill:#FFFFCC,stroke:#000,stroke-width:2px;
    classDef testing fill:#E6E6FA,stroke:#000,stroke-width:1px;
```
