# momenbasel/phosphor architecture

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

- Interactive diagram: https://gitdiagram.com/momenbasel/phosphor
- Repository: https://github.com/momenbasel/phosphor

## Overview

Phosphor is a native macOS manager for iOS devices. Users select a connected device or local backup, then manage the device, create or browse backups, and inspect or export backed-up content. The graph preserves the documented device, backup, content-export, and diagnostics capabilities. Some feature implementations were not excerpted, so those subsystem links rely on README documentation; unsampled internals and uncertain calls are not inferred.

Main entry points: [`Sources/Phosphor/Services/BackupManager.swift`](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/BackupManager.swift) (Backup operations), [`Sources/Phosphor/ViewModels/BackupViewModel.swift`](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/ViewModels/BackupViewModel.swift) (Backup state), [`Sources/Phosphor/Services/DeviceManager.swift`](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/DeviceManager.swift) (Device operations), [`Sources/Phosphor/Services/UnifiedSearchService.swift`](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/UnifiedSearchService.swift) (Unified search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["App interface"]
  node_app["App entry<br/>[PhosphorApp.swift]"]
  node_content["Main interface<br/>[ContentView.swift]"]
  node_devicevm["Device state"]
  node_backupvm["Backup state"]
  node_deviceview["Device views"]
  node_backupviews["Backup views"]
  node_searchvm["Search state"]
end

subgraph group_device["Device management"]
  node_device["Device operations"]
  node_deviceinfo["Device identity<br/>[DeviceInfo.swift]"]
  node_devicecli["Device backend"]
  node_shell["Command runner<br/>[Shell.swift]"]
end

subgraph group_backup["Backup and content"]
  node_backup["Backup operations"]
  node_backupinfo["Backup metadata<br/>[BackupInfo.swift]"]
  node_plist["Backup plist parser<br/>[PlistParser.swift]"]
  node_manifest["Backup manifest"]
  node_manifestdb[("Manifest database")]
  node_localbackups[("Local backups")]
end

subgraph group_features["Exports and diagnostics"]
  node_apps["App management<br/>[AppManager.swift]"]
  node_search["Unified search"]
  node_messages["Message export"]
  node_contacts["Contact export"]
  node_photos["Photo extraction"]
  node_filetransfer["File transfer"]
  node_diagnostics["Device diagnostics"]
  node_readiness["Backup readiness"]
end

node_user(("Mac user"))
node_externaldevice(("iOS device"))
node_externaltools["Device command tools"]

node_user -->|"launches"| node_app
node_app -.->|"presents"| node_content
node_content -.->|"shows"| node_deviceview
node_content -.->|"shows"| node_backupviews
node_deviceview -->|"uses"| node_devicevm
node_backupviews -->|"uses"| node_backupvm
node_devicevm -->|"calls"| node_device
node_device -->|"builds"| node_deviceinfo
node_device -->|"queries"| node_devicecli
node_device -->|"falls back"| node_shell
node_devicecli -->|"invokes"| node_externaltools
node_shell -->|"runs"| node_externaltools
node_externaltools -.->|"connects"| node_externaldevice
node_devicevm -->|"requests"| node_backup
node_backupvm -->|"creates and restores"| node_backup
node_backup -->|"uses primary backend"| node_devicecli
node_backup -->|"uses fallback"| node_shell
node_backup -->|"writes"| node_localbackups
node_backupinfo -->|"parses metadata with"| node_plist
node_backupvm -->|"loads"| node_backupinfo
node_backupvm -->|"browses through"| node_manifest
node_manifest -->|"queries"| node_manifestdb
node_searchvm -->|"requests"| node_search
node_search -->|"reads backup index"| node_manifest
node_search -->|"searches messages"| node_messages
node_search -->|"searches contacts"| node_contacts
node_user -.->|"manages apps"| node_apps
node_user -.->|"exports conversations"| node_messages
node_user -.->|"extracts media"| node_photos
node_user -.->|"transfers files"| node_filetransfer
node_user -.->|"inspects device"| node_diagnostics
node_user -.->|"checks readiness"| node_readiness

click node_app "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/App/PhosphorApp.swift"
click node_content "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Views/ContentView.swift"
click node_devicevm "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/ViewModels/DeviceViewModel.swift"
click node_backupvm "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/ViewModels/BackupViewModel.swift"
click node_deviceview "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Views/Device/DeviceOverviewView.swift"
click node_backupviews "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Views/Backup/BackupBrowserView.swift"
click node_device "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/DeviceManager.swift"
click node_deviceinfo "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Models/DeviceInfo.swift"
click node_devicecli "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Utilities/PyMobileDevice.swift"
click node_shell "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Utilities/Shell.swift"
click node_backup "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/BackupManager.swift"
click node_backupinfo "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Models/BackupInfo.swift"
click node_plist "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Utilities/PlistParser.swift"
click node_manifest "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Utilities/BackupManifest.swift"
click node_manifestdb "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Utilities/BackupManifest.swift"
click node_apps "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/AppManager.swift"
click node_searchvm "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/ViewModels/UnifiedSearchViewModel.swift"
click node_search "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/UnifiedSearchService.swift"
click node_messages "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/MessageExporter.swift"
click node_contacts "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/ContactsExtractor.swift"
click node_photos "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/PhotoExtractor.swift"
click node_filetransfer "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/FileTransferManager.swift"
click node_diagnostics "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/DiagnosticsManager.swift"
click node_readiness "https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/ReadinessService.swift"

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_app,node_content,node_devicevm,node_backupvm,node_deviceview,node_backupviews,node_searchvm,node_user toneBlue
class node_device,node_deviceinfo,node_devicecli,node_shell toneAmber
class node_backup,node_backupinfo,node_plist,node_manifest,node_manifestdb,node_localbackups toneMint
class node_apps,node_search,node_messages,node_contacts,node_photos,node_filetransfer,node_diagnostics,node_readiness toneRose
class node_externaldevice,node_externaltools toneIndigo
```

## Components

### App interface

- [App entry](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/App/PhosphorApp.swift): `Sources/Phosphor/App/PhosphorApp.swift`
- [Main interface](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Views/ContentView.swift): `Sources/Phosphor/Views/ContentView.swift`
- [Device state](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/ViewModels/DeviceViewModel.swift): `Sources/Phosphor/ViewModels/DeviceViewModel.swift`
- [Backup state](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/ViewModels/BackupViewModel.swift): `Sources/Phosphor/ViewModels/BackupViewModel.swift`
- [Device views](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Views/Device/DeviceOverviewView.swift): `Sources/Phosphor/Views/Device/DeviceOverviewView.swift`
- [Backup views](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Views/Backup/BackupBrowserView.swift): `Sources/Phosphor/Views/Backup/BackupBrowserView.swift`
- [Search state](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/ViewModels/UnifiedSearchViewModel.swift): `Sources/Phosphor/ViewModels/UnifiedSearchViewModel.swift`

### Device management

- [Device operations](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/DeviceManager.swift): `Sources/Phosphor/Services/DeviceManager.swift`
- [Device identity](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Models/DeviceInfo.swift): `Sources/Phosphor/Models/DeviceInfo.swift`
- [Device backend](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Utilities/PyMobileDevice.swift): `Sources/Phosphor/Utilities/PyMobileDevice.swift`
- [Command runner](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Utilities/Shell.swift): `Sources/Phosphor/Utilities/Shell.swift`

### Backup and content

- [Backup operations](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/BackupManager.swift): `Sources/Phosphor/Services/BackupManager.swift`
- [Backup metadata](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Models/BackupInfo.swift): `Sources/Phosphor/Models/BackupInfo.swift`
- [Backup plist parser](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Utilities/PlistParser.swift): `Sources/Phosphor/Utilities/PlistParser.swift`
- [Backup manifest](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Utilities/BackupManifest.swift): `Sources/Phosphor/Utilities/BackupManifest.swift`
- [Manifest database](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Utilities/BackupManifest.swift): `Sources/Phosphor/Utilities/BackupManifest.swift`
- **Local backups**

### Exports and diagnostics

- [App management](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/AppManager.swift): `Sources/Phosphor/Services/AppManager.swift`
- [Unified search](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/UnifiedSearchService.swift): `Sources/Phosphor/Services/UnifiedSearchService.swift`
- [Message export](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/MessageExporter.swift): `Sources/Phosphor/Services/MessageExporter.swift`
- [Contact export](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/ContactsExtractor.swift): `Sources/Phosphor/Services/ContactsExtractor.swift`
- [Photo extraction](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/PhotoExtractor.swift): `Sources/Phosphor/Services/PhotoExtractor.swift`
- [File transfer](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/FileTransferManager.swift): `Sources/Phosphor/Services/FileTransferManager.swift`
- [Device diagnostics](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/DiagnosticsManager.swift): `Sources/Phosphor/Services/DiagnosticsManager.swift`
- [Backup readiness](https://github.com/momenbasel/phosphor/blob/main/Sources/Phosphor/Services/ReadinessService.swift): `Sources/Phosphor/Services/ReadinessService.swift`

### Other components

- **Mac user**
- **iOS device**
- **Device command tools**

## Connections

- Mac user → App entry: launches (evidence: `README.md`)
- App entry → Main interface: presents
- Main interface → Device views: shows
- Main interface → Backup views: shows
- Device views → Device state: uses
- Backup views → Backup state: uses
- Device state → Device operations: calls (evidence: `Sources/Phosphor/ViewModels/DeviceViewModel.swift`)
- Device operations → Device identity: builds (evidence: `Sources/Phosphor/Services/DeviceManager.swift`)
- Device operations → Device backend: queries (evidence: `Sources/Phosphor/Services/DeviceManager.swift`)
- Device operations → Command runner: falls back (evidence: `Sources/Phosphor/Services/DeviceManager.swift`)
- Device backend → Device command tools: invokes (evidence: `Sources/Phosphor/Utilities/PyMobileDevice.swift`)
- Command runner → Device command tools: runs (evidence: `Sources/Phosphor/Utilities/Shell.swift`)
- Device command tools → iOS device: connects
- Device state → Backup operations: requests (evidence: `Sources/Phosphor/ViewModels/DeviceViewModel.swift`)
- Backup state → Backup operations: creates and restores (evidence: `Sources/Phosphor/ViewModels/BackupViewModel.swift`)
- Backup operations → Device backend: uses primary backend (evidence: `Sources/Phosphor/Services/BackupManager.swift`)
- Backup operations → Command runner: uses fallback (evidence: `Sources/Phosphor/Services/BackupManager.swift`)
- Backup operations → Local backups: writes (evidence: `README.md`)
- Backup metadata → Backup plist parser: parses metadata with (evidence: `Sources/Phosphor/Models/BackupInfo.swift`)
- Backup state → Backup metadata: loads (evidence: `Sources/Phosphor/ViewModels/BackupViewModel.swift`)
- Backup state → Backup manifest: browses through (evidence: `Sources/Phosphor/ViewModels/BackupViewModel.swift`)
- Backup manifest → Manifest database: queries (evidence: `Sources/Phosphor/Utilities/BackupManifest.swift`)
- Search state → Unified search: requests (evidence: `Sources/Phosphor/ViewModels/UnifiedSearchViewModel.swift`)
- Unified search → Backup manifest: reads backup index (evidence: `Sources/Phosphor/Services/UnifiedSearchService.swift`)
- Unified search → Message export: searches messages (evidence: `Sources/Phosphor/Services/UnifiedSearchService.swift`)
- Unified search → Contact export: searches contacts (evidence: `Sources/Phosphor/Services/UnifiedSearchService.swift`)
- Mac user → App management: manages apps (evidence: `README.md`)
- Mac user → Message export: exports conversations (evidence: `README.md`)
- Mac user → Photo extraction: extracts media (evidence: `README.md`)
- Mac user → File transfer: transfers files (evidence: `README.md`)
- Mac user → Device diagnostics: inspects device (evidence: `README.md`)
- Mac user → Backup readiness: checks readiness (evidence: `README.md`)
