# thing-or-think/bt4-web architecture

> Architecture diagram of the GitHub repository thing-or-think/bt4-web, 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/thing-or-think/bt4-web
- Repository: https://github.com/thing-or-think/bt4-web

## Overview

Croc is a cross-platform file and folder transfer product, with CLI and browser clients plus temporary encrypted-link storage and SSH sharing. The primary workflow is sender preparation, code/PAKE-based peer setup, relay-capable transfer, then recipient verification and file publication; the browser also exposes stored transfers and SSH. The graph combines README-documented CLI capabilities with sampled browser and storage modules. Several Go runtime connections and browser subsystems are unsampled, so their uncertain links are omitted or marked dashed rather than inferred as calls.

Main entry points: [`web/src/protocol/client.ts`](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/client.ts) (Transfer client), [`web/src/App.tsx`](https://github.com/thing-or-think/bt4-web/blob/main/web/src/App.tsx) (Browser interface), [`src/cli/cli.go`](https://github.com/thing-or-think/bt4-web/blob/main/src/cli/cli.go) (CLI commands), [`src/croc/croc.go`](https://github.com/thing-or-think/bt4-web/blob/main/src/croc/croc.go) (Peer transfer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI transfers"]
  node_cli_entry["CLI commands<br/>[cli.go]"]
  node_transfer_core["Peer transfer<br/>[croc.go]"]
  node_codephrase["Transfer code<br/>[codephrase.go]"]
  node_network["Relay and networking<br/>[tcp.go]"]
  node_receivefs["Receive publication"]
  node_updater["Release updater<br/>[update.go]"]
end

subgraph group_browser["Browser app"]
  node_web_entry["Browser interface<br/>[App.tsx]"]
  node_web_mount["App mounting<br/>[main.tsx]"]
  node_blog["Blog pages<br/>[Blog.tsx]"]
  node_analytics["Analytics<br/>[analytics.ts]"]
  node_posts["Blog content<br/>[blog-posts.ts]"]
end

subgraph group_protocol["Transfer protocol"]
  node_web_client["Transfer client<br/>[client.ts]"]
  node_bundle["Bundle handling<br/>[bundle.ts]"]
  node_codec["Byte utilities<br/>[bytes.ts]"]
  node_compression["Compression<br/>[compression.ts]"]
  node_engine["PAKE engine<br/>[engine.ts]"]
  node_hash["Hashing<br/>[hash.ts]"]
  node_metadata["Transfer metadata<br/>[metadata.ts]"]
  node_sha256["SHA-256<br/>[sha256.ts]"]
  node_transport["Wire transport<br/>[transport.ts]"]
  node_browser_storage["Receive destinations<br/>[storage.ts]"]
end

subgraph group_stored["Stored transfers"]
  node_stored_ui["Stored transfer UI<br/>[stored-ui.tsx]"]
  node_stored_client["Stored transfer client<br/>[stored.ts]"]
  node_store_client["CLI storage client<br/>[client.go]"]
  node_store_service[("Encrypted storage service<br/>[service.go]")]
end

subgraph group_ssh["SSH sharing"]
  node_ssh_panel["Browser SSH panel<br/>[SSHPanel.tsx]"]
  node_ssh_protocol["Browser SSH protocol<br/>[ssh.ts]"]
  node_ssh_cli["SSH sharing<br/>[client.go]"]
end

node_user(("Sender or recipient"))

node_user -->|"runs send/receive"| node_cli_entry
node_cli_entry -->|"starts transfer"| node_transfer_core
node_cli_entry -->|"parses transfer code"| node_codephrase
node_transfer_core -.->|"uses relay transport"| node_network
node_transfer_core -.->|"publishes received files"| node_receivefs
node_user -->|"uses browser transfer"| node_web_entry
node_web_mount -->|"mounts interface"| node_web_entry
node_web_mount -->|"mounts pages"| node_blog
node_web_entry -->|"starts transfers"| node_web_client
node_web_entry -->|"prepares stored transfers"| node_stored_client
node_web_entry -->|"formats expiry"| node_stored_ui
node_web_entry -->|"records events"| node_analytics
node_web_entry -->|"loads blog content"| node_posts
node_blog -->|"renders content"| node_posts
node_web_client -->|"handles bundles"| node_bundle
node_web_client -->|"compresses payloads"| node_compression
node_web_client -->|"requests protocol operations"| node_engine
node_web_client -->|"hashes transfer data"| node_hash
node_web_client -->|"uses transfer metadata"| node_metadata
node_web_client -->|"exchanges messages"| node_transport
node_web_client -.->|"writes received data"| node_browser_storage
node_hash -->|"uses digest"| node_sha256
node_stored_client -.->|"stores received files"| node_browser_storage
node_store_client -.->|"sends storage requests"| node_store_service
node_ssh_panel -->|"starts SSH session"| node_ssh_protocol
node_user -.->|"joins SSH share"| node_ssh_cli
node_cli_entry -.->|"runs stored commands"| node_store_client
node_cli_entry -.->|"runs SSH sharing"| node_ssh_cli
node_user -->|"requests update"| node_updater

click node_cli_entry "https://github.com/thing-or-think/bt4-web/blob/main/src/cli/cli.go"
click node_transfer_core "https://github.com/thing-or-think/bt4-web/blob/main/src/croc/croc.go"
click node_codephrase "https://github.com/thing-or-think/bt4-web/blob/main/src/codephrase/codephrase.go"
click node_network "https://github.com/thing-or-think/bt4-web/blob/main/src/tcp/tcp.go"
click node_receivefs "https://github.com/thing-or-think/bt4-web/tree/main/src/receivefs"
click node_web_entry "https://github.com/thing-or-think/bt4-web/blob/main/web/src/App.tsx"
click node_web_mount "https://github.com/thing-or-think/bt4-web/blob/main/web/src/main.tsx"
click node_blog "https://github.com/thing-or-think/bt4-web/blob/main/web/src/Blog.tsx"
click node_analytics "https://github.com/thing-or-think/bt4-web/blob/main/web/src/analytics.ts"
click node_posts "https://github.com/thing-or-think/bt4-web/blob/main/web/src/blog-posts.ts"
click node_web_client "https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/client.ts"
click node_bundle "https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/bundle.ts"
click node_codec "https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/bytes.ts"
click node_compression "https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/compression.ts"
click node_engine "https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/engine.ts"
click node_hash "https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/hash.ts"
click node_metadata "https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/metadata.ts"
click node_sha256 "https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/sha256.ts"
click node_transport "https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/transport.ts"
click node_browser_storage "https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/storage.ts"
click node_stored_ui "https://github.com/thing-or-think/bt4-web/blob/main/web/src/stored-ui.tsx"
click node_stored_client "https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/stored.ts"
click node_store_client "https://github.com/thing-or-think/bt4-web/blob/main/src/storeclient/client.go"
click node_store_service "https://github.com/thing-or-think/bt4-web/blob/main/src/store/service.go"
click node_ssh_panel "https://github.com/thing-or-think/bt4-web/blob/main/web/src/SSHPanel.tsx"
click node_ssh_protocol "https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/ssh.ts"
click node_ssh_cli "https://github.com/thing-or-think/bt4-web/blob/main/src/sshshare/client.go"
click node_updater "https://github.com/thing-or-think/bt4-web/blob/main/internal/update/update.go"

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_cli_entry,node_transfer_core,node_codephrase,node_network,node_receivefs,node_updater toneBlue
class node_web_entry,node_web_mount,node_blog,node_analytics,node_posts toneAmber
class node_web_client,node_bundle,node_codec,node_compression,node_engine,node_hash,node_metadata,node_sha256,node_transport,node_browser_storage toneMint
class node_stored_ui,node_stored_client,node_store_client,node_store_service toneRose
class node_ssh_panel,node_ssh_protocol,node_ssh_cli,node_user toneIndigo
```

## Components

### CLI transfers

- [CLI commands](https://github.com/thing-or-think/bt4-web/blob/main/src/cli/cli.go): `src/cli/cli.go`
- [Peer transfer](https://github.com/thing-or-think/bt4-web/blob/main/src/croc/croc.go): `src/croc/croc.go`
- [Transfer code](https://github.com/thing-or-think/bt4-web/blob/main/src/codephrase/codephrase.go): `src/codephrase/codephrase.go`
- [Relay and networking](https://github.com/thing-or-think/bt4-web/blob/main/src/tcp/tcp.go): `src/tcp/tcp.go`
- [Receive publication](https://github.com/thing-or-think/bt4-web/tree/main/src/receivefs): `src/receivefs`
- [Release updater](https://github.com/thing-or-think/bt4-web/blob/main/internal/update/update.go): `internal/update/update.go`

### Browser app

- [Browser interface](https://github.com/thing-or-think/bt4-web/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [App mounting](https://github.com/thing-or-think/bt4-web/blob/main/web/src/main.tsx): `web/src/main.tsx`
- [Blog pages](https://github.com/thing-or-think/bt4-web/blob/main/web/src/Blog.tsx): `web/src/Blog.tsx`
- [Analytics](https://github.com/thing-or-think/bt4-web/blob/main/web/src/analytics.ts): `web/src/analytics.ts`
- [Blog content](https://github.com/thing-or-think/bt4-web/blob/main/web/src/blog-posts.ts): `web/src/blog-posts.ts`

### Transfer protocol

- [Transfer client](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/client.ts): `web/src/protocol/client.ts`
- [Bundle handling](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/bundle.ts): `web/src/protocol/bundle.ts`
- [Byte utilities](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/bytes.ts): `web/src/protocol/bytes.ts`
- [Compression](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/compression.ts): `web/src/protocol/compression.ts`
- [PAKE engine](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/engine.ts): `web/src/protocol/engine.ts`
- [Hashing](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/hash.ts): `web/src/protocol/hash.ts`
- [Transfer metadata](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/metadata.ts): `web/src/protocol/metadata.ts`
- [SHA-256](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/sha256.ts): `web/src/protocol/sha256.ts`
- [Wire transport](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/transport.ts): `web/src/protocol/transport.ts`
- [Receive destinations](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/storage.ts): `web/src/protocol/storage.ts`

### Stored transfers

- [Stored transfer UI](https://github.com/thing-or-think/bt4-web/blob/main/web/src/stored-ui.tsx): `web/src/stored-ui.tsx`
- [Stored transfer client](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/stored.ts): `web/src/protocol/stored.ts`
- [CLI storage client](https://github.com/thing-or-think/bt4-web/blob/main/src/storeclient/client.go): `src/storeclient/client.go`
- [Encrypted storage service](https://github.com/thing-or-think/bt4-web/blob/main/src/store/service.go): `src/store/service.go`

### SSH sharing

- [Browser SSH panel](https://github.com/thing-or-think/bt4-web/blob/main/web/src/SSHPanel.tsx): `web/src/SSHPanel.tsx`
- [Browser SSH protocol](https://github.com/thing-or-think/bt4-web/blob/main/web/src/protocol/ssh.ts): `web/src/protocol/ssh.ts`
- [SSH sharing](https://github.com/thing-or-think/bt4-web/blob/main/src/sshshare/client.go): `src/sshshare/client.go`

### Other components

- **Sender or recipient**

## Connections

- Sender or recipient → CLI commands: runs send/receive
- CLI commands → Peer transfer: starts transfer (evidence: `src/cli/cli.go`)
- CLI commands → Transfer code: parses transfer code (evidence: `src/cli/cli.go`)
- Peer transfer → Relay and networking: uses relay transport
- Peer transfer → Receive publication: publishes received files
- Sender or recipient → Browser interface: uses browser transfer
- App mounting → Browser interface: mounts interface (evidence: `web/src/main.tsx`)
- App mounting → Blog pages: mounts pages (evidence: `web/src/main.tsx`)
- Browser interface → Transfer client: starts transfers (evidence: `web/src/App.tsx`)
- Browser interface → Stored transfer client: prepares stored transfers (evidence: `web/src/App.tsx`)
- Browser interface → Stored transfer UI: formats expiry (evidence: `web/src/App.tsx`)
- Browser interface → Analytics: records events (evidence: `web/src/App.tsx`)
- Browser interface → Blog content: loads blog content (evidence: `web/src/App.tsx`)
- Blog pages → Blog content: renders content (evidence: `web/src/Blog.tsx`)
- Transfer client → Bundle handling: handles bundles (evidence: `web/src/protocol/client.ts`)
- Transfer client → Compression: compresses payloads (evidence: `web/src/protocol/client.ts`)
- Transfer client → PAKE engine: requests protocol operations (evidence: `web/src/protocol/client.ts`)
- Transfer client → Hashing: hashes transfer data (evidence: `web/src/protocol/client.ts`)
- Transfer client → Transfer metadata: uses transfer metadata (evidence: `web/src/protocol/client.ts`)
- Transfer client → Wire transport: exchanges messages (evidence: `web/src/protocol/client.ts`)
- Transfer client → Receive destinations: writes received data (evidence: `web/src/protocol/client.ts`)
- Hashing → SHA-256: uses digest (evidence: `web/src/protocol/hash.ts`)
- Stored transfer client → Receive destinations: stores received files (evidence: `web/src/protocol/stored.ts`)
- CLI storage client → Encrypted storage service: sends storage requests
- Browser SSH panel → Browser SSH protocol: starts SSH session (evidence: `web/src/SSHPanel.tsx`)
- Sender or recipient → SSH sharing: joins SSH share
- CLI commands → CLI storage client: runs stored commands
- CLI commands → SSH sharing: runs SSH sharing
- Sender or recipient → Release updater: requests update
