# osoco/pharo-eda architecture

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

- Interactive diagram: https://gitdiagram.com/osoco/pharo-eda
- Repository: https://github.com/osoco/pharo-eda

## Overview

##### Main Components

- Framework Core & Baseline:
– The “src/BaselineOfPharoEDA” serves as the baseline that ties together the overall configuration.
- Domain Layer:
– “src/EDA-Domain” and “src/EDA-Domain-GT-Extensions” represent the central domain logic and any extensions that enhance the Domain-Driven Design aspects (e.g., aggregates and domain events).
- Application Layer:
– “src/EDA-Application” and related tests (“src/EDA-Application-Tests”) illustrate how commands are handled on the application level, coordinating between inbound commands and domain operations.
- Commands and Events:
– “src/EDA-Commands” and “src/EDA-Commands-Tests” show the dedicated handling of commands.
– “src/EDA-Events” manages event definitions.
- Event Store:
– “src/EDA-EventStore” as well as “src/EDA-Voyage-EventStore” reflect the event sourcing mechanism where events are persisted.
- Messaging Infrastructure:
– “src/EDA-Messaging” (and “src/EDA-StompMessaging”) indicate the components responsible for message encoding/decoding and handling the messaging protocols.
- Projections, Logging, and Serializers:
– “src/EDA-Projections” and its related test modules manage the read models or projectors.
– “src/EDA-Logging” is dedicated to logging concerns.
– “src/EDA-Serializers” likely deals with converting domain objects to/from other representations.
- Tools and Traits:
– “src/EDA-Tools” and “src/EDA-Traits” provide helpful behaviors, patterns, and common utilities.
- Migration & Testing:
- Documentation Stories:
– The “stories/modularization” directory offers narrative chapters that help explain how the system is modularized, which can be useful for understanding overall interactions.

##### Relationships and Interactions

- Next, the “EDA-Commands” component receives the command which is then handed over to the “Application Layer” (EDA-Application), which in turn routes it to the appropriate domain aggregate in “EDA-Domain”.
- The aggregate processes the command, “applies” the resulting event(s) (as indicated in the README’s sample apply methods), and then these events are stored via the “EDA-EventStore”.
- Finally, events can be republished to an exchange (again noted in the README), handled by the messaging components (EDA-Messaging/EDA-StompMessaging), and optionally projected into read models (EDA-Projections).

– Additionally, highlight auxiliary interactions:
- Logging is interwoven across modules (EDA-Logging).
- Serializers (EDA-Serializers) ensure that commands and events have a standard JSON or BSON representation.
- Domain extensions and traits (EDA-Domain-GT-Extensions, EDA-Traits) provide a layer of abstraction and standard behaviors common across modules.

##### Important Architectural Patterns and Design Principles

– Domain-Driven Design: The separation of concerns between Domain, Application, and Infrastructure is baked into the framework. Represent the aggregates (domain models), repositories (via event store adapters), and command handlers as distinct modules.
– Event Sourcing: Illustrate how commands are received and translated into events, which then reconstruct the domain state.
– Code Generation: The README mentions generators (like MyDomainGenerator) that help bridge command names with event names. You may note this as an auxiliary “Generator” or “Adapter” component that automates some wiring between the layers.

##### Relevant Technologies, Frameworks, and Libraries

– Pharo Smalltalk is the base language/platform.
– RabbitMQ (for messaging) and MongoDB (via Voyage) for event storage are key external systems.
– Gradle build configuration files indicate that Gradle is used to manage builds and possibly dependency resolution.

- Each module should be represented as a clearly labeled component (e.g., “EDA-Commands”, “EDA-Domain”, “EDA-EventStore”, “EDA-Messaging”, etc.).
– Command flow from external systems (RabbitMQ) into the Application layer,
– The subsequent invocation of domain aggregates,
– The event creation and persistence in the Event Store,
– The publishing of events via messaging channels.
- Where configuration (build.gradle, gradle files) and code generation (EDAGenerator descendant) come into play.

##### Final Reminders

– Avoid oversimplification: since the project is highly modular, it is best to break it into as many meaningful components as possible.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Layer
    subgraph "External Systems"
        ext("RabbitMQ/Client"):::external
    end

    %% Framework Core
    subgraph "Framework Core"
        baseline("BaselineOfPharoEDA"):::auxiliary
    end

    %% Application Layer
    subgraph "Application Layer"
        edaApp("EDA-Application"):::application
        cmd("EDA-Commands"):::application
        evtDef("EDA-Events"):::application
        appTests("EDA-Application-Tests"):::auxiliary
        cmdTests("EDA-Commands-Tests"):::auxiliary
    end

    %% Domain Layer
    subgraph "Domain Layer"
        domainCore("EDA-Domain"):::domain
        domainExt("EDA-Domain-GT-Extensions"):::domain
    end

    %% Event Sourcing & Persistence
    subgraph "Event Store"
        evtStore("EDA-EventStore"):::infrastructure
        voyageStore("EDA-Voyage-EventStore"):::infrastructure
    end

    %% Messaging Infrastructure
    subgraph "Messaging Layer"
        messaging("EDA-Messaging"):::infrastructure
        stomp("EDA-StompMessaging"):::infrastructure
    end

    %% Projections
    subgraph "Projections"
        proj("EDA-Projections"):::infrastructure
        projVoyage("EDA-Projections-Voyage-Repository"):::infrastructure
        projTests("EDA-Projections-Tests"):::auxiliary
    end

    %% Auxiliary & Tools
    subgraph "Auxiliary Components"
        logging("EDA-Logging"):::auxiliary
        serializers("EDA-Serializers"):::auxiliary
        tools("EDA-Tools"):::auxiliary
        traits("EDA-Traits"):::auxiliary
        migration("EDA-Multimodule-Migration"):::auxiliary
        migrationTests("EDA-Multimodule-Migration-Tests"):::auxiliary
        toolsTests("EDA-Tools-Tests"):::auxiliary
        traitsTests("EDA-Traits-Tests"):::auxiliary
        stories("Documentation Stories"):::auxiliary
    end

    %% Main Flow Connections
    ext -->|"deliversCommand"| cmd
    cmd -->|"forwardsTo"| edaApp
    edaApp -->|"invokes"| domainCore
    edaApp -->|"invokes"| domainExt
    domainCore -->|"producesEvent"| evtDef
    domainExt -->|"enhancesEvent"| evtDef
    evtDef -->|"persistsTo"| evtStore
    evtDef -->|"persistsTo"| voyageStore
    evtStore -->|"triggersMessaging"| messaging
    voyageStore -->|"triggersMessaging"| messaging
    messaging -->|"supports"| stomp
    messaging -->|"deliversEvent"| proj
    stomp -->|"supports"| proj
    proj -->|"updates"| projVoyage

    %% Baseline config wired to layers
    baseline --- edaApp
    baseline --- domainCore
    baseline --- evtStore
    baseline --- messaging
    baseline --- logging
    baseline --- serializers
    baseline --- tools
    baseline --- traits
    baseline --- migration
    baseline --- stories

    %% Test Connections (dashed lines)
    appTests -.-> edaApp
    cmdTests -.-> cmd
    projTests -.-> proj
    toolsTests -.-> tools
    traitsTests -.-> traits
    migrationTests -.-> migration

    %% Styling Classes
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef application fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef domain fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef infrastructure fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef auxiliary fill:#FFB6C1,stroke:#000,stroke-width:2px;

    %% Click Events for Component Mapping
    click baseline "https://github.com/osoco/pharo-eda/tree/develop/src/BaselineOfPharoEDA"
    click domainCore "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Domain"
    click domainExt "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Domain-GT-Extensions"
    click edaApp "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Application"
    click appTests "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Application-Tests"
    click cmd "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Commands"
    click cmdTests "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Commands-Tests"
    click evtDef "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Events"
    click evtStore "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-EventStore"
    click voyageStore "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Voyage-EventStore"
    click messaging "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Messaging"
    click stomp "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-StompMessaging"
    click proj "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Projections"
    click projVoyage "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Projections-Voyage-Repository"
    click projTests "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Projections-Tests"
    click logging "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Logging"
    click serializers "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Serializers"
    click tools "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Tools"
    click toolsTests "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Tools-Tests"
    click traits "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Traits"
    click traitsTests "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Traits-Tests"
    click migration "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Multimodule-Migration"
    click migrationTests "https://github.com/osoco/pharo-eda/tree/develop/src/EDA-Multimodule-Migration-Tests"
    click stories "https://github.com/osoco/pharo-eda/tree/develop/stories/modularization"
```
