# iamakashtechie/clipsync architecture

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

- Interactive diagram: https://gitdiagram.com/iamakashtechie/clipsync
- Repository: https://github.com/iamakashtechie/clipsync

## Overview

ClipSync is a local-network clipboard synchronization app for desktop and Android. The user configures pairing and sync in the UI; devices discover one another, establish pairing-code-authenticated transport, exchange text or image payloads, and apply received text to the local clipboard. Diagnostics, runtime health, conflict handling, and background capture support the main workflow. The excerpts show the UI-to-command boundary, startup wiring, and transport behavior; some command, discovery, and persistence internals are unsampled, so uncertain links are omitted.

Main entry points: [`src-tauri/src/commands`](https://github.com/iamakashtechie/clipsync/tree/main/src-tauri/src/commands) (Tauri commands), [`src-tauri/src/domain/state.rs`](https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/domain/state.rs) (Shared runtime state), [`src/app/AppShell.tsx`](https://github.com/iamakashtechie/clipsync/blob/main/src/app/AppShell.tsx) (App shell), [`src/features/clipsync/hooks/useClipSyncController.ts`](https://github.com/iamakashtechie/clipsync/blob/main/src/features/clipsync/hooks/useClipSyncController.ts) (Sync controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_shell["App shell<br/>[AppShell.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardView.tsx]"]
  node_settingsui["Settings view<br/>[SettingsView.tsx]"]
  node_validation["Validation view<br/>[ValidationView.tsx]"]
  node_controller["Sync controller"]
  node_api["Tauri API client<br/>[clipsyncApi.ts]"]
end

subgraph group_runtime["Sync runtime"]
  node_commands["Tauri commands"]
  node_state["Shared runtime state<br/>[state.rs]"]
  node_models["Sync messages<br/>[models.rs]"]
  node_settings["Settings service<br/>[settings.rs]"]
  node_diagnostics["Diagnostics and logs<br/>[logging.rs]"]
end

subgraph group_network["Peer networking"]
  node_discovery["Peer discovery"]
  node_handshake["Handshake loop<br/>[handshake_loop.rs]"]
  node_client["WebSocket client<br/>[client.rs]"]
  node_server["WebSocket server<br/>[server.rs]"]
end

subgraph group_platform["Platform support"]
  node_androidactivity["Android activity bridge<br/>[MainActivity.kt]"]
  node_foreground["Clipboard service"]
  node_accessibility["Accessibility capture"]
  node_tray["Desktop tray<br/>[tray.rs]"]
end

node_user(("User"))
node_peer(("Peer device"))
node_clipboard(("System clipboard"))

node_user -->|"uses"| node_shell
node_shell -->|"renders"| node_dashboard
node_shell -->|"renders"| node_settingsui
node_shell -->|"renders"| node_validation
node_shell -->|"connects"| node_controller
node_controller -->|"invokes commands"| node_api
node_api -->|"calls"| node_commands
node_commands -->|"reads and updates"| node_state
node_commands -->|"loads and saves"| node_settings
node_commands -->|"sends payloads"| node_client
node_commands -->|"records events"| node_diagnostics
node_state -->|"holds messages"| node_models
node_controller -->|"reads and writes"| node_clipboard
node_peer -->|"announces"| node_discovery
node_discovery -->|"updates peers"| node_state
node_state -->|"supplies peers"| node_handshake
node_handshake -->|"dispatches connections"| node_client
node_peer -->|"connects"| node_server
node_server -->|"authenticates and stores"| node_state
node_client -->|"sends authenticated payloads"| node_peer
node_peer -->|"returns payloads"| node_client
node_server -->|"records outcomes"| node_diagnostics
node_controller -.->|"reports policy"| node_androidactivity
node_foreground -->|"broadcasts clipboard events"| node_androidactivity
node_accessibility -.->|"publishes text events"| node_androidactivity
node_androidactivity -->|"dispatches native events"| node_controller
node_tray -->|"reads runtime status"| node_state
node_tray -->|"toggles sync"| node_commands

click node_shell "https://github.com/iamakashtechie/clipsync/blob/main/src/app/AppShell.tsx"
click node_dashboard "https://github.com/iamakashtechie/clipsync/blob/main/src/features/dashboard/DashboardView.tsx"
click node_settingsui "https://github.com/iamakashtechie/clipsync/blob/main/src/features/settings/SettingsView.tsx"
click node_validation "https://github.com/iamakashtechie/clipsync/blob/main/src/features/validation/ValidationView.tsx"
click node_controller "https://github.com/iamakashtechie/clipsync/blob/main/src/features/clipsync/hooks/useClipSyncController.ts"
click node_api "https://github.com/iamakashtechie/clipsync/blob/main/src/shared/api/clipsyncApi.ts"
click node_commands "https://github.com/iamakashtechie/clipsync/tree/main/src-tauri/src/commands"
click node_state "https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/domain/state.rs"
click node_models "https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/domain/models.rs"
click node_settings "https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/services/settings.rs"
click node_diagnostics "https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/services/logging.rs"
click node_discovery "https://github.com/iamakashtechie/clipsync/tree/main/src-tauri/src/network/discovery"
click node_handshake "https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/network/transport/handshake_loop.rs"
click node_client "https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/network/transport/client.rs"
click node_server "https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/network/transport/server.rs"
click node_androidactivity "https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/gen/android/app/src/main/java/com/iamakashtechie/clipsync/MainActivity.kt"
click node_foreground "https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/gen/android/app/src/main/java/com/iamakashtechie/clipsync/ClipSyncForegroundService.kt"
click node_accessibility "https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/gen/android/app/src/main/java/com/iamakashtechie/clipsync/ClipSyncAccessibilityService.kt"
click node_tray "https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/services/tray.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_shell,node_dashboard,node_settingsui,node_validation,node_controller,node_api,node_user toneBlue
class node_commands,node_state,node_models,node_settings,node_diagnostics toneAmber
class node_discovery,node_handshake,node_client,node_server toneMint
class node_androidactivity,node_foreground,node_accessibility,node_tray toneRose
class node_peer,node_clipboard toneIndigo
```

## Components

### User interface

- [App shell](https://github.com/iamakashtechie/clipsync/blob/main/src/app/AppShell.tsx): `src/app/AppShell.tsx`
- [Dashboard](https://github.com/iamakashtechie/clipsync/blob/main/src/features/dashboard/DashboardView.tsx): `src/features/dashboard/DashboardView.tsx`
- [Settings view](https://github.com/iamakashtechie/clipsync/blob/main/src/features/settings/SettingsView.tsx): `src/features/settings/SettingsView.tsx`
- [Validation view](https://github.com/iamakashtechie/clipsync/blob/main/src/features/validation/ValidationView.tsx): `src/features/validation/ValidationView.tsx`
- [Sync controller](https://github.com/iamakashtechie/clipsync/blob/main/src/features/clipsync/hooks/useClipSyncController.ts): `src/features/clipsync/hooks/useClipSyncController.ts`
- [Tauri API client](https://github.com/iamakashtechie/clipsync/blob/main/src/shared/api/clipsyncApi.ts): `src/shared/api/clipsyncApi.ts`

### Sync runtime

- [Tauri commands](https://github.com/iamakashtechie/clipsync/tree/main/src-tauri/src/commands): `src-tauri/src/commands`
- [Shared runtime state](https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/domain/state.rs): `src-tauri/src/domain/state.rs`
- [Sync messages](https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/domain/models.rs): `src-tauri/src/domain/models.rs`
- [Settings service](https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/services/settings.rs): `src-tauri/src/services/settings.rs`
- [Diagnostics and logs](https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/services/logging.rs): `src-tauri/src/services/logging.rs`

### Peer networking

- [Peer discovery](https://github.com/iamakashtechie/clipsync/tree/main/src-tauri/src/network/discovery): `src-tauri/src/network/discovery`
- [Handshake loop](https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/network/transport/handshake_loop.rs): `src-tauri/src/network/transport/handshake_loop.rs`
- [WebSocket client](https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/network/transport/client.rs): `src-tauri/src/network/transport/client.rs`
- [WebSocket server](https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/network/transport/server.rs): `src-tauri/src/network/transport/server.rs`

### Platform support

- [Android activity bridge](https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/gen/android/app/src/main/java/com/iamakashtechie/clipsync/MainActivity.kt): `src-tauri/gen/android/app/src/main/java/com/iamakashtechie/clipsync/MainActivity.kt`
- [Clipboard service](https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/gen/android/app/src/main/java/com/iamakashtechie/clipsync/ClipSyncForegroundService.kt): `src-tauri/gen/android/app/src/main/java/com/iamakashtechie/clipsync/ClipSyncForegroundService.kt`
- [Accessibility capture](https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/gen/android/app/src/main/java/com/iamakashtechie/clipsync/ClipSyncAccessibilityService.kt): `src-tauri/gen/android/app/src/main/java/com/iamakashtechie/clipsync/ClipSyncAccessibilityService.kt`
- [Desktop tray](https://github.com/iamakashtechie/clipsync/blob/main/src-tauri/src/services/tray.rs): `src-tauri/src/services/tray.rs`

### Other components

- **User**
- **Peer device**
- **System clipboard**

## Connections

- User → App shell: uses
- App shell → Dashboard: renders
- App shell → Settings view: renders
- App shell → Validation view: renders
- App shell → Sync controller: connects
- Sync controller → Tauri API client: invokes commands
- Tauri API client → Tauri commands: calls
- Tauri commands → Shared runtime state: reads and updates
- Tauri commands → Settings service: loads and saves
- Tauri commands → WebSocket client: sends payloads
- Tauri commands → Diagnostics and logs: records events
- Shared runtime state → Sync messages: holds messages
- Sync controller → System clipboard: reads and writes
- Peer device → Peer discovery: announces
- Peer discovery → Shared runtime state: updates peers
- Shared runtime state → Handshake loop: supplies peers
- Handshake loop → WebSocket client: dispatches connections
- Peer device → WebSocket server: connects
- WebSocket server → Shared runtime state: authenticates and stores
- WebSocket client → Peer device: sends authenticated payloads
- Peer device → WebSocket client: returns payloads
- WebSocket server → Diagnostics and logs: records outcomes
- Sync controller → Android activity bridge: reports policy
- Clipboard service → Android activity bridge: broadcasts clipboard events
- Accessibility capture → Android activity bridge: publishes text events
- Android activity bridge → Sync controller: dispatches native events
- Desktop tray → Shared runtime state: reads runtime status
- Desktop tray → Tauri commands: toggles sync
