How vaughnvernon/iddd_samples works
Project type and purpose
• This repository is a set of sample “Bounded Context”‐level reference projects illustrating Domain-Driven Design patterns. It is not a single monolith, but four related Java modules:
• iddd_common – shared reusable DDD infrastructure
• iddd_agilepm – an Agile Project Management domain using a key-value store (LevelDB)
• iddd_collaboration – a Collaboration domain using Event Sourcing + CQRS (LevelDB write store + MySQL read store)
• iddd_identityaccess – an Identity & Access domain using Hibernate ORM, REST APIs, and Domain-Event notifications (RabbitMQ & REST)
File structure
• Top‐level modules: iddd_common, iddd_agilepm, iddd_collaboration, iddd_identityaccess
• Each module follows a layered architecture:
– application (ApplicationService classes / commands / queries / DTOs)
– domain (aggregate roots, entities, value objects, domain events, repositories)
– port.adapter
• persistence (LevelDB, Hibernate, Event Store, JDBC projections)
• messaging (RabbitMQ, SlothMQ listeners & publishers)
• REST resources (in identityaccess)
• Collaboration module adds a separate “read model” under port.adapter.persistence.view (MySQL projections)
• Build & orchestration: Gradle scripts, settings.gradle, Docker startup (startContainers.sh)
README for additional insights
• AgilePM: no container framework, pure Java + LevelDB
• Collaboration: intentionally demonstrates event sourcing + CQRS with two stores (LevelDB event journal, MySQL read model)
• IdentityAccess: uses Hibernate ORM, exposes RESTful resources, publishes domain events via RabbitMQ and REST logs
• Common: a library of domain-driven abstractions (entities, event sourcing, notification, messaging adapters)
A. Bounded Contexts (as separate “microservice” components)
1. AgilePM Context
– Application Layer
– Domain Layer (AgilePM aggregates)
– Persistence Adapter: LevelDB
– Messaging Adapters: RabbitMQ / SlothMQ listeners for inbound domain events
2. Collaboration Context
– Application Layer (Calendar, Forum services)
– Domain Layer (Event-sourced aggregates)
– Event Store Adapter: LevelDB journal
– CQRS Read-Model Adapter: MySQL
– Messaging Adapter: RabbitMQ event dispatcher
3. IdentityAccess Context
– REST Resources (JAX-RS controllers)
– Application Layer (Identity & Access services)
– Domain Layer (User, Tenant, Group aggregates)
– Persistence Adapter: Hibernate (MySQL)
– Notification Adapter: RabbitMQ + REST logging
B. Shared Common Module
– Domain-driven building blocks: Entity, ValueObject, DomainEventPublisher, EventStore interface, Messaging abstractions
C. External Services / Infrastructure
– LevelDB (embedded Java implementation)
– MySQL (read model for collaboration, identityaccess schema)
– RabbitMQ (message bus for events & notifications)
– SlothMQ (alternate lightweight message bus)
– Docker‐based container orchestration (MySQL + RabbitMQ)
Relationships & interactions
• ApplicationService → Domain aggregates → Repository → Persistence Adapter
• Domain publishes DomainEvents → DomainEventPublisher → Messaging or EventStore
• Collaboration: events appended to LevelDB → dispatched to MySQL projections → consumed by QueryServices
• IdentityAccess: commands via REST → ApplicationService → Domain → Hibernate → DomainEvents → RabbitMQ → other contexts
• AgilePM: inbound domain events (e.g., BacklogItemCommitted) arrive via RabbitMQ/SlothMQ → ApplicationService → Domain → LevelDB
Architectural patterns & design principles
• Layered architecture (Application → Domain → Port/Adapters)
• Hexagonal (Ports & Adapters)
• Event Sourcing (collaboration)
• CQRS (collaboration: separate read/write models)
• Domain-Driven Design: aggregates, bounded contexts, domain events
• Shared kernel pattern (iddd_common library across contexts)
Technologies & frameworks
• Java 7, Gradle
• LevelDB (pure Java)
• MySQL (JDBC + Hibernate)
• RabbitMQ, SlothMQ
• Spring XML contexts for wiring adapters (in collaboration & identityaccess)
• RESTful resources (JAX-RS or Spring MVC style in identityaccess)
Detail without over‐complication
• Four modules and their dependencies
• Dual storage strategy in collaboration (LevelDB vs MySQL)
• How identityaccess bridges domain events to external notifications
• Don’t try to show every class—focus on layers, adapters, stores, and messaging endpoints