# rotium/buckazoid architecture

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

- Interactive diagram: https://gitdiagram.com/rotium/buckazoid
- Repository: https://github.com/rotium/buckazoid

## Overview

##### Project Type Analysis
This is a specialized library project focused on money operations with two main modules:
- Core module: Handles basic money operations and type-safe DSL
- Contrib module: Provides external exchange rate service integration

##### Main Components

A. Core Components (Primary Layer):
- Money Type System
- Currency Management
- Money Operations
- DSL Implementation

B. Exchange Rate System (Secondary Layer):
- Exchange Rate Interface
- Currency Conversion Logic
- DateTime Handling

C. External Integration (Extension Layer):
- OpenExchangeRates Connector
- HTTP Client Integration

**┌─────────────────────────────────────────────┐**
- Client Code                   │
- ┘
- ↓
**┌─────────────────────────────────────────────┐**
- Buckazoid Core                 │
- ┬───────────────────────────┤
- Money Types    │     Currency System       │
- ┼───────────────────────────┤
- DSL Engine     │     Money Operations      │
- ┴───────────────────────────┘
- ↓
**┌─────────────────────────────────────────────┐**
- Exchange Rate System             │
- ┤
- Exchange Rate Interface             │
- ┘
- ↓
**┌─────────────────────────────────────────────┐**
- External Services              │
- (OpenExchangeRates API)            │
- ┘

##### Component Details

a. Core Module Components:
- MoneyContext.scala: Represent as a supporting component

b. Exchange Rate Components:
- ExchangeRate trait: Show as an interface
- PlayOpenExchangeRates implementation: Connect to external service
- Date/Time utilities: Show as a utility component

##### Flow Directions

Following flows:
- Money creation flow
- Currency conversion flow
- Exchange rate lookup flow
- External API interaction flow

##### Additional Elements

Include:

##### Implementation Notes

- Type-safe operations
- Immutable money values
- Asynchronous exchange rate operations
- External service integration points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        CC[Client Code]
    end

    subgraph Core["Core Layer"]
        MT["Money Type System"]:::core
        CM["Currency Management"]:::core
        DSL["DSL Implementation"]:::core
        MC["Money Context"]:::core
        DT["DateTime Utils"]:::core
        PC["Package Config"]:::core
    end

    subgraph Exchange["Exchange Rate System"]
        ERI["Exchange Rate Interface"]:::exchange
        CL["Conversion Logic"]:::exchange
    end

    subgraph External["External Integration"]
        OER["OpenExchangeRates Connector"]:::external
        HTTP["HTTP Client"]:::external
    end

    %% Relationships
    CC --> MT
    CC --> DSL
    
    MT --> CM
    MT --> MC
    DSL --> MT
    DSL --> MC
    MC --> CM
    
    MT --> ERI
    CM --> ERI
    ERI --> CL
    CL --> DT
    
    ERI --> OER
    OER --> HTTP

    %% Click Events
    click MT "https://github.com/rotium/buckazoid/blob/master/core/src/main/scala/com/vatbox/money/Money.scala"
    click CM "https://github.com/rotium/buckazoid/blob/master/core/src/main/scala/com/vatbox/money/Currency.scala"
    click DSL "https://github.com/rotium/buckazoid/blob/master/core/src/main/scala/com/vatbox/money/DSL.scala"
    click MC "https://github.com/rotium/buckazoid/blob/master/core/src/main/scala/com/vatbox/money/MoneyContext.scala"
    click DT "https://github.com/rotium/buckazoid/blob/master/core/src/main/scala/com/vatbox/money/DateTimeUtils.scala"
    click OER "https://github.com/rotium/buckazoid/blob/master/contrib/src/main/scala/com/vatbox/money/contrib/exchangerate/PlayOpenExchangeRates.scala"
    click PC "https://github.com/rotium/buckazoid/blob/master/core/src/main/scala/com/vatbox/money/package.scala"
    click ERI "https://github.com/rotium/buckazoid/tree/master/contrib/src/main/scala/com/vatbox/money/contrib/exchangerate/"

    %% Styling
    classDef core fill:#b3d9ff,stroke:#2980b9
    classDef exchange fill:#98fb98,stroke:#27ae60
    classDef external fill:#ffe5b4,stroke:#f39c12
    classDef default fill:#f9f9f9,stroke:#666

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Exchange Components"]:::exchange
        L3["External Services"]:::external
    end
```
