# shrimqy/sefirah architecture

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

- Interactive diagram: https://gitdiagram.com/shrimqy/sefirah
- Repository: https://github.com/shrimqy/sefirah

## Overview

Sefirah is a desktop companion for an Android app, synchronizing device features and exposing phone content and controls on the PC. The documented path begins with network discovery and user-approved pairing, then uses a connected device session for clipboard, notifications, messaging, calls, media, file transfer, and screen mirroring; Windows also exposes Android storage in Explorer. The README documents these capabilities, while sampled source confirms device persistence, application activation, and file reception. Several feature implementations and their exact dispatch wiring were not sampled, so uncertain links are omitted.

Main entry points: [`src/Sefirah/Services/MessageHandler.cs`](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/MessageHandler.cs) (Message dispatch), [`src/Sefirah/Services/Settings/DeviceSettingsService.cs`](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/Settings/DeviceSettingsService.cs) (Device preferences), [`src/Sefirah/Features/NotificationFeature.cs`](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Features/NotificationFeature.cs) (Notification sync), [`src/Sefirah/Views/MainPage.xaml.cs`](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Views/MainPage.xaml.cs) (Desktop interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_connection["Discovery and pairing"]
  node_main["Desktop interface<br/>[MainPage.xaml.cs]"]
  node_discovery["Device discovery"]
  node_network["Network transport<br/>[NetworkService.cs]"]
  node_device["Device sessions<br/>[DeviceManager.cs]"]
end

subgraph group_sync["Device synchronization"]
  node_messagehandler["Message dispatch<br/>[MessageHandler.cs]"]
  node_clipboard["Clipboard sync"]
  node_notifications["Notification sync"]
  node_sms["SMS messaging<br/>[SmsFeature.cs]"]
  node_calls["Call handling<br/>[CallFeature.cs]"]
  node_transfer["File transfer"]
end

subgraph group_desktop["Desktop features"]
  node_media["Media control<br/>[MediaFeature.cs]"]
  node_remote["Remote storage<br/>[SyncProvider.cs]"]
  node_mirror["Screen mirroring"]
end

subgraph group_platform["Platform integration"]
  node_adb["ADB integration<br/>[AdbService.cs]"]
  node_toast["Desktop notifications"]
  node_phone["Windows phone line"]
end

subgraph group_data["Local data"]
  node_database[("App database<br/>[DatabaseContext.cs]")]
  node_repositories["Device repositories"]
  node_settings["Device preferences"]
end

node_person(("Desktop user"))
node_android(("Android companion"))

node_person -->|"uses"| node_main
node_android -->|"announces device"| node_discovery
node_main -->|"shows devices"| node_discovery
node_android -->|"initiates pairing"| node_device
node_device -->|"loads and saves"| node_repositories
node_repositories -->|"reads and writes"| node_database
node_android -->|"sends feature messages"| node_messagehandler
node_messagehandler -->|"dispatches"| node_clipboard
node_messagehandler -->|"dispatches"| node_notifications
node_messagehandler -->|"dispatches"| node_sms
node_messagehandler -->|"dispatches"| node_calls
node_android -->|"shares files"| node_transfer
node_transfer -->|"transfers data"| node_network
node_android -->|"requests control"| node_media
node_android -->|"provides storage"| node_remote
node_person -->|"starts mirroring"| node_mirror
node_mirror -->|"launches scrcpy"| node_adb
node_notifications -->|"shows toasts"| node_toast
node_calls -.->|"uses call control"| node_phone
node_settings -->|"configures"| node_clipboard
node_settings -->|"configures"| node_notifications
node_settings -->|"configures"| node_remote

click node_main "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Views/MainPage.xaml.cs"
click node_discovery "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/DiscoveryService.cs"
click node_network "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/NetworkService.cs"
click node_device "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/DeviceManager.cs"
click node_database "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Data/AppDatabase/DatabaseContext.cs"
click node_repositories "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Data/AppDatabase/Repository/DeviceRepository.cs"
click node_settings "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/Settings/DeviceSettingsService.cs"
click node_messagehandler "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/MessageHandler.cs"
click node_clipboard "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Features/ClipboardFeature.cs"
click node_notifications "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Features/NotificationFeature.cs"
click node_sms "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Features/SmsFeature.cs"
click node_calls "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Features/CallFeature.cs"
click node_transfer "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/Transfer/FileTransferService.cs"
click node_media "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Platforms/Windows/Features/MediaFeature.cs"
click node_remote "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Platforms/Windows/RemoteStorage/Worker/SyncProvider.cs"
click node_mirror "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/ScreenMirrorService.cs"
click node_adb "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/AdbService.cs"
click node_toast "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Platforms/Windows/Services/NotificationHandler.cs"
click node_phone "https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Platforms/Windows/Calling/PhoneLineService.cs"

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_main,node_discovery,node_network,node_device,node_person toneBlue
class node_messagehandler,node_clipboard,node_notifications,node_sms,node_calls,node_transfer toneAmber
class node_media,node_remote,node_mirror toneMint
class node_adb,node_toast,node_phone toneRose
class node_database,node_repositories,node_settings,node_android toneIndigo
```

## Components

### Discovery and pairing

- [Desktop interface](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Views/MainPage.xaml.cs): `src/Sefirah/Views/MainPage.xaml.cs`
- [Device discovery](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/DiscoveryService.cs): `src/Sefirah/Services/DiscoveryService.cs`
- [Network transport](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/NetworkService.cs): `src/Sefirah/Services/NetworkService.cs`
- [Device sessions](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/DeviceManager.cs): `src/Sefirah/Services/DeviceManager.cs`

### Device synchronization

- [Message dispatch](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/MessageHandler.cs): `src/Sefirah/Services/MessageHandler.cs`
- [Clipboard sync](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Features/ClipboardFeature.cs): `src/Sefirah/Features/ClipboardFeature.cs`
- [Notification sync](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Features/NotificationFeature.cs): `src/Sefirah/Features/NotificationFeature.cs`
- [SMS messaging](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Features/SmsFeature.cs): `src/Sefirah/Features/SmsFeature.cs`
- [Call handling](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Features/CallFeature.cs): `src/Sefirah/Features/CallFeature.cs`
- [File transfer](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/Transfer/FileTransferService.cs): `src/Sefirah/Services/Transfer/FileTransferService.cs`

### Desktop features

- [Media control](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Platforms/Windows/Features/MediaFeature.cs): `src/Sefirah/Platforms/Windows/Features/MediaFeature.cs`
- [Remote storage](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Platforms/Windows/RemoteStorage/Worker/SyncProvider.cs): `src/Sefirah/Platforms/Windows/RemoteStorage/Worker/SyncProvider.cs`
- [Screen mirroring](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/ScreenMirrorService.cs): `src/Sefirah/Services/ScreenMirrorService.cs`

### Platform integration

- [ADB integration](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/AdbService.cs): `src/Sefirah/Services/AdbService.cs`
- [Desktop notifications](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Platforms/Windows/Services/NotificationHandler.cs): `src/Sefirah/Platforms/Windows/Services/NotificationHandler.cs`
- [Windows phone line](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Platforms/Windows/Calling/PhoneLineService.cs): `src/Sefirah/Platforms/Windows/Calling/PhoneLineService.cs`

### Local data

- [App database](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Data/AppDatabase/DatabaseContext.cs): `src/Sefirah/Data/AppDatabase/DatabaseContext.cs`
- [Device repositories](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Data/AppDatabase/Repository/DeviceRepository.cs): `src/Sefirah/Data/AppDatabase/Repository/DeviceRepository.cs`
- [Device preferences](https://github.com/shrimqy/sefirah/blob/master/src/Sefirah/Services/Settings/DeviceSettingsService.cs): `src/Sefirah/Services/Settings/DeviceSettingsService.cs`

### Other components

- **Desktop user**
- **Android companion**

## Connections

- Desktop user → Desktop interface: uses
- Android companion → Device discovery: announces device
- Desktop interface → Device discovery: shows devices
- Android companion → Device sessions: initiates pairing
- Device sessions → Device repositories: loads and saves
- Device repositories → App database: reads and writes
- Android companion → Message dispatch: sends feature messages
- Message dispatch → Clipboard sync: dispatches
- Message dispatch → Notification sync: dispatches
- Message dispatch → SMS messaging: dispatches
- Message dispatch → Call handling: dispatches
- Android companion → File transfer: shares files
- File transfer → Network transport: transfers data
- Android companion → Media control: requests control
- Android companion → Remote storage: provides storage
- Desktop user → Screen mirroring: starts mirroring
- Screen mirroring → ADB integration: launches scrcpy
- Notification sync → Desktop notifications: shows toasts
- Call handling → Windows phone line: uses call control
- Device preferences → Clipboard sync: configures
- Device preferences → Notification sync: configures
- Device preferences → Remote storage: configures
