# cooped-labs/restash architecture

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

- Interactive diagram: https://gitdiagram.com/cooped-labs/restash
- Repository: https://github.com/cooped-labs/restash

## Overview

Restash is an Electron app for saving reusable clipboard items and pasting them into other apps. The documented main flow is: summon the cursor numpad, choose a saved item, then restore focus to the prior app and paste. Other major capabilities include clipboard memory, stashes, environments, agent templates, multi-file items, and QR decoding. The excerpts show platform adapters and QR decoding; main.js was not sampled, so internal orchestration and persistence details are represented only where the README supports them.

Main entry points: [`main.js`](https://github.com/cooped-labs/restash/blob/main/main.js) (Electron runtime), [`platform/index.js`](https://github.com/cooped-labs/restash/blob/main/platform/index.js) (Platform selector), [`renderer.js`](https://github.com/cooped-labs/restash/blob/main/renderer.js) (App interface), [`platform`](https://github.com/cooped-labs/restash/tree/main/platform) (OS adapters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User interaction"]
  node_ui["App interface<br/>[renderer.js]"]
  node_runtime["Electron runtime<br/>[main.js]"]
end

subgraph group_items["Saved items"]
  node_saved[("Saved items<br/>[main.js]")]
  node_clipboard["Clipboard memory<br/>[main.js]"]
  node_stashes["Stashes<br/>[main.js]"]
  node_agents["Agent templates<br/>[main.js]"]
  node_files["Multi-file items<br/>[main.js]"]
end

subgraph group_environments["Environments"]
  node_environments_feature["Environment capture<br/>[main.js]"]
  node_chrome["Chrome profiles<br/>[chrome.js]"]
end

subgraph group_platform["Platform services"]
  node_platform_index["Platform selector<br/>[index.js]"]
  node_platform_os["OS adapters"]
  node_hotkeys["Hotkey settings<br/>[accelerators.js]"]
  node_capabilities["Platform capabilities<br/>[capabilities.js]"]
end

subgraph group_scanning["QR scanning"]
  node_qr["QR capture and decode<br/>[qr.js]"]
end

node_user(("User"))
node_target(("Target app"))
node_screen(("Desktop screen"))

node_user -->|"summons"| node_ui
node_ui -.->|"selects item"| node_runtime
node_runtime -->|"reads and writes"| node_saved
node_runtime -->|"captures copies"| node_clipboard
node_runtime -.->|"uses platform services"| node_platform_index
node_platform_index -->|"selects implementation"| node_platform_os
node_runtime -->|"pastes into"| node_target
node_user -->|"organizes items"| node_stashes
node_user -->|"saves templates"| node_agents
node_runtime -->|"pastes file sets"| node_files
node_user -->|"captures environment"| node_environments_feature
node_environments_feature -.->|"lists windows"| node_platform_os
node_environments_feature -.->|"uses profiles"| node_chrome
node_user -->|"scans region"| node_qr
node_screen -->|"provides capture"| node_qr
node_platform_index -->|"exports defaults"| node_hotkeys
node_platform_index -->|"exports session info"| node_capabilities

click node_ui "https://github.com/cooped-labs/restash/blob/main/renderer.js"
click node_runtime "https://github.com/cooped-labs/restash/blob/main/main.js"
click node_saved "https://github.com/cooped-labs/restash/blob/main/main.js"
click node_clipboard "https://github.com/cooped-labs/restash/blob/main/main.js"
click node_stashes "https://github.com/cooped-labs/restash/blob/main/main.js"
click node_agents "https://github.com/cooped-labs/restash/blob/main/main.js"
click node_files "https://github.com/cooped-labs/restash/blob/main/main.js"
click node_environments_feature "https://github.com/cooped-labs/restash/blob/main/main.js"
click node_chrome "https://github.com/cooped-labs/restash/blob/main/platform/chrome.js"
click node_platform_index "https://github.com/cooped-labs/restash/blob/main/platform/index.js"
click node_platform_os "https://github.com/cooped-labs/restash/tree/main/platform"
click node_hotkeys "https://github.com/cooped-labs/restash/blob/main/platform/accelerators.js"
click node_capabilities "https://github.com/cooped-labs/restash/blob/main/platform/capabilities.js"
click node_qr "https://github.com/cooped-labs/restash/blob/main/platform/qr.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_ui,node_runtime,node_user,node_screen toneBlue
class node_saved,node_clipboard,node_stashes,node_agents,node_files toneAmber
class node_environments_feature,node_chrome toneMint
class node_platform_index,node_platform_os,node_hotkeys,node_capabilities toneRose
class node_qr,node_target toneIndigo
```

## Components

### User interaction

- [App interface](https://github.com/cooped-labs/restash/blob/main/renderer.js): `renderer.js`
- [Electron runtime](https://github.com/cooped-labs/restash/blob/main/main.js): `main.js`

### Saved items

- [Saved items](https://github.com/cooped-labs/restash/blob/main/main.js): `main.js`
- [Clipboard memory](https://github.com/cooped-labs/restash/blob/main/main.js): `main.js`
- [Stashes](https://github.com/cooped-labs/restash/blob/main/main.js): `main.js`
- [Agent templates](https://github.com/cooped-labs/restash/blob/main/main.js): `main.js`
- [Multi-file items](https://github.com/cooped-labs/restash/blob/main/main.js): `main.js`

### Environments

- [Environment capture](https://github.com/cooped-labs/restash/blob/main/main.js): `main.js`
- [Chrome profiles](https://github.com/cooped-labs/restash/blob/main/platform/chrome.js): `platform/chrome.js`

### Platform services

- [Platform selector](https://github.com/cooped-labs/restash/blob/main/platform/index.js): `platform/index.js`
- [OS adapters](https://github.com/cooped-labs/restash/tree/main/platform): `platform`
- [Hotkey settings](https://github.com/cooped-labs/restash/blob/main/platform/accelerators.js): `platform/accelerators.js`
- [Platform capabilities](https://github.com/cooped-labs/restash/blob/main/platform/capabilities.js): `platform/capabilities.js`

### QR scanning

- [QR capture and decode](https://github.com/cooped-labs/restash/blob/main/platform/qr.js): `platform/qr.js`

### Other components

- **User**
- **Target app**
- **Desktop screen**

## Connections

- User → App interface: summons (evidence: `README.md`)
- App interface → Electron runtime: selects item
- Electron runtime → Saved items: reads and writes (evidence: `README.md`)
- Electron runtime → Clipboard memory: captures copies (evidence: `README.md`)
- Electron runtime → Platform selector: uses platform services
- Platform selector → OS adapters: selects implementation (evidence: `platform/index.js`)
- Electron runtime → Target app: pastes into (evidence: `README.md`)
- User → Stashes: organizes items (evidence: `README.md`)
- User → Agent templates: saves templates (evidence: `README.md`)
- Electron runtime → Multi-file items: pastes file sets (evidence: `README.md`)
- User → Environment capture: captures environment (evidence: `README.md`)
- Environment capture → OS adapters: lists windows
- Environment capture → Chrome profiles: uses profiles
- User → QR capture and decode: scans region (evidence: `README.md`)
- Desktop screen → QR capture and decode: provides capture (evidence: `platform/qr.js`)
- Platform selector → Hotkey settings: exports defaults (evidence: `platform/index.js`)
- Platform selector → Platform capabilities: exports session info (evidence: `platform/index.js`)
