How yuri9728/test-api works
Main Components
• Domain Layer: Represented by the Test.Domain folder, this layer contains the core business objects (e.g., Author, Book, Genre, User).
• Application Layer: Located in the Test.Application directory, this layer includes DTOs for request/response objects and mapping classes to transform domain entities into DTOs. It acts as an intermediary, ensuring that the presentation layer receives data in an appropriate format.
• Infrastructure Layer: Found in Test.Infrastructure, this includes the database context (AppDbContext) and Entity Framework migrations. It handles data persistence and integration with the database.
• Web API Layer: Within the Test.WebApi folder, this layer exposes HTTP endpoints for functionalities such as authentication and CRUD operations (book, author, and user endpoints). This is the entry point for external clients.
• Configuration & DevOps Components: Notice the Dockerfile, configuration files (appsettings.json, AuthenticationConfiguration, AuthorizationConfiguration, OpenApiConfiguration), and GitHub workflows (.github/workflows) for CI/CD.
Relationships and Interactions
• The Web API layer is responsible for handling HTTP requests and then invoking the appropriate logic within the Application layer.
• The Application layer uses mappers to convert incoming DTOs into Domain Entities, applying business rules and validations as needed.
• When persistence is required, the Application layer calls upon the Infrastructure layer (via the DbContext) to query or update the database.
• Authentication and Authorization configurations in the Web API layer ensure secure interactions.
Architectural Patterns and Design Principles
• Layered (Clean/Onion) Architecture: This separation of concerns improves maintainability and testability by isolating business logic (Domain) from data access (Infrastructure) and presentation (Web API).
• DTO and Mapper Usage: Clearly delineate how data is transformed between different layers.
• Configuration Separation: The presence of dedicated configuration folders indicates a well-structured approach to handling cross-cutting concerns like security, API documentation (OpenAPI), and environment-specific settings.
• CI/CD and Containerization: The inclusion of Docker-related files and GitHub workflow configurations underscores the project’s deployment and integration practices.
Relevant Technologies, Frameworks & Libraries
• .NET (with EF Core) is used for building the API.
• Entity Framework Core is used for managing the database through the AppDbContext and migrations.
• Docker is used for containerization (Dockerfile in the WebApi project).
• GitHub Actions (dotnet.yml) help with continuous integration.
• A clear label for each major component (Domain, Application, Infrastructure, Web API).
• Labels or annotations that describe data flow (e.g., “HTTP Request”, “Data Mapping”, “DB Transaction”).