How lcps1/realstate works
Main Components
• API / Presentation Layer: Represented by the various API projects (e.g. src/RealState.Api) and controllers (AuthenticationController, PropertyController, etc.).
• Application Layer: Contains the command and query handlers, validators, and business logic (src/RealState.Application) that implement the use cases for property management, image management, authentication, etc.
• Domain Layer: Contains the core entities (PropertyBuilding, PropertyImage, Owner, etc.), domain events (OwnerCreated, PropertyPriceChanged), value objects, and interfaces that define the business rules (src/RealState.Domain).
• Infrastructure Layer: Manages data persistence and external integration with the database using Entity Framework Core, repository implementations, the Unit of Work, and migration management (src/RealState.Infrastructure).
• Contracts: This layer (src/RealState.Contracts) defines data transfer objects (DTOs) and shared models used for communication between layers or external systems.
• External Services: Include the SQL Server database (launched via Docker), Docker containers (referenced in docker-compose.yaml and Dockerfile), and any client tools used for testing (like Postman).
Relationships and Interactions
• That the application layer uses the domain layer (business logic, domain events) to ensure consistency.
• That the infrastructure layer is responsible for the actual data persistence, with repositories and the Unit of Work mediating between the domain and the database.
• Contracts layer as the mechanism for transferring data between the external API and internal processing.
• Dependency of each layer on the other, for example:
• API → Application (via Dependency Injection)
• Application → Domain (invoking domain services and publishing events)
• Application → Infrastructure (to persist data using repository interfaces)
• All layers may also communicate with external services like the SQL Server container managed via Docker.
Incorporate Key Architectural Patterns
• Domain-Driven Design (DDD): Highlight how the Domain layer encapsulates entities, value objects, and domain events.
• Clean/Onion Architecture: Emphasize the separation between presentation, application, domain, and infrastructure.
• Command Handler Pattern: Mark the presence of commands and queries in the Application layer.
• Unit of Work and Repository Patterns: Specifically pinpoint where interfaces in the application and domain connect with concrete repository implementations in the infrastructure layer.
Relevant Technologies & Frameworks
• .NET 6+ (or later) and ASP.NET Core for the backend API.
• Entity Framework Core for ORM and database interactions.
• Testing frameworks with FluentAssertions and NSubstitute shown as part of the unit tests.
• Docker (docker-compose.yaml, Dockerfile) for containerizing the database (SQL Server).
• The use of dependency injection as configured across the application.