How e2-systems/construplan works
1. Overall shape
ConstruPlan is a single Spring Boot 3.x monolith with server-rendered UI. Requests come from browsers, are handled by Spring MVC controllers, pass through Spring Security, then flow into service and repository layers backed by JPA/MySQL.
2. Presentation layer
The UI is built with Thymeleaf templates under src/main/resources/templates. Views are grouped by business area: admin, auth, campo, empleado, oficina, tickets, plus shared fragments and error pages. This indicates a classic MVC app rather than a SPA or API-first system.
3. Security and entry flow
Authentication is centralized in config/SecurityConfig and the auth controllers under auth/. Login uses the database-backed user table via Spring Security, and the app redirects users to role-specific dashboards: ADMIN, OFICINA, CAMPO, and EMPLEADO. Security is a cross-cutting boundary around all feature modules.
4. Domain modularization
The backend is organized by business capability, not by technical layer alone:
- admin: system administration, projects, users, configuration
- campo: field operations, tasks, goals, assignments, production validation
- empleado: employee self-service, attendance, tickets
- oficina: payroll, adjustments, reports, salary management
- shared model, repository, service, config, exception, util
This structure is important for diagramming because each module has its own controllers, entities, repositories, and services.
5. Core data model
The shared identity model centers on Usuario and Rol. The employee domain adds Empleado, RegistroDiario, and Ticket. The field domain centers on Tarea, Meta, and AsignacionTarea. The office/payroll domain centers on Planilla, PlanillaDetalle, Sueldo, and AjustePlanilla. These are separate bounded contexts connected by shared references, not one flat model.
6. Important cross-entity relationships
The most important business flow is AsignacionTarea: it links an Empleado, the assigning Usuario, a Proyecto, and a Meta. Another key relationship is Usuario to Empleado, which is optional in one direction but required for employees who access the system. Meta belongs to Tarea, translating a generic task into measurable work targets.
7. Service and repository boundaries
Each feature module has a service layer that contains transactional business rules and a repository layer that performs persistence. Examples include UsuarioService, ProyectoService, MetaService, PlanillaService, and TicketService. Repositories are Spring Data JPA interfaces, so the application’s data access boundary is database-centric rather than service-to-service.
8. Field operations flow
The campo module appears to handle the operational side of construction work: assigning tasks, defining goals, validating production, and measuring progress. It also includes DTOs like EmpleadoRendimientoDTO and ProyectoAvanceDTO, which suggests aggregate views for dashboards rather than direct entity exposure.
9. Payroll and reporting flow
The oficina module is the payroll engine. It manages payroll periods, payroll details, salary definitions, and adjustments, and it also generates reports. JasperReports is integrated through config/JasperConfig, with a .jrxml report template for weekly payroll. This is the main reporting/output boundary in the system.
10. Employee self-service
The empleado module provides the employee-facing dashboard and workflows for attendance, profile, and ticketing. It is a separate front-door from office/admin use, even though it shares the same authentication and persistence infrastructure.
11. Shared infrastructure and error handling
Cross-cutting configuration lives in config/: JPA setup, security, and Jasper reporting. Error handling is centralized in GlobalExceptionHandler with a custom ResourceNotFoundException, and there are dedicated error templates for 403/404/500. This keeps exception behavior consistent across all modules.
12. Runtime and deployment assumptions
The app expects MySQL on port 3306 with schema construplan, and JPA validation is configured instead of schema auto-creation. That means the database schema is an external prerequisite, not something the app freely mutates at startup. The project is built with Maven and has a GitHub Actions workflow for automated build/test execution.
13. Diagramming takeaway
If you draw the architecture, the main picture should be: Browser → Thymeleaf MVC controllers → service layer → JPA repositories → MySQL, wrapped by Spring Security and supported by JasperReports for document output. The real architectural boundary is the business module: admin, field, employee, and office each own their own screens, services, and data models while sharing authentication and infrastructure.
Main entry points: UsuarioRepository.java Repositories · dashboard.html Thymeleaf views · ConstruplanApplication.java ConstruPlan · PlanillaService.java Office services
Components 23
Presentation
Server-rendered MVC UI and entry controllers
- Auth UI · Login and authentication entry points
src/main/java/com/construplan/auth/controller/AuthController.java - Admin UI · Administration screens for projects, users, and configuration
src/main/java/com/construplan/admin/controller/AdminController.java - Campo UI · Field operations screens for tasks, goals, and validation
src/main/java/com/construplan/campo/controller/CampoController.java - Empleado UI · Employee self-service screens and workflows
src/main/java/com/construplan/empleado/controller/EmpleadoController.java - Oficina UI · Payroll, reports, and office operations screens
src/main/java/com/construplan/oficina/controller/OficinaController.java - Thymeleaf views · Server-rendered pages and shared fragments
src/main/resources/templates/admin/dashboard.html
Business domains
Capability-based feature modules
- Admin services · Administration business rules and user/project management
src/main/java/com/construplan/admin/service/UsuarioService.java - Project model · Projects and system configuration data
src/main/java/com/construplan/admin/model/entity/Proyecto.java - Auth service · Authentication flow backed by database users
src/main/java/com/construplan/auth/service/AuthService.java - Campo services · Task assignment, goals, and production validation logic
src/main/java/com/construplan/campo/service/AsignacionTareaService.java - Field model · Tasks, goals, assignments, and progress views
src/main/java/com/construplan/campo/model/entity/AsignacionTarea.java - Employee services · Attendance, employee profile, and ticket workflows
src/main/java/com/construplan/empleado/service/EmpleadoService.java - Employee model · Employee, attendance, and ticket data
src/main/java/com/construplan/empleado/model/entity/Empleado.java - Office services · Payroll calculations, salary management, and reporting
src/main/java/com/construplan/oficina/service/PlanillaService.java - Payroll model · Payroll periods, details, salaries, and adjustments
src/main/java/com/construplan/oficina/model/entity/Planilla.java
Infrastructure
Security, persistence, reporting, and error handling
- ConstruPlan · Application entrypoint and runtime container
src/main/java/com/construplan/ConstruplanApplication.java - Security · Central authentication and authorization boundary
src/main/java/com/construplan/config/SecurityConfig.java - JPA config · JPA and database integration setup
src/main/java/com/construplan/config/JpaConfig.java - Reports · Reporting and document generation setup
src/main/java/com/construplan/config/JasperConfig.java - Errors · Global MVC error handling and not-found mapping
src/main/java/com/construplan/exception/GlobalExceptionHandler.java - Repositories · Spring Data persistence boundary across modules
src/main/java/com/construplan/admin/repository/UsuarioRepository.java - JRXML report · Weekly payroll report template
src/main/resources/reports/weekly_payroll.jrxml - MySQL · Database backing users, domain entities, and payroll data
Connections 23
- ConstruPlan → Security: boots with · Application starts under security configuration
- ConstruPlan → JPA config: uses · Loads persistence configuration
- ConstruPlan → Reports: uses · Loads reporting configuration
- ConstruPlan → Errors: handles · Centralized MVC exception handling
- Security → Auth UI: protects · Security boundary around login and app routes
- Security → Repositories: auth via · Loads users and roles from persistence
- Auth UI → Thymeleaf views: renders · Login and auth views
- Admin UI → Thymeleaf views: renders · Admin pages and shared fragments
- Campo UI → Thymeleaf views: renders · Campo dashboards and forms
- Empleado UI → Thymeleaf views: renders · Employee pages and dashboards
- Oficina UI → Thymeleaf views: renders · Office and payroll pages
- Admin UI → Admin services: calls · Admin actions delegate to services
- Admin services → Project model: manages · Projects and configuration data
- Auth service → Repositories: reads · Authenticates against user data
- Campo services → Field model: orchestrates · Assigns tasks and tracks progress
- Campo services → Repositories: persists · Field domain persistence
- Employee services → Employee model: orchestrates · Attendance and ticket workflows
- Employee services → Repositories: persists · Employee domain persistence
- Office services → Payroll model: orchestrates · Payroll and adjustment processing
- Office services → JRXML report: generates · Produces weekly payroll reports
- Office services → Repositories: persists · Payroll domain persistence
- Repositories → MySQL: stores · JPA-backed database access
- Errors → Thymeleaf views: serves · 403, 404, and 500 error pages