Skip to content

Setup module DDD Bounded Context ★★★★ Expert ~30 min

Contexte

Domain-Driven Design (DDD) organise le code en Bounded Contexts isolés. Créer toute l'architecture (layers, ports, adapters) manuellement est long.

Objectif

Générer un module DDD complet avec :

  • ✅ Domain layer (Entities, Value Objects, Aggregates)
  • ✅ Application layer (Use Cases, Commands, Queries)
  • ✅ Infrastructure layer (Repositories, Adapters)
  • ✅ Presentation layer (Controllers, DTOs)
  • ✅ Tests pour chaque layer

Prérequis

Plugins :

Outils :

  • Symfony
  • Doctrine ORM

Workflow

Commande :

bash
/prompt:architecture Catalog

Structure générée :

src/Catalog/
├── Domain/
│   ├── Model/
│   │   ├── Product.php
│   │   └── Category.php
│   ├── ValueObject/
│   │   ├── ProductName.php
│   │   └── Price.php
│   └── Repository/
│       └── ProductRepositoryInterface.php
├── Application/
│   ├── Command/
│   │   └── CreateProductCommand.php
│   ├── Query/
│   │   └── FindProductQuery.php
│   └── Handler/
│       ├── CreateProductHandler.php
│       └── FindProductHandler.php
├── Infrastructure/
│   ├── Persistence/
│   │   └── DoctrineProductRepository.php
│   └── Adapter/
│       └── ElasticsearchProductAdapter.php
└── Presentation/
    ├── Controller/
    │   └── ProductController.php
    └── DTO/
        └── ProductDto.php

Principes DDD appliqués

  • Ubiquitous Language : termes métier partout
  • Aggregates : cohérence transactionnelle
  • Value Objects : immutabilité
  • Repositories : interfaces dans Domain
  • Hexagonal Architecture : ports & adapters

Liens Connexes

Use cases :

Plugins :

Publié sous licence MIT