This is a .NET 6 project following a Domain-Driven Design (DDD) and CQRS architecture pattern.
- .NET 6 SDK
- Docker
- SQL Server
- Clone this repository.
- Make sure you have Docker installed and running.
- Use the following command to start a SQL Server instance with Docker:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=YourStrong@Passw0rd' -p 1433:1433 --name sqlserver -v ~/docker-volumes/sqlserver-data:/var/opt/mssql -u root -d mcr.microsoft.com/mssql/server:2022-latest
- Open the solution in Visual Studio or your preferred IDE.
- Build the solution.
- Run the project.
This project follows a modular monolith approach with the following main layers:
- Api.Web: The main API project using a layered architecture.
- Api.Extensions: Extensions for configuring services like MediatR and global exception handling.
- Application: The core application logic, including CQRS commands and queries.
- Domain: The domain layer containing entities, value objects, and domain services.
- Domain.Abstract: Abstractions and interfaces for repositories and domain services.
- Persistence.EntityFramework: EF Core implementations for repository patterns and DB context.
- Modular Monolith with CQRS pattern.
- Clean architecture principles.
- Global exception handling with MediatR.
- Dependency injection setup for domain and application layers.
Ensure the appsettings.json
file is configured to point to your SQL Server instance. The connection string should look like this:
"ConnectionStrings": {
"DefaultConnection": "Server=localhost,1433;Database=QnADb;User Id=sa;Password=YourStrong@Passw0rd;"
}
Feel free to fork this project and create pull requests with your improvements.
This project is licensed under the MIT License.