# sp201004/pastly architecture

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

- Interactive diagram: https://gitdiagram.com/sp201004/pastly
- Repository: https://github.com/sp201004/pastly

## Overview

Pastly is a native, local macOS clipboard manager. The main workflow observes clipboard changes, parses and filters copied content, stores clips, then presents searchable history for preview and paste back into the previously active app. The graph also covers settings, backup, privacy, migration, and the release-download website. Edges reflect README statements or source-index references and excerpts; unsampled implementation details are represented only at documented subsystem level.

Main entry points: [`Sources/Pastly/Data/ClipStore.swift`](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Data/ClipStore.swift) (Clip history), [`Sources/Pastly/UI/PanelController.swift`](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/PanelController.swift) (Panel control), [`Sources/Pastly/App/AppDelegate.swift`](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/App/AppDelegate.swift) (App lifecycle), [`Sources/Pastly/Core/ClipboardCore.swift`](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/ClipboardCore.swift) (Clipboard monitor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and Core"]
  node_app["App lifecycle<br/>[AppDelegate.swift]"]
  node_clipboard["Clipboard monitor"]
  node_parser["Clip parsing"]
  node_filter["Capture privacy"]
  node_hash["Duplicate detection"]
  node_media["Media support<br/>[MediaSupport.swift]"]
end

subgraph group_storage["History and Data"]
  node_store["Clip history<br/>[ClipStore.swift]"]
  node_database[("Local database<br/>[Database.swift]")]
  node_images[("Image files<br/>[ImageStore.swift]")]
  node_backup["Backup and restore"]
  node_migration["Legacy migration"]
end

subgraph group_experience["Clipboard Experience"]
  node_panel["Panel control"]
  node_panelview["History and lists<br/>[PanelView.swift]"]
  node_items["Clip preview<br/>[ItemViews.swift]"]
  node_paste["Paste queue<br/>[PasteQueue.swift]"]
  node_feedback["User feedback<br/>[Feedback.swift]"]
end

subgraph group_control["Settings and Privacy"]
  node_preferences[("Preferences<br/>[Preferences.swift]")]
  node_services["System services<br/>[Services.swift]"]
  node_settingsservices["Settings actions"]
  node_settingsui["Settings screens<br/>[SettingsTabs.swift]"]
  node_settingsview["Settings window<br/>[SettingsView.swift]"]
end

subgraph group_web["Release Website"]
  node_site["Release website<br/>[main.js]"]
  node_releaseapi["Release API<br/>[_release.js]"]
end

node_user(("Mac user"))
node_macapps["Other macOS apps"]
node_siteuser(("Download visitor"))
node_github["GitHub Releases"]

node_user -->|"launches"| node_app
node_app -->|"starts monitoring"| node_clipboard
node_macapps -->|"copies content"| node_clipboard
node_clipboard -->|"parses contents"| node_parser
node_clipboard -->|"checks capture"| node_filter
node_clipboard -->|"ingests clips"| node_store
node_parser -->|"hashes content"| node_hash
node_store -->|"persists records"| node_database
node_store -->|"stores images"| node_images
node_app -->|"migrates history"| node_migration
node_user -->|"opens history"| node_panel
node_app -->|"creates panel"| node_panel
node_panel -->|"presents view"| node_panelview
node_panelview -->|"shows history"| node_store
node_panelview -->|"renders clips"| node_items
node_panel -->|"manages selection"| node_store
node_panel -->|"queues paste"| node_paste
node_paste -->|"marks use"| node_store
node_paste -->|"signals paste"| node_feedback
node_panel -->|"signals actions"| node_feedback
node_paste -->|"pastes content"| node_macapps
node_user -->|"configures app"| node_settingsview
node_settingsview -->|"shows sections"| node_settingsui
node_settingsui -->|"edits preferences"| node_preferences
node_settingsui -->|"runs actions"| node_settingsservices
node_settingsservices -->|"exports imports"| node_backup
node_backup -->|"reads and restores"| node_store
node_settingsservices -->|"manages history"| node_store
node_services -->|"reads settings"| node_preferences
node_app -->|"loads settings"| node_preferences
node_user -->|"visits"| node_site
node_site -.->|"requests releases"| node_releaseapi
node_releaseapi -->|"reads release assets"| node_github

click node_app "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/App/AppDelegate.swift"
click node_clipboard "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/ClipboardCore.swift"
click node_parser "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/ClipItemParser.swift"
click node_filter "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/CaptureFilter.swift"
click node_hash "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/ContentHasher.swift"
click node_media "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/MediaSupport.swift"
click node_store "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Data/ClipStore.swift"
click node_database "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Data/Database.swift"
click node_images "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Data/ImageStore.swift"
click node_backup "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Data/BackupService.swift"
click node_migration "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/LegacyMigration.swift"
click node_panel "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/PanelController.swift"
click node_panelview "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/PanelView.swift"
click node_items "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/ItemViews.swift"
click node_paste "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/PasteQueue.swift"
click node_feedback "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/Feedback.swift"
click node_preferences "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/Preferences.swift"
click node_services "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/Services.swift"
click node_settingsservices "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/SettingsServices.swift"
click node_settingsui "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/SettingsTabs.swift"
click node_settingsview "https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/SettingsView.swift"
click node_site "https://github.com/sp201004/pastly/blob/main/website/main.js"
click node_releaseapi "https://github.com/sp201004/pastly/blob/main/website/api/_release.js"

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_clipboard,node_parser,node_filter,node_hash,node_media,node_user toneBlue
class node_store,node_database,node_images,node_backup,node_migration toneAmber
class node_panel,node_panelview,node_items,node_paste,node_feedback toneMint
class node_preferences,node_services,node_settingsservices,node_settingsui,node_settingsview toneRose
class node_site,node_releaseapi,node_macapps,node_siteuser,node_github toneIndigo
```

## Components

### Capture and Core

- [App lifecycle](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/App/AppDelegate.swift): `Sources/Pastly/App/AppDelegate.swift`
- [Clipboard monitor](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/ClipboardCore.swift): `Sources/Pastly/Core/ClipboardCore.swift`
- [Clip parsing](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/ClipItemParser.swift): `Sources/Pastly/Core/ClipItemParser.swift`
- [Capture privacy](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/CaptureFilter.swift): `Sources/Pastly/Core/CaptureFilter.swift`
- [Duplicate detection](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/ContentHasher.swift): `Sources/Pastly/Core/ContentHasher.swift`
- [Media support](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/MediaSupport.swift): `Sources/Pastly/Core/MediaSupport.swift`

### History and Data

- [Clip history](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Data/ClipStore.swift): `Sources/Pastly/Data/ClipStore.swift`
- [Local database](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Data/Database.swift): `Sources/Pastly/Data/Database.swift`
- [Image files](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Data/ImageStore.swift): `Sources/Pastly/Data/ImageStore.swift`
- [Backup and restore](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Data/BackupService.swift): `Sources/Pastly/Data/BackupService.swift`
- [Legacy migration](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/LegacyMigration.swift): `Sources/Pastly/Core/LegacyMigration.swift`

### Clipboard Experience

- [Panel control](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/PanelController.swift): `Sources/Pastly/UI/PanelController.swift`
- [History and lists](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/PanelView.swift): `Sources/Pastly/UI/PanelView.swift`
- [Clip preview](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/ItemViews.swift): `Sources/Pastly/UI/ItemViews.swift`
- [Paste queue](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/PasteQueue.swift): `Sources/Pastly/Core/PasteQueue.swift`
- [User feedback](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/Feedback.swift): `Sources/Pastly/UI/Feedback.swift`

### Settings and Privacy

- [Preferences](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/Preferences.swift): `Sources/Pastly/Core/Preferences.swift`
- [System services](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/Services.swift): `Sources/Pastly/Core/Services.swift`
- [Settings actions](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/Core/SettingsServices.swift): `Sources/Pastly/Core/SettingsServices.swift`
- [Settings screens](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/SettingsTabs.swift): `Sources/Pastly/UI/SettingsTabs.swift`
- [Settings window](https://github.com/sp201004/pastly/blob/main/Sources/Pastly/UI/SettingsView.swift): `Sources/Pastly/UI/SettingsView.swift`

### Release Website

- [Release website](https://github.com/sp201004/pastly/blob/main/website/main.js): `website/main.js`
- [Release API](https://github.com/sp201004/pastly/blob/main/website/api/_release.js): `website/api/_release.js`

### Other components

- **Mac user**
- **Other macOS apps**
- **Download visitor**
- **GitHub Releases**

## Connections

- Mac user → App lifecycle: launches (evidence: `Sources/Pastly/App/AppDelegate.swift`)
- App lifecycle → Clipboard monitor: starts monitoring (evidence: `Sources/Pastly/App/AppDelegate.swift`)
- Other macOS apps → Clipboard monitor: copies content (evidence: `README.md`)
- Clipboard monitor → Clip parsing: parses contents (evidence: `Sources/Pastly/Core/ClipboardCore.swift`)
- Clipboard monitor → Capture privacy: checks capture (evidence: `Sources/Pastly/Core/ClipboardCore.swift`)
- Clipboard monitor → Clip history: ingests clips (evidence: `Sources/Pastly/Core/ClipboardCore.swift`)
- Clip parsing → Duplicate detection: hashes content (evidence: `Sources/Pastly/Core/ClipItemParser.swift`)
- Clip history → Local database: persists records (evidence: `Sources/Pastly/Data/ClipStore.swift`)
- Clip history → Image files: stores images (evidence: `Sources/Pastly/Data/ClipStore.swift`)
- App lifecycle → Legacy migration: migrates history (evidence: `Sources/Pastly/App/AppDelegate.swift`)
- Mac user → Panel control: opens history (evidence: `README.md`)
- App lifecycle → Panel control: creates panel (evidence: `Sources/Pastly/App/AppDelegate.swift`)
- Panel control → History and lists: presents view (evidence: `Sources/Pastly/UI/PanelController.swift`)
- History and lists → Clip history: shows history (evidence: `Sources/Pastly/UI/PanelView.swift`)
- History and lists → Clip preview: renders clips (evidence: `Sources/Pastly/UI/PanelView.swift`)
- Panel control → Clip history: manages selection (evidence: `Sources/Pastly/UI/PanelController.swift`)
- Panel control → Paste queue: queues paste (evidence: `Sources/Pastly/UI/PanelController.swift`)
- Paste queue → Clip history: marks use (evidence: `Sources/Pastly/Core/PasteQueue.swift`)
- Paste queue → User feedback: signals paste (evidence: `Sources/Pastly/Core/PasteQueue.swift`)
- Panel control → User feedback: signals actions (evidence: `Sources/Pastly/UI/PanelController.swift`)
- Paste queue → Other macOS apps: pastes content (evidence: `README.md`)
- Mac user → Settings window: configures app (evidence: `README.md`)
- Settings window → Settings screens: shows sections (evidence: `Sources/Pastly/UI/SettingsView.swift`)
- Settings screens → Preferences: edits preferences (evidence: `Sources/Pastly/UI/SettingsTabs.swift`)
- Settings screens → Settings actions: runs actions (evidence: `Sources/Pastly/UI/SettingsTabs.swift`)
- Settings actions → Backup and restore: exports imports (evidence: `Sources/Pastly/Core/SettingsServices.swift`)
- Backup and restore → Clip history: reads and restores (evidence: `Sources/Pastly/Data/BackupService.swift`)
- Settings actions → Clip history: manages history (evidence: `Sources/Pastly/Core/SettingsServices.swift`)
- System services → Preferences: reads settings (evidence: `Sources/Pastly/Core/Services.swift`)
- App lifecycle → Preferences: loads settings (evidence: `Sources/Pastly/App/AppDelegate.swift`)
- Mac user → Release website: visits (evidence: `README.md`)
- Release website → Release API: requests releases
- Release API → GitHub Releases: reads release assets (evidence: `website/api/_release.js`)
