# ayhanblt/kloda architecture

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

- Interactive diagram: https://gitdiagram.com/ayhanblt/kloda
- Repository: https://github.com/ayhanblt/kloda

## Overview

Kloda is a secure photo-backup and device-sync product with desktop and mobile clients. The main workflow is to choose local sources and a schedule, configure a remote destination, run and monitor transfers, then review conflicts or restore backups. Pairing and device management form a separate workflow; photo cataloging and recovery are additional product stages. The excerpts show desktop runtime wiring and selected client entry points, but not most mobile/native transfer implementations, so those connections are omitted or marked unverified.

Main entry points: [`apps/mobile/src/app/App.tsx`](https://github.com/ayhanblt/kloda/blob/main/apps/mobile/src/app/App.tsx) (Mobile navigation), [`apps/mobile/src/features/backup-setup/model/use-backup-setup.ts`](https://github.com/ayhanblt/kloda/blob/main/apps/mobile/src/features/backup-setup/model/use-backup-setup.ts) (Backup setup model), [`apps/desktop/electron/main.ts`](https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/main.ts) (Electron entry), [`apps/desktop/electron/runtime/runtime.ts`](https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/runtime/runtime.ts) (Sync runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client interfaces"]
  node_desktop_app["Desktop navigation<br/>[App.tsx]"]
  node_desktop_setup["Backup setup<br/>[BackupSetup.tsx]"]
  node_desktop_versions["Backup versions<br/>[BackupVersions.tsx]"]
  node_desktop_pairing_ui["Pairing interface"]
  node_mobile_app["Mobile navigation<br/>[App.tsx]"]
  node_mobile_setup["Backup setup model"]
  node_mobile_pairing["Pairing controller"]
  node_mobile_webdav_review["WebDAV review<br/>[webdav-review.ts]"]
end

subgraph group_desktop["Desktop runtime"]
  node_desktop_main["Electron entry<br/>[main.ts]"]
  node_desktop_runtime["Sync runtime<br/>[runtime.ts]"]
  node_desktop_journal[("Sync journal<br/>[journal.ts]")]
  node_desktop_scheduler["Schedule adapter<br/>[scheduler.ts]"]
  node_desktop_background["Background runtime<br/>[background.ts]"]
  node_desktop_pairing["Pairing runtime<br/>[pairing.ts]"]
end

subgraph group_mobile["Mobile sync"]
  node_mobile_files["File transfer service"]
  node_mobile_pairing_runtime["Native pairing runtime"]
end

subgraph group_shared["Shared sync logic"]
  node_sync_contracts["Sync contracts<br/>[contracts.ts]"]
  node_sync_destinations["Destination catalog"]
  node_sync_schedule["Schedule logic<br/>[schedule.ts]"]
end

subgraph group_native["Native transports"]
  node_smb_native["SMB transport<br/>[lib.rs]"]
  node_s3_native["S3 bridge<br/>[bridge.rs]"]
  node_ftps_native["FTPS transport<br/>[session.rs]"]
  node_sftp_native["SFTP transport<br/>[session.rs]"]
end

node_desktop_user(("Desktop user"))
node_mobile_user(("Mobile user"))

node_desktop_user -->|"uses"| node_desktop_app
node_desktop_app -->|"renders"| node_desktop_setup
node_desktop_app -->|"renders"| node_desktop_versions
node_desktop_app -.->|"opens"| node_desktop_pairing_ui
node_desktop_main -->|"creates"| node_desktop_runtime
node_desktop_main -->|"creates"| node_desktop_journal
node_desktop_main -->|"creates"| node_desktop_scheduler
node_desktop_main -->|"registers"| node_desktop_pairing
node_desktop_main -->|"configures"| node_desktop_background
node_desktop_runtime -->|"reads and writes"| node_desktop_journal
node_desktop_runtime -->|"uses"| node_sync_schedule
node_desktop_scheduler -->|"reads"| node_desktop_journal
node_desktop_scheduler -->|"uses"| node_sync_schedule
node_desktop_background -->|"starts"| node_desktop_runtime
node_desktop_background -->|"reads"| node_desktop_journal
node_desktop_setup -.->|"calls API"| node_desktop_runtime
node_desktop_versions -.->|"calls API"| node_desktop_runtime
node_desktop_user -->|"launches"| node_desktop_main
node_mobile_user -->|"uses"| node_mobile_app
node_mobile_app -->|"uses"| node_mobile_setup
node_mobile_app -->|"opens"| node_mobile_pairing
node_mobile_app -.->|"opens"| node_mobile_webdav_review
node_mobile_files -->|"requests pause"| node_mobile_pairing_runtime
node_mobile_setup -.->|"uses"| node_sync_contracts
node_mobile_app -->|"uses"| node_sync_destinations
node_mobile_app -.->|"uses"| node_sync_schedule
node_mobile_setup -.->|"may use"| node_smb_native
node_mobile_setup -.->|"may use"| node_s3_native
node_mobile_setup -.->|"may use"| node_ftps_native
node_mobile_setup -.->|"may use"| node_sftp_native

click node_desktop_app "https://github.com/ayhanblt/kloda/blob/main/apps/desktop/src/app/App.tsx"
click node_desktop_setup "https://github.com/ayhanblt/kloda/blob/main/apps/desktop/src/pages/backup/BackupSetup.tsx"
click node_desktop_versions "https://github.com/ayhanblt/kloda/blob/main/apps/desktop/src/pages/backups/BackupVersions.tsx"
click node_desktop_pairing_ui "https://github.com/ayhanblt/kloda/blob/main/apps/desktop/src/features/pair-device/useDesktopPairing.ts"
click node_desktop_main "https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/main.ts"
click node_desktop_runtime "https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/runtime/runtime.ts"
click node_desktop_journal "https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/runtime/journal.ts"
click node_desktop_scheduler "https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/runtime/scheduler.ts"
click node_desktop_background "https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/runtime/background.ts"
click node_desktop_pairing "https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/runtime/pairing.ts"
click node_mobile_app "https://github.com/ayhanblt/kloda/blob/main/apps/mobile/src/app/App.tsx"
click node_mobile_setup "https://github.com/ayhanblt/kloda/blob/main/apps/mobile/src/features/backup-setup/model/use-backup-setup.ts"
click node_mobile_pairing "https://github.com/ayhanblt/kloda/blob/main/apps/mobile/src/features/pairing/model/pairing-controller.ts"
click node_mobile_webdav_review "https://github.com/ayhanblt/kloda/blob/main/apps/mobile/src/shared/api/webdav-review.ts"
click node_mobile_files "https://github.com/ayhanblt/kloda/blob/main/apps/mobile/modules/my-module/android/src/main/java/com/kloda/sync/AndroidFilesService.kt"
click node_mobile_pairing_runtime "https://github.com/ayhanblt/kloda/blob/main/apps/mobile/modules/my-module/android/src/main/java/com/kloda/sync/AndroidPairingRuntime.kt"
click node_sync_contracts "https://github.com/ayhanblt/kloda/blob/main/packages/sync-core/src/contracts.ts"
click node_sync_destinations "https://github.com/ayhanblt/kloda/blob/main/packages/sync-core/src/destination-catalog.ts"
click node_sync_schedule "https://github.com/ayhanblt/kloda/blob/main/packages/sync-core/src/schedule.ts"
click node_smb_native "https://github.com/ayhanblt/kloda/blob/main/packages/storage-native/src/lib.rs"
click node_s3_native "https://github.com/ayhanblt/kloda/blob/main/packages/s3-native/src/bridge.rs"
click node_ftps_native "https://github.com/ayhanblt/kloda/blob/main/packages/ftps-native/src/session.rs"
click node_sftp_native "https://github.com/ayhanblt/kloda/blob/main/packages/sftp-native/src/session.rs"

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_desktop_app,node_desktop_setup,node_desktop_versions,node_desktop_pairing_ui,node_mobile_app,node_mobile_setup,node_mobile_pairing,node_mobile_webdav_review,node_desktop_user,node_mobile_user toneBlue
class node_desktop_main,node_desktop_runtime,node_desktop_journal,node_desktop_scheduler,node_desktop_background,node_desktop_pairing toneAmber
class node_mobile_files,node_mobile_pairing_runtime toneMint
class node_sync_contracts,node_sync_destinations,node_sync_schedule toneRose
class node_smb_native,node_s3_native,node_ftps_native,node_sftp_native toneIndigo
```

## Components

### Client interfaces

- [Desktop navigation](https://github.com/ayhanblt/kloda/blob/main/apps/desktop/src/app/App.tsx): `apps/desktop/src/app/App.tsx`
- [Backup setup](https://github.com/ayhanblt/kloda/blob/main/apps/desktop/src/pages/backup/BackupSetup.tsx): `apps/desktop/src/pages/backup/BackupSetup.tsx`
- [Backup versions](https://github.com/ayhanblt/kloda/blob/main/apps/desktop/src/pages/backups/BackupVersions.tsx): `apps/desktop/src/pages/backups/BackupVersions.tsx`
- [Pairing interface](https://github.com/ayhanblt/kloda/blob/main/apps/desktop/src/features/pair-device/useDesktopPairing.ts): `apps/desktop/src/features/pair-device/useDesktopPairing.ts`
- [Mobile navigation](https://github.com/ayhanblt/kloda/blob/main/apps/mobile/src/app/App.tsx): `apps/mobile/src/app/App.tsx`
- [Backup setup model](https://github.com/ayhanblt/kloda/blob/main/apps/mobile/src/features/backup-setup/model/use-backup-setup.ts): `apps/mobile/src/features/backup-setup/model/use-backup-setup.ts`
- [Pairing controller](https://github.com/ayhanblt/kloda/blob/main/apps/mobile/src/features/pairing/model/pairing-controller.ts): `apps/mobile/src/features/pairing/model/pairing-controller.ts`
- [WebDAV review](https://github.com/ayhanblt/kloda/blob/main/apps/mobile/src/shared/api/webdav-review.ts): `apps/mobile/src/shared/api/webdav-review.ts`

### Desktop runtime

- [Electron entry](https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/main.ts): `apps/desktop/electron/main.ts`
- [Sync runtime](https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/runtime/runtime.ts): `apps/desktop/electron/runtime/runtime.ts`
- [Sync journal](https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/runtime/journal.ts): `apps/desktop/electron/runtime/journal.ts`
- [Schedule adapter](https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/runtime/scheduler.ts): `apps/desktop/electron/runtime/scheduler.ts`
- [Background runtime](https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/runtime/background.ts): `apps/desktop/electron/runtime/background.ts`
- [Pairing runtime](https://github.com/ayhanblt/kloda/blob/main/apps/desktop/electron/runtime/pairing.ts): `apps/desktop/electron/runtime/pairing.ts`

### Mobile sync

- [File transfer service](https://github.com/ayhanblt/kloda/blob/main/apps/mobile/modules/my-module/android/src/main/java/com/kloda/sync/AndroidFilesService.kt): `apps/mobile/modules/my-module/android/src/main/java/com/kloda/sync/AndroidFilesService.kt`
- [Native pairing runtime](https://github.com/ayhanblt/kloda/blob/main/apps/mobile/modules/my-module/android/src/main/java/com/kloda/sync/AndroidPairingRuntime.kt): `apps/mobile/modules/my-module/android/src/main/java/com/kloda/sync/AndroidPairingRuntime.kt`

### Shared sync logic

- [Sync contracts](https://github.com/ayhanblt/kloda/blob/main/packages/sync-core/src/contracts.ts): `packages/sync-core/src/contracts.ts`
- [Destination catalog](https://github.com/ayhanblt/kloda/blob/main/packages/sync-core/src/destination-catalog.ts): `packages/sync-core/src/destination-catalog.ts`
- [Schedule logic](https://github.com/ayhanblt/kloda/blob/main/packages/sync-core/src/schedule.ts): `packages/sync-core/src/schedule.ts`

### Native transports

- [SMB transport](https://github.com/ayhanblt/kloda/blob/main/packages/storage-native/src/lib.rs): `packages/storage-native/src/lib.rs`
- [S3 bridge](https://github.com/ayhanblt/kloda/blob/main/packages/s3-native/src/bridge.rs): `packages/s3-native/src/bridge.rs`
- [FTPS transport](https://github.com/ayhanblt/kloda/blob/main/packages/ftps-native/src/session.rs): `packages/ftps-native/src/session.rs`
- [SFTP transport](https://github.com/ayhanblt/kloda/blob/main/packages/sftp-native/src/session.rs): `packages/sftp-native/src/session.rs`

### Other components

- **Desktop user**
- **Mobile user**

## Connections

- Desktop user → Desktop navigation: uses (evidence: `apps/desktop/src/app/App.tsx`)
- Desktop navigation → Backup setup: renders (evidence: `apps/desktop/src/app/App.tsx`)
- Desktop navigation → Backup versions: renders (evidence: `apps/desktop/src/app/App.tsx`)
- Desktop navigation → Pairing interface: opens
- Electron entry → Sync runtime: creates (evidence: `apps/desktop/electron/main.ts`)
- Electron entry → Sync journal: creates (evidence: `apps/desktop/electron/main.ts`)
- Electron entry → Schedule adapter: creates (evidence: `apps/desktop/electron/main.ts`)
- Electron entry → Pairing runtime: registers (evidence: `apps/desktop/electron/main.ts`)
- Electron entry → Background runtime: configures (evidence: `apps/desktop/electron/main.ts`)
- Sync runtime → Sync journal: reads and writes (evidence: `apps/desktop/electron/runtime/runtime.ts`)
- Sync runtime → Schedule logic: uses (evidence: `apps/desktop/electron/runtime/runtime.ts`)
- Schedule adapter → Sync journal: reads (evidence: `apps/desktop/electron/runtime/scheduler.ts`)
- Schedule adapter → Schedule logic: uses (evidence: `apps/desktop/electron/runtime/scheduler.ts`)
- Background runtime → Sync runtime: starts (evidence: `apps/desktop/electron/runtime/background.ts`)
- Background runtime → Sync journal: reads (evidence: `apps/desktop/electron/runtime/background.ts`)
- Backup setup → Sync runtime: calls API
- Backup versions → Sync runtime: calls API
- Desktop user → Electron entry: launches (evidence: `apps/desktop/electron/main.ts`)
- Mobile user → Mobile navigation: uses (evidence: `apps/mobile/src/app/App.tsx`)
- Mobile navigation → Backup setup model: uses (evidence: `apps/mobile/src/app/App.tsx`)
- Mobile navigation → Pairing controller: opens (evidence: `apps/mobile/src/app/App.tsx`)
- Mobile navigation → WebDAV review: opens
- File transfer service → Native pairing runtime: requests pause (evidence: `apps/mobile/modules/my-module/android/src/main/java/com/kloda/sync/AndroidFilesService.kt`)
- Backup setup model → Sync contracts: uses
- Mobile navigation → Destination catalog: uses (evidence: `apps/mobile/src/app/App.tsx`)
- Mobile navigation → Schedule logic: uses
- Backup setup model → SMB transport: may use
- Backup setup model → S3 bridge: may use
- Backup setup model → FTPS transport: may use
- Backup setup model → SFTP transport: may use
