Skip to content

KTajerbashi/DDD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

183 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧮 Domain-Driven Design (DDD) Implementation 🖌

🔰 Domain-Driven Design 🔰

A practical implementation of Domain-Driven Design principles and patterns

📌 Overview

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.

🏗️ Architecture

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

Key Architectural Principles:

  1. Strict Layer Dependencies:

    • EndPoints → Application → Domain
    • Infrastructure implements interfaces defined in Core
  2. CQRS Pattern:

    • Clear separation between Command (SQLCommand) and Query (SQLQuery) stacks
  3. Test Pyramid:

    • Unit tests focus on domain purity
    • Integration tests verify component interactions
  4. Shared Kernel:

    • Common utilities without domain coupling
    • Reusable web components for consistency
  5. Documentation:

    • ADRs capture architectural decisions
    • Context maps visualize bounded contexts

🧩 Core Concepts Implemented

  • 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)

🚀 Getting Started

Prerequisites

  • .NET 6.0+ SDK
  • Docker (for database container)
  • IDE (Visual Studio, Rider, VSCode)

Installation

  1. Clone the repository:

    git clone https://github.com/KTajerbashi/Domain_Driven_Design.git

📚 Learning Resources

🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Built with ❤︎ by Kamran Tajerbashi

Releases

No releases published

Packages

 
 
 

Contributors

Languages