# sagahealthcareit/mirthsync architecture

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

- Interactive diagram: https://gitdiagram.com/sagahealthcareit/mirthsync
- Repository: https://github.com/sagahealthcareit/mirthsync

## Overview

mirthSync is a command-line tool for synchronizing Mirth Connect and Open Integration Engine configurations with local files and Git. Its main workflow accepts a pull or push request, authenticates to the engine REST API, transfers configuration resources, and can detect orphaned local files or deploy channels after a push. Git operations provide a separate version-control workflow. The excerpts show orchestration and several implementation layers; major resource types and capabilities are also documented in the README, but not all their internal wiring is sampled.

Main entry points: [`src/mirthsync/core.clj`](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/core.clj) (Operation runner), [`src/mirthsync/apis.clj`](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/apis.clj) (Resource APIs), [`src/mirthsync/actions.clj`](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/actions.clj) (Push and pull), [`src/mirthsync/http_client.clj`](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/http_client.clj) (HTTP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["CLI workflow"]
  node_cli["CLI options<br/>[cli.clj]"]
  node_orchestrator["Operation runner<br/>[core.clj]"]
  node_logging["Logging<br/>[logging.clj]"]
end

subgraph group_sync["Configuration sync"]
  node_pushpull["Push and pull<br/>[actions.clj]"]
  node_xml["XML processing<br/>[xml.clj]"]
  node_localfiles[("Local configuration<br/>[files.clj]")]
  node_orphancheck["Orphan cleanup<br/>[actions.clj]"]
end

subgraph group_integration["Engine integration"]
  node_resourceapis["Resource APIs<br/>[apis.clj]"]
  node_http["HTTP client<br/>[http_client.clj]"]
  node_apiinterfaces["API dispatch<br/>[interfaces.clj]"]
  node_deployment["Channel deployment<br/>[apis.clj]"]
end

subgraph group_versioning["Version control"]
  node_gitops["Git commands<br/>[git.clj]"]
end

node_operator(("Operator"))
node_engine[("Mirth / OIE")]

node_operator -->|"sets options"| node_cli
node_cli -.->|"configures"| node_orchestrator
node_orchestrator -->|"authenticates"| node_http
node_orchestrator -->|"preprocesses APIs"| node_resourceapis
node_orchestrator -->|"runs transfer"| node_pushpull
node_pushpull -->|"reads and writes"| node_localfiles
node_pushpull -->|"serializes"| node_xml
node_resourceapis -->|"uses requests"| node_http
node_http -->|"REST requests"| node_engine
node_resourceapis -->|"dispatches resource behavior"| node_apiinterfaces
node_resourceapis -->|"checks and deploys"| node_deployment
node_orchestrator -->|"checks after pull"| node_orphancheck
node_orphancheck -->|"removes orphaned files"| node_localfiles
node_orchestrator -->|"auto-commits"| node_gitops
node_operator -->|"runs Git commands"| node_gitops
node_engine -->|"provides configurations"| node_resourceapis

click node_cli "https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/cli.clj"
click node_orchestrator "https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/core.clj"
click node_pushpull "https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/actions.clj"
click node_resourceapis "https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/apis.clj"
click node_http "https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/http_client.clj"
click node_apiinterfaces "https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/interfaces.clj"
click node_xml "https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/xml.clj"
click node_localfiles "https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/files.clj"
click node_orphancheck "https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/actions.clj"
click node_deployment "https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/apis.clj"
click node_gitops "https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/git.clj"
click node_logging "https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/logging.clj"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_orchestrator,node_logging toneBlue
class node_pushpull,node_xml,node_localfiles,node_orphancheck,node_engine toneAmber
class node_resourceapis,node_http,node_apiinterfaces,node_deployment toneMint
class node_gitops toneRose
class node_operator toneIndigo
```

## Components

### CLI workflow

- [CLI options](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/cli.clj): `src/mirthsync/cli.clj`
- [Operation runner](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/core.clj): `src/mirthsync/core.clj`
- [Logging](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/logging.clj): `src/mirthsync/logging.clj`

### Configuration sync

- [Push and pull](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/actions.clj): `src/mirthsync/actions.clj`
- [XML processing](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/xml.clj): `src/mirthsync/xml.clj`
- [Local configuration](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/files.clj): `src/mirthsync/files.clj`
- [Orphan cleanup](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/actions.clj): `src/mirthsync/actions.clj`

### Engine integration

- [Resource APIs](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/apis.clj): `src/mirthsync/apis.clj`
- [HTTP client](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/http_client.clj): `src/mirthsync/http_client.clj`
- [API dispatch](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/interfaces.clj): `src/mirthsync/interfaces.clj`
- [Channel deployment](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/apis.clj): `src/mirthsync/apis.clj`

### Version control

- [Git commands](https://github.com/sagahealthcareit/mirthsync/blob/master/src/mirthsync/git.clj): `src/mirthsync/git.clj`

### Other components

- **Operator**
- **Mirth / OIE**

## Connections

- Operator → CLI options: sets options (evidence: `README.md`)
- CLI options → Operation runner: configures
- Operation runner → HTTP client: authenticates (evidence: `src/mirthsync/core.clj`)
- Operation runner → Resource APIs: preprocesses APIs (evidence: `src/mirthsync/core.clj`)
- Operation runner → Push and pull: runs transfer (evidence: `src/mirthsync/core.clj`)
- Push and pull → Local configuration: reads and writes (evidence: `src/mirthsync/actions.clj`)
- Push and pull → XML processing: serializes (evidence: `src/mirthsync/actions.clj`)
- Resource APIs → HTTP client: uses requests (evidence: `src/mirthsync/apis.clj`)
- HTTP client → Mirth / OIE: REST requests (evidence: `src/mirthsync/http_client.clj`)
- Resource APIs → API dispatch: dispatches resource behavior (evidence: `src/mirthsync/apis.clj`)
- Resource APIs → Channel deployment: checks and deploys (evidence: `src/mirthsync/apis.clj`)
- Operation runner → Orphan cleanup: checks after pull (evidence: `src/mirthsync/core.clj`)
- Orphan cleanup → Local configuration: removes orphaned files (evidence: `src/mirthsync/actions.clj`)
- Operation runner → Git commands: auto-commits (evidence: `src/mirthsync/core.clj`)
- Operator → Git commands: runs Git commands (evidence: `README.md`)
- Mirth / OIE → Resource APIs: provides configurations (evidence: `README.md`)
