How dalmaponce/practicas-underc0de-appsorteo works
Project Type and Purpose
• This is a full-stack application developed as a practice project for performing random draws (sorteos).
• The frontend is a simple interface built with HTML, CSS, and JavaScript that allows users to create events and input participants and prizes.
• The backend is built with Spring Boot (Java) and exposes RESTful endpoints for managing events, participants, and prizes. It interacts with a MySQL database for persistence.
Main Components
a. Frontend:
• UI Elements (HTML pages such as index.html and formulario.html).
• CSS & JS files for styling and interaction (CSS files, formulario.js, fuction.js).
• This layer is responsible for capturing user input and sending requests to the backend API.
b. Backend:
• API Layer built with Spring Boot (see controller packages: EventoController, ParticipanteController, PremioController).
• Business Logic layer (service classes: EventoService, ParticipanteService, PremioService).
• Data Access layer (repository interfaces: IEventoRepository, IParticipanteRepository, IPremioRepository).
• Exception handling and configuration modules (advice package, config package).
c. Database:
• MySQL database (as specified in the README) where data for events, participants, prizes, and historical event data are stored.
d. External Dependencies:
• Maven (for dependency management) and Java 17.
• Spring Data JPA is used to abstract database interactions.
Relationships and Interactions
• The Frontend sends HTTP requests (likely via AJAX/Fetch) to the Backend’s REST API endpoints.
• The Backend processes these requests:
• Controllers interpret requests and delegate tasks to services.
• The Service layer implements business logic (handling creation of events, managing participants/prizes, executing the random lottery).
• The Repository layer communicates with the MySQL database via Spring Data JPA.
• Data flows from the frontend to the backend and back, with the database acting as persistence storage.
Important Architectural Patterns & Design Principles
• Layered Architecture: Separation between the presentation layer (frontend), business logic (backend services), and data access (repositories).
• RESTful API design: Endpoints such as POST /evento, GET /evento/historial, etc., outlining standard resource operations.
• Exception and validation management using dedicated advice and config packages.
• Use of Data Transfer Objects (DTOs) to decouple domain entities from API data representations.