# imr4n4lif/clipboard-fly architecture

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

- Interactive diagram: https://gitdiagram.com/imr4n4lif/clipboard-fly
- Repository: https://github.com/imr4n4lif/clipboard-fly

## Overview

ClipboardFly is a browser-based, account-free clipboard sharing app. A user hosts a session or joins with a PIN; the browser hashes the PIN and encrypts clipboard data, while a WebSocket server manages two-device sessions and relays encrypted payloads. The README documents client-side cryptography and clipboard sync, but the client HTML was not sampled, so its internal call structure is not verified. The server implementation shows room dispatch, relay, expiration, and health handling.

Main entry points: [`client/public/index.html`](https://github.com/imr4n4lif/clipboard-fly/blob/main/client/public/index.html) (Clipboard app), [`server/index.js`](https://github.com/imr4n4lif/clipboard-fly/blob/main/server/index.js) (Room management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser client"]
  node_app["Clipboard app<br/>[index.html]"]
  node_pin["PIN handling<br/>[index.html]"]
  node_crypto["Encryption<br/>[index.html]"]
  node_clipboard["Clipboard sync<br/>[index.html]"]
end

subgraph group_server["Session server"]
  node_ws["WebSocket handler<br/>[index.js]"]
end

subgraph group_ops["Session lifecycle"]
  node_rooms["Room management<br/>[index.js]"]
  node_health["Health endpoint<br/>[index.js]"]
end

node_user(("Device user"))
node_peer(("Other device"))

node_user -->|"hosts or joins"| node_app
node_app -->|"creates PIN"| node_pin
node_pin -->|"sends PIN hash"| node_ws
node_app -->|"derives key"| node_crypto
node_clipboard -->|"encrypts data"| node_crypto
node_app -->|"pastes clipboard"| node_clipboard
node_clipboard -->|"sends encrypted data"| node_ws
node_ws -->|"dispatches room actions"| node_rooms
node_rooms -->|"relays encrypted data"| node_peer
node_rooms -->|"relays encrypted data"| node_app
node_ws -->|"serves health checks"| node_health
node_rooms -->|"expires sessions"| node_rooms

click node_app "https://github.com/imr4n4lif/clipboard-fly/blob/main/client/public/index.html"
click node_pin "https://github.com/imr4n4lif/clipboard-fly/blob/main/client/public/index.html"
click node_crypto "https://github.com/imr4n4lif/clipboard-fly/blob/main/client/public/index.html"
click node_clipboard "https://github.com/imr4n4lif/clipboard-fly/blob/main/client/public/index.html"
click node_ws "https://github.com/imr4n4lif/clipboard-fly/blob/main/server/index.js"
click node_rooms "https://github.com/imr4n4lif/clipboard-fly/blob/main/server/index.js"
click node_health "https://github.com/imr4n4lif/clipboard-fly/blob/main/server/index.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_pin,node_crypto,node_clipboard,node_user toneBlue
class node_ws toneAmber
class node_rooms,node_health toneMint
class node_peer toneIndigo
```

## Components

### Browser client

- [Clipboard app](https://github.com/imr4n4lif/clipboard-fly/blob/main/client/public/index.html): `client/public/index.html`
- [PIN handling](https://github.com/imr4n4lif/clipboard-fly/blob/main/client/public/index.html): `client/public/index.html`
- [Encryption](https://github.com/imr4n4lif/clipboard-fly/blob/main/client/public/index.html): `client/public/index.html`
- [Clipboard sync](https://github.com/imr4n4lif/clipboard-fly/blob/main/client/public/index.html): `client/public/index.html`

### Session server

- [WebSocket handler](https://github.com/imr4n4lif/clipboard-fly/blob/main/server/index.js): `server/index.js`

### Session lifecycle

- [Room management](https://github.com/imr4n4lif/clipboard-fly/blob/main/server/index.js): `server/index.js`
- [Health endpoint](https://github.com/imr4n4lif/clipboard-fly/blob/main/server/index.js): `server/index.js`

### Other components

- **Device user**
- **Other device**

## Connections

- Device user → Clipboard app: hosts or joins (evidence: `README.md`)
- Clipboard app → PIN handling: creates PIN (evidence: `README.md`)
- PIN handling → WebSocket handler: sends PIN hash (evidence: `README.md`)
- Clipboard app → Encryption: derives key (evidence: `README.md`)
- Clipboard sync → Encryption: encrypts data (evidence: `README.md`)
- Clipboard app → Clipboard sync: pastes clipboard (evidence: `README.md`)
- Clipboard sync → WebSocket handler: sends encrypted data (evidence: `README.md`)
- WebSocket handler → Room management: dispatches room actions (evidence: `server/index.js`)
- Room management → Other device: relays encrypted data (evidence: `server/index.js`)
- Room management → Clipboard app: relays encrypted data (evidence: `server/index.js`)
- WebSocket handler → Health endpoint: serves health checks (evidence: `server/index.js`)
- Room management → Room management: expires sessions (evidence: `server/index.js`)
