# lleonardogr/caixaverso architecture

> Architecture diagram of the GitHub repository lleonardogr/caixaverso, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lleonardogr/caixaverso
- Repository: https://github.com/lleonardogr/caixaverso

## Overview

##### Project type and purpose (from file tree + README)
This is a small **Java/Maven** project (single module, `pom.xml`) that looks like a **console/CLI banking simulation** or “cashier” domain model:
- **Entrypoint:** `fiap.tds.Main`
- **Core domain:** `Bank`, `Account`, `Transaction` + concrete transaction types (`Deposit`, `Withdrawl`, `TransferIn`, `TransferOut`)
- **Domain primitives/value objects:** `Money`, and identifier types (`AccountId`, `TransactionId`)
- **Utility/service:** `TxFmt` (likely transaction formatting for printing/statement)

There is no evidence of:
- web/API layer (no Spring, no controllers)
- persistence (no repositories, no `resources`, no DB drivers)
- multi-module architecture

##### File-structure-driven architecture (what to model)
Use the package layout as your “component boundaries”:

##### Runtime / Execution boundary
- `fiap.tds.Main`
**Role:** Process entrypoint; orchestrates interactions (likely reads input, calls `Bank`, prints output).

##### Core application/domain boundary
- `fiap.tds.Bank`
**Role:** Primary façade/service for banking operations. Likely coordinates accounts and transactions (create account, deposit, withdraw, transfer).
- `fiap.tds.entities.account.*`
- `Account`, `AccountId`
- `fiap.tds.entities.transaction.*`
- `Transaction`, `TransactionId`
- Concrete transaction types:
- `Deposit`
- `Withdrawl` (typo noted; still a distinct type)
- `TransferIn`
- `TransferOut`
- `fiap.tds.entities.valueObjects.Money`
**Role:** Domain value object to represent currency amounts safely.

##### Supporting/utility services
- `fiap.tds.services.TxFmt`
**Role:** Transaction formatting/presentation helper (likely transforms `Transaction` objects into strings for display/logging/statements).

##### Build/dependency boundary
- `pom.xml`

##### What the “system” is (and isn’t)
Since there’s no external infrastructure in the tree, treat this as:
- **Actor:** “User” (or “Operator”)
- **System:** “CaixaVerso CLI (Java process)”
- **Storage:** likely **in-memory collections** inside `Bank` (unless code says otherwise)
- **External services:** none visible

##### Important architectural patterns/design principles visible here
- **Domain-driven modeling:** Entities (`Account`, `Transaction`) + Value Object (`Money`) + IDs (`AccountId`, `TransactionId`)
- **Transaction polymorphism:** `Transaction` base type with subtype variations (deposit/withdraw/transfer in/out)
- **Single-process layered design:** CLI orchestration separated from domain model

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% =========================
    %% Zone 1 — System Context
    %% =========================
    subgraph "Zone 1 — System Context"
        User["User / Operator"]:::actor
        System["CaixaVerso CLI (Java Process)"]:::system
        User -->|"interacts"| System
    end

    %% =========================
    %% Zone 2 — Runtime Container (single process, layered)
    %% =========================
    subgraph "Zone 2 — Runtime (Single Process)"
        Main["fiap.tds.Main (CLI Entrypoint)"]:::entry

        subgraph "Application / Domain Facade"
            Bank["fiap.tds.Bank (Banking Core)"]:::core

            subgraph "In-Memory State (Java Collections)"
                AccountsStore[("Accounts Map<AccountId, Account>")]:::state
                TxStore[("Transactions Ledger List<Transaction>")]:::state
            end
        end

        subgraph "Supporting Services"
            TxFmt["fiap.tds.services.TxFmt (Transaction Formatter)"]:::svc
        end
    end

    %% =========================
    %% Zone 3 — Domain Model (Entities / Value Objects)
    %% =========================
    subgraph "Zone 3 — Domain Model"
        subgraph "Account Aggregate"
            Account["Account (Entity)"]:::entity
            AccountId["AccountId (Identifier)"]:::id
            Money["Money (Value Object)"]:::vo

            Account -->|"has"| AccountId
            Account -.->|"uses(balance)"| Money
        end

        subgraph "Transaction Model (Polymorphism)"
            Transaction["Transaction (Base Entity)"]:::entity
            TransactionId["TransactionId (Identifier)"]:::id

            Deposit["Deposit (Transaction)"]:::entity
            Withdrawl["Withdrawl (Transaction)"]:::entity
            TransferOut["TransferOut (Transaction)"]:::entity
            TransferIn["TransferIn (Transaction)"]:::entity

            Deposit -->|"extends"| Transaction
            Withdrawl -->|"extends"| Transaction
            TransferOut -->|"extends"| Transaction
            TransferIn -->|"extends"| Transaction

            Transaction -->|"has"| TransactionId
            Transaction -.->|"uses(amount)"| Money
        end
    end

    %% =========================
    %% Runtime Flow / Dependencies
    %% =========================
    System -->|"runs"| Main
    Main -->|"invoke(commands)"| Bank

    Bank -->|"manage"| Account
    Bank -->|"create/append"| Transaction

    Bank <-->|"read/write"| AccountsStore
    Bank <-->|"append/scan"| TxStore

    Main -->|"formatOutput"| TxFmt
    TxFmt -.->|"format"| Transaction
    TxFmt -.->|"format"| Money

    %% Optional domain association (common in such models)
    Account -.->|"records"| Transaction

    %% =========================
    %% Build / Packaging (non-runtime)
    %% =========================
    subgraph "Build / Packaging (Non-Runtime)"
        Pom["Maven Build (pom.xml)"]:::build
    end
    Pom -.->|"package"| System

    %% =========================
    %% Click Events (from component_mapping)
    %% =========================
    click Main "https://github.com/lleonardogr/caixaverso/blob/main/src/main/java/fiap/tds/Main.java"
    click Bank "https://github.com/lleonardogr/caixaverso/blob/main/src/main/java/fiap/tds/Bank.java"
    click Account "https://github.com/lleonardogr/caixaverso/blob/main/src/main/java/fiap/tds/entities/account/Account.java"
    click AccountId "https://github.com/lleonardogr/caixaverso/blob/main/src/main/java/fiap/tds/entities/account/AccountId.java"
    click Transaction "https://github.com/lleonardogr/caixaverso/blob/main/src/main/java/fiap/tds/entities/transaction/Transaction.java"
    click TransactionId "https://github.com/lleonardogr/caixaverso/blob/main/src/main/java/fiap/tds/entities/transaction/TransactionId.java"
    click Deposit "https://github.com/lleonardogr/caixaverso/blob/main/src/main/java/fiap/tds/entities/transaction/Deposit.java"
    click Withdrawl "https://github.com/lleonardogr/caixaverso/blob/main/src/main/java/fiap/tds/entities/transaction/Withdrawl.java"
    click TransferIn "https://github.com/lleonardogr/caixaverso/blob/main/src/main/java/fiap/tds/entities/transaction/TransferIn.java"
    click TransferOut "https://github.com/lleonardogr/caixaverso/blob/main/src/main/java/fiap/tds/entities/transaction/TransferOut.java"
    click Money "https://github.com/lleonardogr/caixaverso/blob/main/src/main/java/fiap/tds/entities/valueObjects/Money.java"
    click TxFmt "https://github.com/lleonardogr/caixaverso/blob/main/src/main/java/fiap/tds/services/TxFmt.java"
    click Pom "https://github.com/lleonardogr/caixaverso/blob/main/pom.xml"

    %% =========================
    %% Styles (Color/shape coding)
    %% =========================
    classDef actor fill:#e5e7eb,stroke:#6b7280,stroke-width:1px,color:#111827
    classDef system fill:#111827,stroke:#111827,stroke-width:1px,color:#ffffff
    classDef entry fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#0f172a
    classDef core fill:#bfdbfe,stroke:#1d4ed8,stroke-width:1.5px,color:#0f172a
    classDef svc fill:#ede9fe,stroke:#7c3aed,stroke-width:1.5px,color:#111827
    classDef entity fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#052e16
    classDef vo fill:#bbf7d0,stroke:#15803d,stroke-width:1.5px,color:#052e16
    classDef id fill:#86efac,stroke:#166534,stroke-width:1.5px,color:#052e16
    classDef state fill:#ffedd5,stroke:#ea580c,stroke-width:1.5px,color:#7c2d12
    classDef build fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
```
