# temporal-sa/temporal-money-transfer-java architecture

> Architecture diagram of the GitHub repository temporal-sa/temporal-money-transfer-java, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/temporal-sa/temporal-money-transfer-java
- Repository: https://github.com/temporal-sa/temporal-money-transfer-java

## Overview

##### Project Type & Purpose
- This is a sample “money transfer” workflow application built on the Temporal Java SDK.
- It demonstrates core Temporal concepts (workflows, activities, signals, updates, retries, schedules) and includes:
- A Worker process (executes workflows & activities)
- A Web Server (starts workflows, lists/renders status, sends signals/updates)
- A Svelte-based UI served as static assets
- An optional Spring Boot sample illustrating REST integration
- The project also includes Docker/Kubernetes configs and CI pipelines for deploying to a Temporal Server (local or cloud).

##### File Structure Analysis
- Top-level modules:
- core/ – main Java module: Temporal workflows (io.temporal.samples.moneytransfer.*), Activities, Worker (`AccountTransferWorker`), Web Server (`WebServer.java`), static UI under src/main/resources/svelte_ui/build
- springboot/ – Spring Boot sample with Controllers, Workflows & Activities (HelloWorld), templates, metrics
- Deployment & build:
- Dockerfile at root + docker/compose/K8s samples under sample-kubernetes-config/
- CI: .buildkite/pipeline.yml, GitHub Actions in .github/workflows/
- Config: application.yaml, Gradle build scripts, Gradle wrapper, Temporal namespace/env variables.

##### Key README Insights
- Components communicate with a Temporal Server (local or Cloud) via gRPC on port 7233.
- ENCRYPT_PAYLOADS flag toggles payload encryption.
- UI is prebuilt in core and served by WebServer; source is in a separate TypeScript repo.
- Spring Boot sample is optional and just shows another hosting model.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "User & UI"
        Browser["Browser"]:::external
        SvelteUI["Svelte UI\n(static assets)"]:::ui
    end

    subgraph "Core Java Services"
        subgraph "Service Processes"
            WebServer["Web Server"]:::services
            Worker["MoneyTransfer Worker"]:::services
            SpringApp["Spring Boot App"]:::services
        end
        subgraph "Core Module Components"
            Activities["AccountTransferActivities / Impl"]:::services
            Workflows["AccountTransferWorkflow / Impl"]:::services
            Client["TemporalClient"]:::services
            Ops["Requester, Lister, Approver,\nScheduler, TaskQueue Tools"]:::services
        end
    end

    subgraph "Temporal Backend"
        TemporalServer["Temporal Server\n(gRPC 7233)"]:::external
        TaskQueues["Task Queues & History"]:::infra
    end

    subgraph "CI/CD & Deployment"
        Pipeline["CI Pipeline"]:::infra
        Registry["Container Registry"]:::infra
        Deploy["K8s / Docker Compose"]:::infra
    end

    Browser -->|"HTTP GET/POST"| WebServer
    WebServer -->|"Serves UI Static Assets"| SvelteUI
    WebServer -->|"Uses Client"| Client
    Worker -->|"Uses Client"| Client
    SpringApp -->|"Uses Client"| Client

    Client -->|"gRPC"| TemporalServer
    Worker -->|"Polls Task Queues"| TaskQueues
    TemporalServer --> TaskQueues

    Pipeline --> Registry --> Deploy
    Deploy --> WebServer
    Deploy --> Worker

    classDef ui fill:#cce5ff,stroke:#333,stroke-width:1px;
    classDef services fill:#d4edda,stroke:#333,stroke-width:1px;
    classDef infra fill:#e2e3e5,stroke:#333,stroke-width:1px;
    classDef external fill:#fff3cd,stroke:#333,stroke-width:1px;

    click SvelteUI "https://github.com/temporal-sa/temporal-money-transfer-java/tree/main/core/src/main/resources/svelte_ui/build"
    click WebServer "https://github.com/temporal-sa/temporal-money-transfer-java/blob/main/core/src/main/java/io/temporal/samples/moneytransfer/web/WebServer.java"
    click Worker "https://github.com/temporal-sa/temporal-money-transfer-java/blob/main/core/src/main/java/io/temporal/samples/moneytransfer/AccountTransferWorker.java"
    click Activities "https://github.com/temporal-sa/temporal-money-transfer-java/blob/main/core/src/main/java/io/temporal/samples/moneytransfer/AccountTransferActivities.java"
    click Workflows "https://github.com/temporal-sa/temporal-money-transfer-java/blob/main/core/src/main/java/io/temporal/samples/moneytransfer/AccountTransferWorkflow.java"
    click Client "https://github.com/temporal-sa/temporal-money-transfer-java/blob/main/core/src/main/java/io/temporal/samples/moneytransfer/TemporalClient.java"
    click Pipeline "https://github.com/temporal-sa/temporal-money-transfer-java/blob/main/.buildkite/pipeline.yml"
    click Registry "https://github.com/temporal-sa/temporal-money-transfer-java/blob/main/docker/buildkite/docker-compose.yaml"
    click Deploy "https://github.com/temporal-sa/temporal-money-transfer-java/blob/main/sample-kubernetes-config/roles.yaml"
```
