How eitan-wajsberg/tp-anual-dds-2024 works
Main Components
• User Interface (Frontend):
• Represented by the Handlebars templates (located in src/main/resources/templates), CSS, JavaScript files, and public resources.
• This layer handles web pages for account creation, login, donation management, heladera maps, and report views.
• API / Controller Layer:
• The controllers found under src/main/java/ar/edu/utn/frba/dds/controllers handle routing and business requests (e.g., ControladorHeladera, ControladorOferta, ControladorRegistroUsuario, etc.).
• They act as the entry points for the HTTP requests coming from the UI.
• Domain Layer:
• The domain is extensively modeled (look under src/main/java/ar/edu/utn/frba/dds/domain). It contains the business logic, entities (such as Heladera, PersonaHumana, PersonaJuridica, DonacionDinero, SolicitudApertura, etc.), domain events (incidentes, solicitudes, suscripciones), and adapters for external interactions.
• This layer includes DTOs and converters to translate between different representations.
• Persistence / Repository Layer:
• Under src/main/java/ar/edu/utn/frba/dds/domain/repositories and its implementation packages, the system defines repositories and persistence mechanisms (backed by Hibernate, with configuration resources in src/test/resources and the SQL scripts in the sql folder).
• External Communication / Adapters:
• In the adapters directory, you see implementations for sending notifications (e.g., via mail, Telegram, WhatsApp and JavaXMail). These serve as integration points for external services.
• Infrastructure and Utilities:
• Middleware for authentication (AuthMiddleware), permission checking, and other utility classes grouped under src/main/java/ar/edu/utn/frba/dds/utils. This layer supports the application’s overall stability and security.
• Testing:
• The project also contains a comprehensive test suite (JUnit tests under src/test) ensuring that each component behaves as expected.
• Deployment:
Relationships and Interactions Between Components
• How a client HTTP request flows from the User Interface (Browser) to the Javalin-based Server.
• The Router (defined in src/main/java/ar/edu/utn/frba/dds/server/Router.java) directs incoming calls to the appropriate Controller.
• Controllers then interact with the Domain layer – invoking business logic on entity objects, handling DTO mappings, and executing validation routines.
• Domain objects interact with Repository implementations to perform database operations (SQL scripts and Hibernate ORM).
• When needed, the domain layer invokes external adapters (for emailing, messaging, or even external REST services) to complete tasks such as notifications.
• The middleware (authentication and permissions) is applied in the request pipeline to validate user actions.
Architectural Patterns and Design Principles
• The project follows a layered (or hexagonal) architecture:
• Presentation Layer (UI & Templates)
• Application / Controller Layer (HTTP request routing, using Javalin)
• Domain Layer (business logic with clearly defined entities and services)
• Infrastructure Layer (persistence with Hibernate, external integrations with adapters)
• MVC is evident in the separation between UI (views), controllers, and domain models.
• The use of DTOs, converters, and adapters emphasizes clean separation and loose coupling between layers.
Technologies, Frameworks, and Libraries
• Java 17, Maven, Javalin, Handlebars, Hibernate, and JUnit 5.
• AWS is mentioned for deployment purposes.
• Additionally, some utility packages for handling dates, distances, and permissions further support the application’s infrastructure.