# schollz/croc architecture

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

- Interactive diagram: https://gitdiagram.com/schollz/croc
- Repository: https://github.com/schollz/croc

## Overview

Croc is a cross-platform file and folder transfer product with a browser client, relay-assisted peer transfer, PAKE-based encryption, resumable transfer support, temporary stored shares, and SSH sharing. The main path is CLI or browser initiation, transfer negotiation and transport, then verified writing to a receive destination. The graph also preserves the browser’s blog/launch surface and SSH capability. Several implementation paths are unsampled; those relationships are omitted or marked unverified rather than inferred from names alone.

Main entry points: [`web/src/protocol/client.ts`](https://github.com/schollz/croc/blob/main/web/src/protocol/client.ts) (Transfer client), [`web/src/App.tsx`](https://github.com/schollz/croc/blob/main/web/src/App.tsx) (Browser app), [`src/cli/cli.go`](https://github.com/schollz/croc/blob/main/src/cli/cli.go) (CLI commands), [`web/src/SSHPanel.tsx`](https://github.com/schollz/croc/blob/main/web/src/SSHPanel.tsx) (Browser SSH panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_cli["CLI commands<br/>[cli.go]"]
  node_main["CLI entry<br/>[main.go]"]
end

subgraph group_transfer["Transfer runtime"]
  node_transferclient["Transfer client<br/>[client.ts]"]
  node_protocol["Protocol engine<br/>[engine.ts]"]
  node_bundle["Bundle handling<br/>[bundle.ts]"]
  node_compression["Compression<br/>[compression.ts]"]
  node_transport["Transport and relay<br/>[transport.ts]"]
  node_metadata["Transfer metadata<br/>[metadata.ts]"]
  node_receive["Receive destinations<br/>[storage.ts]"]
end

subgraph group_storage["Stored transfers"]
  node_storedclient["Stored-share client<br/>[client.go]"]
  node_storedservice[("Temporary store service<br/>[service.go]")]
  node_storedweb["Browser stored shares<br/>[stored.ts]"]
  node_storedui["Stored-share UI<br/>[stored-ui.tsx]"]
end

subgraph group_ssh["SSH sharing"]
  node_sshpanel["Browser SSH panel<br/>[SSHPanel.tsx]"]
  node_sshclient["SSH client<br/>[client.go]"]
  node_wasmssh["Browser SSH bridge<br/>[main.go]"]
end

subgraph group_browser["Browser product"]
  node_webapp["Browser app<br/>[App.tsx]"]
  node_launcher["Task launcher<br/>[TaskLauncher.tsx]"]
  node_blog["Blog pages<br/>[Blog.tsx]"]
end

node_user(("User"))

node_user -->|"runs"| node_main
node_main -->|"starts"| node_cli
node_user -->|"opens"| node_webapp
node_webapp -->|"renders"| node_launcher
node_webapp -.->|"starts transfer"| node_transferclient
node_webapp -->|"prepares shares"| node_storedweb
node_webapp -->|"renders"| node_storedui
node_webapp -.->|"links pages"| node_blog
node_webapp -->|"renders"| node_sshpanel
node_transferclient -->|"uses"| node_bundle
node_transferclient -->|"uses"| node_compression
node_transferclient -->|"uses"| node_transport
node_transferclient -->|"uses"| node_metadata
node_transferclient -.->|"writes payloads"| node_receive
node_transferclient -->|"uses"| node_protocol
node_protocol -.->|"authenticates peers"| node_user
node_cli -->|"uses"| node_storedclient
node_storedclient -.->|"HTTP requests"| node_storedservice
node_storedweb -.->|"HTTP requests"| node_storedservice
node_sshpanel -.->|"uses bridge"| node_wasmssh
node_sshpanel -.->|"SSH protocol"| node_sshclient
node_cli -.->|"starts SSH"| node_sshclient

click node_cli "https://github.com/schollz/croc/blob/main/src/cli/cli.go"
click node_main "https://github.com/schollz/croc/blob/main/main.go"
click node_webapp "https://github.com/schollz/croc/blob/main/web/src/App.tsx"
click node_launcher "https://github.com/schollz/croc/blob/main/web/src/TaskLauncher.tsx"
click node_blog "https://github.com/schollz/croc/blob/main/web/src/Blog.tsx"
click node_transferclient "https://github.com/schollz/croc/blob/main/web/src/protocol/client.ts"
click node_protocol "https://github.com/schollz/croc/blob/main/web/src/protocol/engine.ts"
click node_bundle "https://github.com/schollz/croc/blob/main/web/src/protocol/bundle.ts"
click node_compression "https://github.com/schollz/croc/blob/main/web/src/protocol/compression.ts"
click node_transport "https://github.com/schollz/croc/blob/main/web/src/protocol/transport.ts"
click node_metadata "https://github.com/schollz/croc/blob/main/web/src/protocol/metadata.ts"
click node_receive "https://github.com/schollz/croc/blob/main/web/src/protocol/storage.ts"
click node_storedclient "https://github.com/schollz/croc/blob/main/src/storeclient/client.go"
click node_storedservice "https://github.com/schollz/croc/blob/main/src/store/service.go"
click node_storedweb "https://github.com/schollz/croc/blob/main/web/src/protocol/stored.ts"
click node_storedui "https://github.com/schollz/croc/blob/main/web/src/stored-ui.tsx"
click node_sshpanel "https://github.com/schollz/croc/blob/main/web/src/SSHPanel.tsx"
click node_sshclient "https://github.com/schollz/croc/blob/main/src/sshshare/client.go"
click node_wasmssh "https://github.com/schollz/croc/blob/main/web/sshwasm/main.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,node_main,node_user toneBlue
class node_transferclient,node_protocol,node_bundle,node_compression,node_transport,node_metadata,node_receive toneAmber
class node_storedclient,node_storedservice,node_storedweb,node_storedui toneMint
class node_sshpanel,node_sshclient,node_wasmssh toneRose
class node_webapp,node_launcher,node_blog toneIndigo
```

## Components

### User entry points

- [CLI commands](https://github.com/schollz/croc/blob/main/src/cli/cli.go): `src/cli/cli.go`
- [CLI entry](https://github.com/schollz/croc/blob/main/main.go): `main.go`

### Transfer runtime

- [Transfer client](https://github.com/schollz/croc/blob/main/web/src/protocol/client.ts): `web/src/protocol/client.ts`
- [Protocol engine](https://github.com/schollz/croc/blob/main/web/src/protocol/engine.ts): `web/src/protocol/engine.ts`
- [Bundle handling](https://github.com/schollz/croc/blob/main/web/src/protocol/bundle.ts): `web/src/protocol/bundle.ts`
- [Compression](https://github.com/schollz/croc/blob/main/web/src/protocol/compression.ts): `web/src/protocol/compression.ts`
- [Transport and relay](https://github.com/schollz/croc/blob/main/web/src/protocol/transport.ts): `web/src/protocol/transport.ts`
- [Transfer metadata](https://github.com/schollz/croc/blob/main/web/src/protocol/metadata.ts): `web/src/protocol/metadata.ts`
- [Receive destinations](https://github.com/schollz/croc/blob/main/web/src/protocol/storage.ts): `web/src/protocol/storage.ts`

### Stored transfers

- [Stored-share client](https://github.com/schollz/croc/blob/main/src/storeclient/client.go): `src/storeclient/client.go`
- [Temporary store service](https://github.com/schollz/croc/blob/main/src/store/service.go): `src/store/service.go`
- [Browser stored shares](https://github.com/schollz/croc/blob/main/web/src/protocol/stored.ts): `web/src/protocol/stored.ts`
- [Stored-share UI](https://github.com/schollz/croc/blob/main/web/src/stored-ui.tsx): `web/src/stored-ui.tsx`

### SSH sharing

- [Browser SSH panel](https://github.com/schollz/croc/blob/main/web/src/SSHPanel.tsx): `web/src/SSHPanel.tsx`
- [SSH client](https://github.com/schollz/croc/blob/main/src/sshshare/client.go): `src/sshshare/client.go`
- [Browser SSH bridge](https://github.com/schollz/croc/blob/main/web/sshwasm/main.go): `web/sshwasm/main.go`

### Browser product

- [Browser app](https://github.com/schollz/croc/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Task launcher](https://github.com/schollz/croc/blob/main/web/src/TaskLauncher.tsx): `web/src/TaskLauncher.tsx`
- [Blog pages](https://github.com/schollz/croc/blob/main/web/src/Blog.tsx): `web/src/Blog.tsx`

### Other components

- **User**

## Connections

- User → CLI entry: runs
- CLI entry → CLI commands: starts (evidence: `main.go`)
- User → Browser app: opens
- Browser app → Task launcher: renders (evidence: `web/src/App.tsx`)
- Browser app → Transfer client: starts transfer (evidence: `web/src/App.tsx`)
- Browser app → Browser stored shares: prepares shares (evidence: `web/src/App.tsx`)
- Browser app → Stored-share UI: renders (evidence: `web/src/App.tsx`)
- Browser app → Blog pages: links pages
- Browser app → Browser SSH panel: renders (evidence: `web/src/App.tsx`)
- Transfer client → Bundle handling: uses (evidence: `web/src/protocol/client.ts`)
- Transfer client → Compression: uses (evidence: `web/src/protocol/client.ts`)
- Transfer client → Transport and relay: uses (evidence: `web/src/protocol/client.ts`)
- Transfer client → Transfer metadata: uses (evidence: `web/src/protocol/client.ts`)
- Transfer client → Receive destinations: writes payloads (evidence: `web/src/protocol/client.ts`)
- Transfer client → Protocol engine: uses (evidence: `web/src/protocol/client.ts`)
- Protocol engine → User: authenticates peers
- CLI commands → Stored-share client: uses (evidence: `src/cli/cli.go`)
- Stored-share client → Temporary store service: HTTP requests
- Browser stored shares → Temporary store service: HTTP requests
- Browser SSH panel → Browser SSH bridge: uses bridge
- Browser SSH panel → SSH client: SSH protocol
- CLI commands → SSH client: starts SSH
