How joselinares17/repositorio-tpi works
Main Architectural Layers and Components
• Front Controller/API Layer: Represented by the various controllers (ArticleController, AuthController, ReviewController, and UserController) – these handle incoming HTTP requests and delegate to service layers.
• Service/Business Logic Layer: Classes such as ArticleService, AuthService, ReviewService, and UserService (with their corresponding implementations) encapsulate the business logic.
• Data Access Layer: The repositories (ArticleRepository, ReviewRepository, UserRepository) which interface with the database (MySQL).
• Domain/Data Model Layer: Entities (classes in the “entities” package, e.g., Article, ArticleDetail, Course, Review, User, etc.) that model the persistent data.
• Security and Authentication: Modules in the “security” and “security/jwt” packages that configure and implement JWT-based authentication (using JwtAuthenticationFilter, JwtService, and a SecurityConfig class).
• DTOs and Mappers: The dto, mapper, and request/response directories which manage object conversion between the API’s external representation and internal domain models.
• Exception Handling: Global exception management (e.g., GlobalExceptionHandler) and custom exception classes that ensure robust error handling.
• Utility Functions: Utilities like PDFAcademicExtractor (utilizing Apache PDFBox) to handle PDF extraction related to academic documents.
• Validations: Custom validations (e.g., ValidUsernameValidator) to ensure request data meets business constraints.
Mapping Relationships and Interactions
– The controllers then invoke the service layer where the core business logic executes.
– The utility components and custom validations are used within services and controllers to process and validate data.
– Errors propagate up and are managed by the global exception handler.
Essential Design Patterns and Principles
– Layered Architecture: Clearly delineate the presentation, business, data access, and security concerns.
– Repository Pattern: Abstracts data persistence with repository interfaces.
– Model-View-Controller (MVC) – at least in the sense of organizing controllers separate from business logic.
– Dependency Injection: Spring Boot automatically manages component injections (evident in the service and repository classes).
– Exception Handling and Cross-Cutting Concerns: GlobalExceptionHandler illustrates centralized control of application errors.
Relevant Technologies and Frameworks
– Java and Spring Boot for the backend framework.
– MySQL for database operations.
– Apache PDFBox for PDF extraction processes.
– Maven for project management and build automation.
– JWT for securing authentication and maintaining session state on stateless protocols.