This repository demonstrates a clean implementation of Domain-Driven Design concepts, patterns, and best practices. It serves as both a learning resource and a foundation for building DDD-based applications.
The solution follows a layered DDD architecture:
📦 Domain_Driven_Design
├── 📂 src
│ ├── 📂 1.Core
│ | ├── 📂 Domain # Contains all core business logic:
│ | | ├── 🏷 Aggregates # - Transactional consistency boundaries
│ | | ├── 🏷 ValueObjects # - Immutable domain elements
│ | | ├── 🎯 Entities # - Mutable domain objects with identity
│ | | └── 🎫 DomainEvents # - Domain state change notifications
│ | |
│ | └── 📂 Application # Mediates between domain and infrastructure:
│ | ├── 🎭 DTOs # - Data Transfer Objects for APIs
│ | ├── 🏗️ UseCases # - Application-specific workflows
│ | └── 🏫 Services # - Domain coordination logic
│ |
│ ├── 📂 2.Infrastructure # Concrete implementations:
│ | ├── 📂 SQL # - Database schema definitions
│ | ├── 📂 SQLCommand # - Write operations (CQRS)
│ | └── 📂 SQLQuery # - Read operations (CQRS)
│ |
│ ├── 📂 3.EndPoints # Delivery mechanisms:
│ | ├── 📂 WebApi # - REST/GraphQL endpoints
│ | └── 📂 WebApp # - MVC/Razor Pages UI
│ |
│ ├── 📂 4.Tests # Test suites:
│ | ├── 📂 UnitTests # - Domain model validation
│ | └── 📂 IntegrationTests # - Cross-component tests
│ |
│ └── 📂 SharedKernel # Cross-cutting concerns:
│ | ├── 📂 Utilities # - Common helper methods
│ └────── 📂 WebService # - Reusable web components
│
└── 📂 docs # Architecture decision records:
├── 📜 ADRs.md # - Architectural decisions
└── 🗺️ ContextMaps.md # - Bounded context relationships
-
Strict Layer Dependencies:
- EndPoints → Application → Domain
- Infrastructure implements interfaces defined in Core
-
CQRS Pattern:
- Clear separation between Command (SQLCommand) and Query (SQLQuery) stacks
-
Test Pyramid:
- Unit tests focus on domain purity
- Integration tests verify component interactions
-
Shared Kernel:
- Common utilities without domain coupling
- Reusable web components for consistency
-
Documentation:
- ADRs capture architectural decisions
- Context maps visualize bounded contexts
- Ubiquitous Language (Clear domain terminology)
- Bounded Contexts (Explicit context boundaries)
- Aggregates (Transaction boundaries)
- Value Objects (Immutable domain elements)
- Domain Events (Event-driven architecture)
- Repositories (Persistence abstraction)
- Specifications (Query encapsulation)
- .NET 6.0+ SDK
- Docker (for database container)
- IDE (Visual Studio, Rider, VSCode)
-
Clone the repository:
git clone https://github.com/KTajerbashi/Domain_Driven_Design.git
- Domain-Driven Design Fundamentals
- Implementing Domain-Driven Design - Vaughn Vernon
- DDD Reference by Eric Evans (PDF)
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.