# chebureque/iddd_samples architecture

> Architecture diagram of the GitHub repository chebureque/iddd_samples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chebureque/iddd_samples
- Repository: https://github.com/chebureque/iddd_samples

## Overview

##### Overall Structure and Main Components
– AgilePM Context (iddd_agilepm)
– Collaboration Context (iddd_collaboration)
– Identity & Access Context (iddd_identityaccess)
– Common Infrastructure/Components (iddd_common)

##### Within Each Bounded Context, Represent the Layers
– Application Layer: This includes application services (for example, the AgilePM application services, Collaboration’s calendar/forum application services, IdentityAccess’s RESTful services and command handling).
– Domain Layer: Represent the domain model objects, aggregates, and domain events. The AgilePM context has a rich domain for product, backlog items, sprints, and teams. Collaboration deals with event sourcing aspects and CQRS (split between command handling and the query/read model). IdentityAccess covers identity, authentication, authorization, and user management.
– Ports & Adapters Layer: Show the adapters used for messaging (RabbitMQ and SlothMQ listeners in AgilePM and Collaboration), persistence adapters (LevelDB in AgilePM, JDBC/MySQL-based projections in Collaboration, and ORM/Hibernate in IdentityAccess), as well as the RESTful resource adapters in IdentityAccess.

##### Interactions & Data Flow
– For instance, from application services to domain models.
– Indicate the integration between the command-side (Event Sourcing) and the query-side (MySQL projections) in the Collaboration context, showing the slight consistency trade-offs.

##### Infrastructure Components
- Persistence Mechanisms:
– AgilePM explicitly uses a LevelDB (pure Java) key-value store.
– Collaboration uses LevelDB for the event journal as well as MySQL for its CQRS read model.
– IdentityAccess uses Hibernate (with MySQL) for object–relational mapping.
- Messaging Components:
– Identify RabbitMQ (and its listeners/publishers) in IdentityAccess and some parts of AgilePM and Collaboration.
– Also indicate the role of SlothMQ listeners in agilepm and collaboration.
- That Docker is used for test/experiment setups (MySQL and RabbitMQ containers started by startContainers.sh).

##### Architectural Patterns & Technologies
- Domain-Driven Design principles by clearly demarcating bounded contexts.
- Layered architecture in each context (Application, Domain, Ports/Adapters).
- Use of Event Sourcing & CQRS in the Collaboration context.
- For IdentityAccess, highlight the integration of RESTful interfaces, ORM (Hibernate), and event notifications via messaging.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% AgilePM Bounded Context
    subgraph "AgilePM Bounded Context (iddd_agilepm)"
        direction TB
        APM_APP["AgilePM Application Layer"]:::appLayer
        APM_DOM["AgilePM Domain Layer"]:::domainLayer
        APM_MSG["AgilePM Messaging Adapters"]:::adapterLayer
        APM_PERS["AgilePM Persistence Adapters"]:::adapterLayer
        APM_APP -->|"calls"| APM_DOM
        APM_DOM -->|"publishes_events_to"| APM_MSG
        APM_DOM -->|"persists_to"| APM_PERS
    end

    %% Collaboration Bounded Context
    subgraph "Collaboration Bounded Context (iddd_collaboration)"
        direction TB
        COL_APP["Collaboration Application Layer"]:::appLayer
        COL_DOM["Collaboration Domain Layer"]:::domainLayer
        COL_MSG["Collaboration Messaging Adapters"]:::adapterLayer
        COL_PERS["Collaboration Persistence Adapters"]:::adapterLayer
        COL_READ["Collaboration Read Model_(CQRS)"]:::adapterLayer
        COL_DB["Collaboration DB Scripts"]:::infrastructure
        COL_APP -->|"calls"| COL_DOM
        COL_DOM -->|"triggers_events_to"| COL_MSG
        COL_DOM -->|"persists_events_to"| COL_PERS
        COL_PERS -->|"updates"| COL_READ
    end

    %% Identity & Access Bounded Context
    subgraph "Identity & Access Bounded Context (iddd_identityaccess)"
        direction TB
        ID_APP["IdentityAccess Application Layer"]:::appLayer
        ID_DOM["IdentityAccess Domain Layer"]:::domainLayer
        ID_REST["IdentityAccess REST Adapters"]:::adapterLayer
        ID_PERS["IdentityAccess Persistence"]:::adapterLayer
        ID_DB["IdentityAccess DB Config"]:::infrastructure
        ID_RES["IdentityAccess Resources"]:::infrastructure
        ID_APP -->|"calls"| ID_DOM
        ID_DOM -->|"exposes_via"| ID_REST
        ID_DOM -->|"persists_using"| ID_PERS
    end

    %% Common Infrastructure/Components
    subgraph "Common Infrastructure/Components (iddd_common)"
        direction TB
        COM_SHARED["Common Shared Domain & Library"]:::adapterLayer
        COM_EVENT["Common Event Infrastructure"]:::adapterLayer
        COM_BASE["Common Adapter Base Classes"]:::adapterLayer
        COM_PERS["Common Persistence Adapters"]:::adapterLayer
        COM_SPRING["Common Spring Configuration"]:::adapterLayer
    end

    %% External Infrastructure
    subgraph "External Infrastructure"
        direction TB
        EXT_LVLDB["LevelDB"]:::external
        EXT_MYSQL["MySQL"]:::external
        EXT_RMQ["RabbitMQ"]:::external
        EXT_DOCKER["Docker_Containers_(MySQL_&_RabbitMQ)"]:::external
    end

    %% Internal to External Relationships
    APM_PERS -->|"stores_data"| EXT_LVLDB
    COL_PERS -->|"stores_events"| EXT_LVLDB
    COL_READ -->|"queries"| EXT_MYSQL
    ID_PERS -->|"stores_objects"| EXT_MYSQL
    APM_MSG -->|"sends_message"| EXT_RMQ
    COL_MSG -->|"sends_message"| EXT_RMQ
    ID_REST -->|"publishes_events"| EXT_RMQ
    COM_EVENT -->|"integrates_with"| EXT_RMQ
    EXT_DOCKER -->|"hosts"| EXT_MYSQL
    EXT_DOCKER -->|"hosts"| EXT_RMQ

    %% Cross-context Common Integrations
    APM_PERS -->|"uses_common_adapter"| COM_PERS
    COL_MSG -->|"uses_event_infra"| COM_EVENT
    ID_PERS -->|"uses_ORM_support"| COM_BASE
    APM_DOM ---|"shares_domain"| COM_SHARED
    COL_DOM ---|"shares_domain"| COM_SHARED
    ID_DOM ---|"shares_domain"| COM_SHARED

    %% Styling Classes
    classDef appLayer fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef domainLayer fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef adapterLayer fill:#fff3cd,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#f8d7da,stroke:#333,stroke-width:2px;
    classDef external fill:#e2e3e5,stroke:#333,stroke-width:2px;

    %% Click Events for AgilePM
    click APM_APP "https://github.com/chebureque/iddd_samples/tree/master/iddd_agilepm/src/main/java/com/saasovation/agilepm/application"
    click APM_DOM "https://github.com/chebureque/iddd_samples/tree/master/iddd_agilepm/src/main/java/com/saasovation/agilepm/domain/model"
    click APM_MSG "https://github.com/chebureque/iddd_samples/tree/master/iddd_agilepm/src/main/java/com/saasovation/agilepm/port/adapter/messaging"
    click APM_PERS "https://github.com/chebureque/iddd_samples/tree/master/iddd_agilepm/src/main/java/com/saasovation/agilepm/port/adapter/persistence"

    %% Click Events for Collaboration
    click COL_APP "https://github.com/chebureque/iddd_samples/tree/master/iddd_collaboration/src/main/java/com/saasovation/collaboration/application"
    click COL_DOM "https://github.com/chebureque/iddd_samples/tree/master/iddd_collaboration/src/main/java/com/saasovation/collaboration/domain/model"
    click COL_MSG "https://github.com/chebureque/iddd_samples/tree/master/iddd_collaboration/src/main/java/com/saasovation/collaboration/port/adapter/messaging"
    click COL_PERS "https://github.com/chebureque/iddd_samples/tree/master/iddd_collaboration/src/main/java/com/saasovation/collaboration/port/adapter/persistence"
    click COL_READ "https://github.com/chebureque/iddd_samples/tree/master/iddd_collaboration/src/main/java/com/saasovation/collaboration/port/adapter/persistence/view"
    click COL_DB "https://github.com/chebureque/iddd_samples/tree/master/iddd_collaboration/src/main/mysql"

    %% Click Events for Identity & Access
    click ID_APP "https://github.com/chebureque/iddd_samples/tree/master/iddd_identityaccess/src/main/java/com/saasovation/identityaccess/application"
    click ID_DOM "https://github.com/chebureque/iddd_samples/tree/master/iddd_identityaccess/src/main/java/com/saasovation/identityaccess/domain/model"
    click ID_REST "https://github.com/chebureque/iddd_samples/tree/master/iddd_identityaccess/src/main/java/com/saasovation/identityaccess/resource"
    click ID_PERS "https://github.com/chebureque/iddd_samples/tree/master/iddd_identityaccess/src/main/java/com/saasovation/identityaccess/infrastructure/persistence"
    click ID_DB "https://github.com/chebureque/iddd_samples/tree/master/iddd_identityaccess/src/main/mysql"
    click ID_RES "https://github.com/chebureque/iddd_samples/tree/master/iddd_identityaccess/src/main/resources"

    %% Click Events for Common
    click COM_SHARED "https://github.com/chebureque/iddd_samples/tree/master/iddd_common/src/main/java/com/saasovation/common"
    click COM_EVENT "https://github.com/chebureque/iddd_samples/tree/master/iddd_common/src/main/java/com/saasovation/common/event"
    click COM_BASE "https://github.com/chebureque/iddd_samples/tree/master/iddd_common/src/main/java/com/saasovation/common/port/adapter"
    click COM_PERS "https://github.com/chebureque/iddd_samples/tree/master/iddd_common/src/main/java/com/saasovation/common/port/adapter/persistence"
    click COM_SPRING "https://github.com/chebureque/iddd_samples/tree/master/iddd_common/src/main/resources"
```
