# pelayus/gimnasiopelayo architecture

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

- Interactive diagram: https://gitdiagram.com/pelayus/gimnasiopelayo
- Repository: https://github.com/pelayus/gimnasiopelayo

## Overview

##### Project Type and Purpose
- The README indicates that the project is a gym management system.
- The file tree shows standard Maven structures, a main application class (GimnasiopelayoApplication.java), and several packages dividing concerns (controlador, modelo, presentacion, repositorio, servicios). This confirms a layered design where UI, business, and data access are clearly separated.

##### File Structure
- Top-Level Structure & Maven Setup:
- Files such as pom.xml, mvnw, and the .mvn directory indicate that Maven is used for build management.
- Layered Package Organization:
- "controlador": Contains controller classes (e.g., AltaClienteController, InicioController, MenuPrincipalController) that handle user interactions.
- "modelo": Contains domain models including the Cliente class.
- "presentacion": Contains the JavaFX entry point (SistemaClientesFX), likely setting up the desktop UI.
- "repositorio": Contains data access interfaces/classes (ClienteRepository) for interacting with a database.
- "servicios": Contains business logic (ServicioCliente and its implementation) that sits between controllers and the repository.
- Resources and FXML:
- In the resources/templates directory, FXML files (altacliente.fxml, inicio.fxml, etc.) define UI layouts for different screens, emphasizing that JavaFX is used for the presentation layer.

##### Key Components
a. Main Application Layer:
- GimnasiopelayoApplication.java serves as the entry point for the application.
b. Presentation/UI Layer:
- SistemaClientesFX.java (the JavaFX UI initializer).
- FXML templates (altacliente.fxml, inicio.fxml, menuprincipal.fxml) representing the UI views.
c. Controller Layer:
- Controllers (in the controlador package) such as AltaClienteController, InicioController, and MenuPrincipalController managing UI events and navigation.
d. Business Logic/Service Layer:
- Services in the servicios package (ServicioCliente and ServicioClienteImpl) contain the core business rules.
e. Data Access/Repository Layer:
- Repositories under the repositorio package (e.g., ClienteRepository) deal with data persistence and retrieval.
f. Domain Model:
- The modelo package, which at least contains the Cliente entity, encapsulates the domain data.

##### Relationships and Interactions
- The UI layer (JavaFX screens) interacts with the controllers to capture user actions.
- Controllers forward requests to the service layer where business logic is applied.
- Services interact with the repository layer to perform CRUD operations on domain objects.
- Data flows upward from the repository to services, then to controllers, and finally renders in the UI.
- Configuration (in application.properties) that might define connections (e.g., to a database). Although the file doesn’t detail the database type, it’s an important integration point.

##### Architectural Patterns and Technologies
- The project follows a Model-View-Controller (MVC) or layered-pattern approach, common in desktop applications using JavaFX.
- Key technologies include Java, Maven (for build management), and JavaFX (for the UI).
- The use of services and repositories alludes to a design that emphasizes separation of concerns and maintainability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Application Layer
    subgraph "Main Application"
        A("GimnasiopelayoApplication"):::main
    end

    %% Presentation/UI Layer
    subgraph "Presentation Layer (UI)"
        PF("SistemaClientesFX (JavaFX Initializer)"):::presentation
        FXML("FXML Templates"):::presentation
    end

    %% Controller Layer
    subgraph "Controller Layer"
        C1("AltaClienteController"):::controller
        C2("InicioController"):::controller
        C3("MenuPrincipalController"):::controller
    end

    %% Business Logic/Service Layer
    subgraph "Service Layer"
        S1("ServicioCliente"):::service
        S2("ServicioClienteImpl"):::service
    end

    %% Data Access/Repository Layer
    subgraph "Repository Layer"
        R("ClienteRepository"):::repository
    end

    %% Domain Model
    subgraph "Domain Model"
        D("Cliente"):::domain
    end

    %% Connections
    A -->|"starts"| PF
    PF -->|"loads"| FXML
    FXML -->|"triggers"| C1
    FXML -->|"triggers"| C2
    FXML -->|"triggers"| C3
    C1 -->|"calls"| S1
    C2 -->|"calls"| S1
    C3 -->|"calls"| S1
    S1 -->|"implementedBy"| S2
    S2 -->|"accesses"| R
    R -->|"manages"| D

    %% Click Events
    click A "https://github.com/pelayus/gimnasiopelayo/blob/main/src/main/java/com/gimnasio/gimnasiopelayo/GimnasiopelayoApplication.java"
    click PF "https://github.com/pelayus/gimnasiopelayo/blob/main/src/main/java/com/gimnasio/gimnasiopelayo/presentacion/SistemaClientesFX.java"
    click FXML "https://github.com/pelayus/gimnasiopelayo/tree/main/src/main/resources/templates"
    click C1 "https://github.com/pelayus/gimnasiopelayo/tree/main/src/main/java/com/gimnasio/gimnasiopelayo/controlador"
    click C2 "https://github.com/pelayus/gimnasiopelayo/tree/main/src/main/java/com/gimnasio/gimnasiopelayo/controlador"
    click C3 "https://github.com/pelayus/gimnasiopelayo/tree/main/src/main/java/com/gimnasio/gimnasiopelayo/controlador"
    click S1 "https://github.com/pelayus/gimnasiopelayo/tree/main/src/main/java/com/gimnasio/gimnasiopelayo/servicios"
    click S2 "https://github.com/pelayus/gimnasiopelayo/tree/main/src/main/java/com/gimnasio/gimnasiopelayo/servicios"
    click R "https://github.com/pelayus/gimnasiopelayo/blob/main/src/main/java/com/gimnasio/gimnasiopelayo/repositorio/ClienteRepository.java"
    click D "https://github.com/pelayus/gimnasiopelayo/blob/main/src/main/java/com/gimnasio/gimnasiopelayo/modelo/Cliente.java"

    %% Styles
    classDef main fill:#ff9999,stroke:#333,stroke-width:2px;
    classDef presentation fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef controller fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef service fill:#ffeb99,stroke:#333,stroke-width:2px;
    classDef repository fill:#ffcc99,stroke:#333,stroke-width:2px;
    classDef domain fill:#dda0dd,stroke:#333,stroke-width:2px;
```
