# flowerautomation/flower architecture

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

- Interactive diagram: https://gitdiagram.com/flowerautomation/flower
- Repository: https://github.com/flowerautomation/flower

## Overview

##### Main Components
- Core Abstraction/Protocol Layer:
- This includes components like “flower-common” (which contains shared configuration, credentials, macros, and other common code) and “flower-proto” (which defines the common protocols for messaging, repositories, teams, and trackers).
- Integration Implementations:
- Several separate modules exist for different integrations, including:
- flower-integration-default
- flower-integration-exchange
- flower-integration-github
- flower-integration-gitlab
- flower-integration-jira
- flower-integration-slack
- flower-integration-tfs
- These modules implement the protocols defined in the core layer (and often use the “checkouts” mechanism to include common dependencies and shared logic).
- Feature-Specific Libraries:
- flower-messaging (for messaging functions),
- flower-repository (for repository functions),
- flower-team (for team-related functionalities),
- flower-tracker (for task tracking functions),
- flower-utilities (for miscellaneous utilities).
- Build/Template Components:
- The “lein-template” directory shows that Flower provides a project template, which can be considered an optional layer for users setting up new applications using Flower.

##### Relationships and Data Flow
- Each integration module (such as flower-integration-github or flower-integration-jira) implements specific interfaces defined by the core. They might also interact with the higher-level service libraries (messaging, repository, tracker) which provide a simplified API for external consumers.
- The feature libraries (like flower-tracker) interact with the corresponding integration modules to perform operations such as accessing tasks, merging pull requests, or sending notifications. Data flows from an external consumer (for example, via the command-line interface or an Emacs package) to these core functionalities.
- Optionally, show the build and deployment part (e.g., project.clj and configuration resources), which are used for building and deploying Flower as both a library and an Emacs package.

##### Architectural Patterns and Design Principles
- Dependency Inversion: The integrations depend on the abstract protocols (in flower-proto) rather than a concrete implementation, which allows you to swap different systems with ease.
- Use of “checkouts”: Many integration modules include “checkouts” of common libraries (such as flower-common or flower-proto), which illustrates a dependency reuse strategy within the project.
- Layered Architecture: Clearly separate the core abstraction (protocol layer), the integration implementations, and the higher-level usage libraries (messaging, tracker, etc.).

##### Elements
- An annotation that the project uses Leiningen for building and that it adheres to a modular design with well-separated integration concerns.

##### Important Additional Notes
- Extensibility: Indicate that new integrations can be added due to the protocol-based design and modular structure.
- Adding metadata like key configuration paths (e.g., configuration files in flower-common/resources/config.edn) and mention the use of caching (as per the README’s note on implicit caching and cache clearing macros).

## Diagram (Mermaid)

```mermaid
flowchart TD
    U["User/Application"]:::user
    T["Project Template"]:::template

    subgraph "Feature Libraries"
        FM["flower-messaging"]:::feature
        FR["flower-repository"]:::feature
        FT["flower-team"]:::feature
        FTR["flower-tracker"]:::feature
        FU["flower-utilities"]:::feature
    end

    subgraph "Integration Modules"
        ID["flower-integration-default"]:::integration
        IE["flower-integration-exchange"]:::integration
        IG["flower-integration-github"]:::integration
        IL["flower-integration-gitlab"]:::integration
        IJ["flower-integration-jira"]:::integration
        IS["flower-integration-slack"]:::integration
        IT["flower-integration-tfs"]:::integration
    end

    subgraph "Core Protocols"
        FC["flower-common"]:::core
        FP["flower-proto"]:::core
    end

    %% User/Application consumes Feature Libraries
    U -->|"consumes"| FM
    U -->|"consumes"| FR
    U -->|"consumes"| FT
    U -->|"consumes"| FTR
    U -->|"consumes"| FU

    %% Integration Modules interact with Feature Libraries (representative interactions)
    IG -->|"interacts"| FM
    IL -->|"interacts"| FR
    IJ -->|"interacts"| FTR
    IS -->|"interacts"| FT
    IT -->|"interacts"| FU
    ID -->|"interacts"| FU
    IE -->|"interacts"| FM

    %% Core Protocols provide protocols to Integration Modules
    FC -->|"protocol"| ID
    FC -->|"protocol"| IE
    FC -->|"protocol"| IG
    FC -->|"protocol"| IL
    FC -->|"protocol"| IJ
    FC -->|"protocol"| IS
    FC -->|"protocol"| IT

    FP -->|"protocol"| ID
    FP -->|"protocol"| IE
    FP -->|"protocol"| IG
    FP -->|"protocol"| IL
    FP -->|"protocol"| IJ
    FP -->|"protocol"| IS
    FP -->|"protocol"| IT

    %% Project Template supports project setup by users
    T -->|"creates"| U

    %% Click Events for Core Protocols
    click FC "https://github.com/flowerautomation/flower/tree/master/flower-common"
    click FC "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-common"
    click FP "https://github.com/flowerautomation/flower/tree/master/flower-proto"
    click FP "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-proto"

    %% Click Events for Integration Implementations
    click ID "https://github.com/flowerautomation/flower/tree/master/flower-integration-default"
    click ID "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-integration-default"
    click IE "https://github.com/flowerautomation/flower/tree/master/flower-integration-exchange"
    click IE "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-integration-exchange"
    click IG "https://github.com/flowerautomation/flower/tree/master/flower-integration-github"
    click IG "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-integration-github"
    click IL "https://github.com/flowerautomation/flower/tree/master/flower-integration-gitlab"
    click IL "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-integration-gitlab"
    click IJ "https://github.com/flowerautomation/flower/tree/master/flower-integration-jira"
    click IJ "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-integration-jira"
    click IS "https://github.com/flowerautomation/flower/tree/master/flower-integration-slack"
    click IS "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-integration-slack"
    click IT "https://github.com/flowerautomation/flower/tree/master/flower-integration-tfs"
    click IT "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-integration-tfs"

    %% Click Events for Feature Libraries
    click FM "https://github.com/flowerautomation/flower/tree/master/flower-messaging"
    click FM "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-messaging"
    click FR "https://github.com/flowerautomation/flower/tree/master/flower-repository"
    click FR "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-repository"
    click FT "https://github.com/flowerautomation/flower/tree/master/flower-team"
    click FT "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-team"
    click FTR "https://github.com/flowerautomation/flower/tree/master/flower-tracker"
    click FTR "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-tracker"
    click FU "https://github.com/flowerautomation/flower/tree/master/flower-utilities"
    click FU "https://github.com/flowerautomation/flower/tree/master/checkouts/flower-utilities"

    %% Click Event for Project Template
    click T "https://github.com/flowerautomation/flower/tree/master/lein-template"

    %% Styles
    classDef user fill:#f9f,stroke:#333,stroke-width:2px;
    classDef template fill:#ffe4b5,stroke:#333,stroke-width:2px;
    classDef core fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef integration fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef feature fill:#ffb6c1,stroke:#333,stroke-width:2px;
```
