How ddxy06/gimnasiougr works
1. Project type and runtime
- This is a Java Spring Boot application built with Maven.
- It uses the classic server-side MVC style: Spring controllers render Thymeleaf templates and serve static assets from src/main/resources/static.
2. Top-level architectural shape
- The code is organized into four main layers:
- Controllers: HTTP entry points and page navigation.
- Services: business rules and orchestration.
- Repositories: persistence access.
- Models: domain entities plus DTOs for form/view transport.
- The application entry point is GimnasiougrApplication.
3. Functional domain
- The domain is a gym management system (gimnasiougr), centered on:
- Usuarios / Clientes / Administradores / Entrenadores
- Clases
- Bonos
- Cupos
- Deportes
- Solicitudes de cambio
- The UI is split by role, mainly admin and cliente.
4. Controller boundaries
- Controllers are grouped by responsibility:
- Controllers/Admin/* handles administrative maintenance screens.
- Controllers/Cliente/* handles client-facing screens.
- LoginController handles authentication/login flow.
- DefaultController classes likely provide landing or role-specific default pages.
- Controllers are thin front doors that delegate most logic to services.
5. Service layer responsibilities
- Services encapsulate business logic for the main aggregates:
- AdministradorService
- ClienteService
- BonoService
- ClaseService
- CupoService
- DeporteService
- EntrenadorService
- Per the README, services often return values such as saved models or booleans for delete operations, though this may be more about convenience than strict architecture.
- A notable business rule: when a user/client is created, a list of bonos is also created for that user, and the “configure bono” section is only activated at user creation time.
6. Persistence layer
- Each main entity has a corresponding Spring Data repository:
- UsuarioRepository, ClienteRepository, AdministradorRepository
- BonoRepository, ClaseRepository, CupoRepository
- DeporteRepository, EntrenadorRepository
- SolicitudCambioRepository
- These repositories are the data-access boundary to the underlying database; the code structure strongly suggests a standard Spring Data JPA persistence model.
7. Domain model structure
- The Models package contains both persistence entities and transport objects:
- Core entities: Usuario, Cliente, Administrador, Entrenador, Clase, Bono, Cupo, Deporte, SolicitudCambio
- DTOs: ClienteDTO, BonoDTO, ClaseDTO, CupoDTO, EntrenadorDTO, SolicitudCambioDTO
- Enums: TipoUsuario, TipoBono, TipoClase, Estado
- The DTOs indicate the app separates form/view data from persistence entities in some flows, especially where screens need simplified or specialized data.
8. Key business aggregates and relationships
- Usuario appears to be the base identity concept, with role-specific models such as Cliente, Administrador, and Entrenador.
- Bono is a central business object and has its own service, repository, admin listing, and client view.
- Clase and Cupo represent scheduling/capacity management, likely tied to a class enrollment or booking flow.
- SolicitudCambio suggests a workflow for requests/changes with state handling via Estado.
9. Role-based UI and template structure
- Templates are split into:
- templates/admin/*
- templates/cliente/*
- a general templates/index.html
- Admin templates cover CRUD-style pages for bonos, clases, clientes, entrenadores, and deportes.
- Client templates cover the client home page, class/schedule views, bono list, and request flow.
- This role-based template separation is a major architectural boundary in the UI.
10. Data flow for admin operations
- Typical admin flow is:
- Admin page request hits an admin controller.
- Controller loads or modifies data through a service.
- Service uses repositories to read/write entities.
- Controller returns a Thymeleaf view with model data.
- The admin area is the primary CRUD and configuration surface for the gym’s master data.
11. Data flow for client operations
- Client flow is similar but focused on self-service:
- View client dashboard.
- Inspect bonos, horarios, or classes.
- Submit or interact with requests such as solicitar-tipo2.
- The client side is read-heavy and action-light compared with admin management screens.
12. Static assets and presentation
- Presentation assets live under src/main/resources/static and include:
- Bootstrap CSS/JS
- custom styles.css and scripts.js
- images for the UI
- This indicates a server-rendered app with client-side styling and limited front-end behavior, not a SPA.
13. Configuration and environment
- application.properties holds runtime configuration, most likely including database and Spring settings.
- The presence of the Maven wrapper (mvnw) suggests the project is intended to be built consistently across environments without requiring a preinstalled Maven version.
14. Architecture diagram emphasis
- If drawing the architecture, the most important boxes and arrows are:
- Browser/user role → Controller layer
- Controller → Service layer
- Service → Repository → Database
- Service/Controller → Thymeleaf templates
- Templates → Static assets
- The cleanest boundaries are role-based controllers/views, business services, and JPA repositories.
15. Repo-specific note from the README
- The newest functional evolution is around Bonos:
- dedicated BonoService
- new bono listing UI
- controller reorganization
- bonus configuration tied to client creation
- Also, TipoClase/TipoBono enum handling changed to use strings for persistence in at least one area, which matters if you diagram model-to-database mapping.
Main entry points: GimnasiougrApplication.java GimnasiougrApplication · BonoService.java Bono service · ClienteService.java Cliente service · cliente Client views
Components 28
App
Spring Boot entrypoint and runtime config
- GimnasiougrApplication · Application bootstrap and component scanning
src/main/java/com/example/gimnasiougr/GimnasiougrApplication.java
Controllers
HTTP entry points and page navigation
- Login · Login and authentication flow
src/main/java/com/example/gimnasiougr/Controllers/LoginController.java - Admin default · Admin landing and navigation pages
src/main/java/com/example/gimnasiougr/Controllers/Admin/DefaultController.java - Admin bonos · Admin CRUD and maintenance for bonos
src/main/java/com/example/gimnasiougr/Controllers/Admin/AdminBonoController.java - Admin clases · Admin CRUD and maintenance for clases
src/main/java/com/example/gimnasiougr/Controllers/Admin/AdminClaseController.java - Admin clientes · Admin CRUD and maintenance for clientes
src/main/java/com/example/gimnasiougr/Controllers/Admin/AdminClienteController.java - Cliente home · Client dashboard and self-service navigation
src/main/java/com/example/gimnasiougr/Controllers/Cliente/ClienteDefaultController.java - Cliente bonos · Client bono views and request flow
src/main/java/com/example/gimnasiougr/Controllers/Cliente/ClienteBonoController.java
Services
Business rules and orchestration
- Cliente service · Client creation and client-facing logic
src/main/java/com/example/gimnasiougr/Services/ClienteService.java - Bono service · Bono rules, listing, and creation coordination
src/main/java/com/example/gimnasiougr/Services/BonoService.java - Clase service · Class scheduling and class logic
src/main/java/com/example/gimnasiougr/Services/ClaseService.java - Admin service · Administrator maintenance logic
src/main/java/com/example/gimnasiougr/Services/AdministradorService.java - Cupo service · Capacity and booking-related logic
src/main/java/com/example/gimnasiougr/Services/CupoService.java - Deporte service · Sport maintenance and lookup logic
src/main/java/com/example/gimnasiougr/Services/DeporteService.java - Entrenador service · Coach maintenance and lookup logic
src/main/java/com/example/gimnasiougr/Services/EntrenadorService.java
Repositories
Spring Data persistence boundary
- Usuario repo · Persistence access for users
src/main/java/com/example/gimnasiougr/Repositories/UsuarioRepository.java - Bono repo · Persistence access for bonos
src/main/java/com/example/gimnasiougr/Repositories/BonoRepository.java - Clase repo · Persistence access for clases
src/main/java/com/example/gimnasiougr/Repositories/ClaseRepository.java - Cliente repo · Persistence access for clientes
src/main/java/com/example/gimnasiougr/Repositories/ClienteRepository.java - Cupo repo · Persistence access for cupos
src/main/java/com/example/gimnasiougr/Repositories/CupoRepository.java - Deporte repo · Persistence access for deportes
src/main/java/com/example/gimnasiougr/Repositories/DeporteRepository.java - Entrenador repo · Persistence access for entrenadores
src/main/java/com/example/gimnasiougr/Repositories/EntrenadorRepository.java
Models
Domain entities, DTOs, and enums
- Domain model · Core entities, DTOs, and enums
src/main/java/com/example/gimnasiougr/Models
Views
Thymeleaf templates by role
- Admin views · Admin CRUD and maintenance templates
src/main/resources/templates/admin - Client views · Client dashboard, bono, and request templates
src/main/resources/templates/cliente - Index page · General landing page
src/main/resources/templates/index.html
Static assets
CSS, JS, and images
- Static assets · Bootstrap, custom styles, scripts, and images
src/main/resources/static
Other components
- Database · Underlying relational persistence
Connections 30
- GimnasiougrApplication → Login: routes · Bootstraps the web application and controller scan
- GimnasiougrApplication → Admin default: routes · Registers admin MVC endpoints
- GimnasiougrApplication → Admin bonos: routes · Registers admin bono endpoints
- GimnasiougrApplication → Cliente home: routes · Registers client MVC endpoints
- Login → Index page: renders · Serves login and landing pages
- Admin default → Admin views: renders · Returns admin templates
- Admin bonos → Bono service: uses · Delegates bono management to service layer
- Admin clases → Clase service: uses · Delegates class management to service layer
- Admin clientes → Cliente service: uses · Delegates client management to service layer
- Cliente home → Client views: renders · Returns client dashboard pages
- Cliente bonos → Bono service: uses · Loads client bono data and actions
- Cliente bonos → Client views: renders · Returns client bono templates
- Admin service → Domain model: operates on · Business logic over administrator and related entities
- Cliente service → Cliente repo: persists · Creates and updates clients
- Cliente service → Bono service: creates bonos · Client creation also initializes bono list
- Bono service → Bono repo: persists · Reads and writes bonos
- Clase service → Clase repo: persists · Reads and writes clases
- Cupo service → Cupo repo: persists · Reads and writes cupos
- Deporte service → Deporte repo: persists · Reads and writes deportes
- Entrenador service → Entrenador repo: persists · Reads and writes entrenadores
- Cliente repo → Database: JPA · Repository-backed persistence
- Bono repo → Database: JPA · Repository-backed persistence
- Clase repo → Database: JPA · Repository-backed persistence
- Cupo repo → Database: JPA · Repository-backed persistence
- Deporte repo → Database: JPA · Repository-backed persistence
- Entrenador repo → Database: JPA · Repository-backed persistence
- Usuario repo → Database: JPA · Repository-backed persistence
- Admin views → Static assets: uses · Admin pages depend on shared styling and scripts
- Client views → Static assets: uses · Client pages depend on shared styling and scripts
- Index page → Static assets: uses · Landing page depends on shared styling and scripts