How mikelgarduno/deustostream works
Main Components
• Frontend Layer: Represented by the Thymeleaf templates (HTML files in src/main/resources/templates) and static assets (CSS files within src/main/resources/static). This layer handles the presentation and user interactions.
• Backend Layer: The Spring Boot application is the core, encapsulated in the RestApiApplication.java file. This includes:
• Controllers (in the controller package, e.g., GenerosController.java, DeustoStreamController.java) that deal with HTTP requests.
• Services (in the service package, such as AuthService.java and DeustoStreamService.java) that encapsulate business logic.
• Repositories (in the repository package, e.g., PeliculaRepository.java, SerieRepository.java, UsuarioRepository.java) that interact with the MySQL database.
• Models (in the model package) that define the domain entities like Pelicula, Series, and Usuario.
• Configuration/Infrastructure Layer: Contains configuration files and interceptors (e.g., LoginInterceptor.java, WebConfig.java) that manage cross-cutting concerns like security and request routing.
• Database: MySQL, as set up by the dbsetup.sql script which creates a dedicated database (restapidb) and a user (spq) with the appropriate permissions.
• Integration/Client Components: Although less emphasized, the WebController in the client package indicates potential integrations or web-based client handling.
Relationships and Interactions
• Data Flow: Start with the user interacting with the frontend (web pages rendered with Thymeleaf) and making HTTP requests.
• Controllers receive these requests, invoke the service layer for processing, and fetch/modify data via the repository layer.
• Services implement business logic (such as authentication via AuthService) and manage data interactions.
• The repository layer, using JPA/Hibernate, communicates with the MySQL database.
• Configuration classes (LoginInterceptor and WebConfig) ensure secured and well-configured request processing.
• Also, note the initialization of data through the configuration class “inicializarDatos.java”.
Architectural Patterns and Design Principles
• Layered Architecture (Separation of Concerns): Clearly divided among controllers, services, and repositories.
• MVC Pattern: The Spring Boot project leverages MVC with controllers and Thymeleaf templates.
• Dependency Injection and Inversion of Control: Handled by Spring Boot’s core functionalities.
• RESTful API Principles: Controllers may expose REST endpoints for various operations.
Relevant Technologies to Highlight
• Java and Spring Boot for the application framework.
• MySQL as the database for persistent storage.
• Maven for dependency management and build automation.
• JPA/Hibernate for the ORM layer.
• Thymeleaf for server-side view rendering.
• Testing components (present in src/test) for ensuring quality.