How tomiponceasd/reserva-app works
Main Components
• Backend Components:
• Domain Layer: Contains the core business entities (Reserva, Servicio) that represent the data and business rules.
• Application Layer: Provides interfaces (IReservaRepository, IReservaService) and service implementations (ReservaService) that encapsulate business logic.
• Infrastructure Layer: Manages data persistence with the ReservaDbContext, database migrations, and repository implementations (ReservaRepository).
• API Layer: Exposed via the ReservasApi project. It includes controllers (ReservaController, ServicioController) and is responsible for handling HTTP requests, applying business rules from the application layer, and providing a Swagger endpoint for API documentation.
• Frontend Components:
• React Application: The frontend directory contains a React application responsible for interacting with the backend API. It includes components (ListaReservas, ReservaForm) for displaying and capturing data, service files (api.ts) for making HTTP calls, and typical React setup files.
Relationships and Interactions
• The Frontend communicates with the Backend API using HTTP calls.
• The API (in ReservasApi) receives client requests, then delegates the business logic request to the Application services.
• The Application services interact with the Domain entities for business rules and use the Infrastructure layer to perform data operations.
• The Infrastructure layer uses a data context (ReservaDbContext) to manage the persistence and evolution (migrations) of the database.
• Clear abstractions separate concerns: the Domain layer contains pure business rules, while the infrastructure deals with persistence, enabling the application to follow the principles of Clean Architecture.
Architectural Patterns and Design Principles
• Layered Architecture: The project is structured into distinct layers (Domain, Application, Infrastructure, API, and Frontend), improving modularity and testability.
• Separation of Concerns: The project clearly separates business logic (Application/Domain) from data access (Infrastructure) and user interface (Frontend).
• Dependency Inversion: Through interfaces in the Application layer, concrete implementations (in Infrastructure) are injected into services, easing testing and maintainability.
• RESTful API Design: The ReservasApi project adheres to REST principles with controllers and swagger documentation.