# cardano-foundation/originate architecture

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

- Interactive diagram: https://gitdiagram.com/cardano-foundation/originate
- Repository: https://github.com/cardano-foundation/originate

## Overview

##### Project type and purpose
- Originate is a full-stack, modular, traceability platform.
- A Spring Boot REST API (“api” module) for business workflows and off-chain storage in PostgreSQL.
- A React single-page dashboard (“frontend”).
- An Ionic/Capacitor mobile app (“mobileapp”).
- A suite of Metabus microservices for packaging, batching, submitting, and watching Cardano transactions.
- Supporting infrastructure (Kafka, RabbitMQ, MinIO, Keycloak, Cardano node).

##### File structure
- Top-level folders:
- api/ – Spring Boot service with controllers, business, repository, RabbitMQ consumer, Flyway migrations.
- frontend/ – React + Material UI dashboard.
- mobileapp/ – Ionic/Capacitor PWA and native mobile.
- metabus/ – subfolders for:
– cardano-metabus-api (ingestion REST + Kafka producer)
– cardano-metabus-jobproducer (batching, on-chain job creation via Kafka)
– cardano-metabus-offchain-storage (MinIO object store)
– cardano-metabus-txsubmitter (Kafka consumer → build & submit Tx to Cardano node)
– cardano-metabus-txwatcher (watch chain confirmations → RabbitMQ)
- config/, docker-compose*.yml, .env.*, Keycloak and RabbitMQ setup scripts, Makefile, Maven wrapper.

##### README for additional insights
- Confirms role-based API, PostgreSQL off-chain, push jobs to Metabus, which:
1. Enqueues on Kafka
2. Stores JSON in object storage
3. Picks UTXO, builds & submits metadata Tx
4. Watches confirmation, returns result via RabbitMQ.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        WebUI["Web UI (React Dashboard)"]:::ui
        MobileUI["Mobile UI (Ionic App)"]:::ui
    end

    %% API Layer
    subgraph "API Layer"
        direction TB
        API["API Service (Spring Boot)"]:::service
        Auth["Auth (Keycloak)"]:::infra
        DB["PostgreSQL DB"]:::infra
    end

    %% Processing Layer
    subgraph "Processing Layer"
        direction TB
        MetabusAPI["Metabus REST API"]:::service
        JobProducer["Job Producer Service"]:::service
        OffchainStore["Off-chain Storage (MinIO)"]:::infra
        TxSubmitter["Tx Submitter Service"]:::service
        TxWatcher["Tx Watcher Service"]:::service
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        direction TB
        Kafka["Kafka Cluster"]:::infra
        RabbitMQ["RabbitMQ"]:::infra
        CardanoNode["Cardano Node (Yaci)"]:::infra
    end

    %% External Systems
    ExtScan["External ERP/Scantrust"]:::infra

    %% Connections
    WebUI -->|"HTTPS/REST + JWT"| API
    MobileUI -->|"HTTPS/REST + JWT"| API
    API -->|"JPA/Flyway"| DB
    API -->|"REST/JSON"| MetabusAPI
    API -->|"AMQP"| RabbitMQ
    MetabusAPI -->|"Kafka topic: jobs"| Kafka
    MetabusAPI -->|"PUT object"| OffchainStore
    Kafka -->|"consume jobs"| JobProducer
    JobProducer -->|"Kafka topic: batchedJobs"| Kafka
    Kafka -->|"consume batchedJobs"| TxSubmitter
    TxSubmitter -->|"submit Tx"| CardanoNode
    CardanoNode -->|"confirmations"| TxWatcher
    TxWatcher -->|"RMQ: confirmations"| RabbitMQ
    RabbitMQ -->|"consume confirmations"| API
    ExtScan -.->|"optional integration"| API

    %% Click Events
    click WebUI "https://github.com/cardano-foundation/originate/tree/main/frontend/"
    click MobileUI "https://github.com/cardano-foundation/originate/tree/main/mobileapp/"
    click API "https://github.com/cardano-foundation/originate/tree/main/api/"
    click MetabusAPI "https://github.com/cardano-foundation/originate/tree/main/metabus/cardano-metabus-api/"
    click JobProducer "https://github.com/cardano-foundation/originate/tree/main/metabus/cardano-metabus-jobproducer/"
    click OffchainStore "https://github.com/cardano-foundation/originate/tree/main/metabus/cardano-metabus-offchain-storage/"
    click TxSubmitter "https://github.com/cardano-foundation/originate/tree/main/metabus/cardano-metabus-txsubmitter/"
    click TxWatcher "https://github.com/cardano-foundation/originate/tree/main/metabus/cardano-metabus-txwatcher/"
    click Auth "https://github.com/cardano-foundation/originate/tree/main/metabus/keycloak-setup/"
    click RabbitMQ "https://github.com/cardano-foundation/originate/tree/main/metabus/rabbitmq-setup/"
    click Kafka "https://github.com/cardano-foundation/originate/blob/main/docker-compose.yml"
    click CardanoNode "https://github.com/cardano-foundation/originate/tree/main/config/"

    %% Styles
    classDef ui fill:#cfe2f3,stroke:#0366d6,color:#0366d6;
    classDef service fill:#d1e7dd,stroke:#198754,color:#198754;
    classDef infra fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
```
