How 1adrianm/loansavingsystem_clean-architecture works
Project Type and Purpose
• This project is a Clean Architecture–based financial application concerned with handling loans, savings, and related operations (clients, prestamos, guarantees, payments, etc.).
• It is a full-stack solution built using a .NET backend combined with an Angular web UI. The system follows Domain Driven Design (DDD) patterns and organizes business logic into distinct layers (Domain, Application, Infrastructure, Presentation/WebApi).
Main Components
• Domain Layer: Contains core business entities such as Cliente, Prestamo, Garantia, CuotaPrestamo, Inversionista, Prestatario, etc. It encapsulates the business rules and domain exceptions.
• Application Layer: Hosts command and query handlers (e.g., CreateClientCommandHandler, UpdatePrestamoCommandHandler) and defines interfaces (e.g., IUnitOfWork) that orchestrate business use cases, communication between the domain and outer layers.
• Infrastructure Layer: Implements data access and persistence mechanisms. It contains repositories, mappers (e.g., ClientMapper, PrestamoMapper), and the EF Core database context (AhorrosPrestamosDb2Context) to interact with the database.
• Web API (Presentation for server side): Exposes RESTful endpoints (organized by domain functionality in folders such as Endpoints/Client, Endpoints/Prestamo, etc.), incorporates middeware (ExceptionMiddleware) and configuration logic. It acts as the gateway to the Application layer.
• Angular Web UI (Client-Side Presentation): A separate project (under Presentation.AngularWebUI) implementing the front end with Angular components, services, pages, and forms for user interactions – such as login, signup, creating or editing clients and loans.
Relationships and Interactions
• The Angular UI communicates with the backend Web API through HTTP/REST calls.
• The Web API layer receives requests, applies middleware (i.e., Exception handling, validation), and routes calls to the Application layer.
• The Application layer handles business logic through commands and queries. It uses dependency injection to invoke domain operations and dispatch repository calls.
• The Domain layer encapsulates entities and business rules, staying independent of external concerns.
• The Infrastructure layer provides implementations required for persistence and external data manipulation. It supports the Application layer by implementing repositories and mapping domain entities to database models.
Architectural Patterns and Design Principles
• Clean Architecture – separation of concerns into independent layers with dependencies directed inward (from Presentation to Application to Domain).
• Command/Query Responsibility Segregation (CQRS) as seen with distinct Command and Query folders inside the Application layer.
• Dependency Injection is clearly used across layers, as indicated by dedicated DependencyInjection.cs files in each layer.
• Repository Pattern in the Infrastructure layer that abstracts database operations.
• The Angular front end follows component-driven design patterns with clear separation between pages, forms, and services.
Relevant Technologies and Frameworks
• .NET (Core) is used for the backend (WebApi, Application, Domain, Infrastructure).
• Entity Framework Core is likely used for persistence (given the DbContext and repository implementations).
• Angular (with TypeScript) is used for the client-side UI.
• Additional supporting libraries include mapper libraries for transforming data between layers and possibly middleware for error handling and request validation.