# 9001/copyparty architecture

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

- Interactive diagram: https://gitdiagram.com/9001/copyparty
- Repository: https://github.com/9001/copyparty

## Overview

copyparty is a portable, multi-protocol file server. A typical browser workflow reaches the HTTP service, is checked against configured users and volumes, then lists, uploads, or downloads files; uploads are handled by the resumable-transfer/indexing subsystem and stored on the filesystem. The README also documents FTP, SFTP, SMB, TFTP, WebDAV, hooks, and LAN discovery. Some service wiring and feature implementations were not sampled, so those documented branches are shown without asserting internal call paths.

Main entry points: [`copyparty/httpcli.py`](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/httpcli.py) (HTTP request handler), [`copyparty/up2k.py`](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/up2k.py) (Upload and index), [`copyparty/httpsrv.py`](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/httpsrv.py) (HTTP service), [`copyparty/authsrv.py`](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/authsrv.py) (Users and volumes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and services"]
  node_http_service["HTTP service<br/>[httpsrv.py]"]
  node_http_connection["HTTP connection<br/>[httpconn.py]"]
  node_identity_volumes["Users and volumes<br/>[authsrv.py]"]
  node_service_hub["Service hub<br/>[svchub.py]"]
  node_ftp["FTP service<br/>[ftpd.py]"]
  node_sftp["SFTP service<br/>[sftpd.py]"]
  node_smb["SMB service<br/>[smbd.py]"]
  node_tftp["TFTP service<br/>[tftpd.py]"]
end

subgraph group_http["HTTP experience"]
  node_http_request["HTTP request handler<br/>[httpcli.py]"]
  node_web_ui["Browser UI<br/>[browser.js]"]
  node_upload_ui["Upload client<br/>[up2k.js]"]
end

subgraph group_files["File operations"]
  node_filesystem["Filesystem access<br/>[bos.py]"]
  node_file_utilities["Filesystem utilities<br/>[fsutil.py]"]
  node_transfer_index["Upload and index<br/>[up2k.py]"]
  node_search_index["File search<br/>[u2idx.py]"]
  node_media_metadata["Media metadata<br/>[mtag.py]"]
  node_transfer_db[("Transfer database<br/>[up2k.py]")]
end

subgraph group_platform["Runtime support"]
  node_configuration["Configuration<br/>[cfg.py]"]
  node_broker["Service broker<br/>[broker_util.py]"]
  node_event_hooks["Event hooks"]
end

node_browser_user(("Browser user"))

node_browser_user -->|"accesses files"| node_http_service
node_http_service -.->|"accepts connections"| node_http_connection
node_http_connection -->|"creates handler"| node_http_request
node_browser_user -->|"uses"| node_web_ui
node_web_ui -.->|"requests files"| node_http_service
node_upload_ui -->|"uploads chunks"| node_http_service
node_http_request -->|"checks access"| node_identity_volumes
node_identity_volumes -->|"loads settings"| node_configuration
node_http_request -->|"serves files"| node_filesystem
node_http_request -->|"handles uploads"| node_transfer_index
node_http_request -->|"uses index"| node_search_index
node_transfer_index -->|"writes files"| node_filesystem
node_transfer_index -->|"uses utilities"| node_file_utilities
node_transfer_index -->|"reads volume config"| node_identity_volumes
node_transfer_index -->|"extracts tags"| node_media_metadata
node_transfer_index -->|"stores index data"| node_transfer_db
node_http_request -->|"asks services"| node_broker
node_broker -->|"dispatches requests"| node_service_hub
node_browser_user -->|"transfers files"| node_ftp
node_browser_user -->|"transfers files"| node_sftp
node_browser_user -->|"accesses shares"| node_smb
node_browser_user -->|"transfers files"| node_tftp
node_http_request -.->|"triggers hooks"| node_event_hooks

click node_http_service "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/httpsrv.py"
click node_http_connection "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/httpconn.py"
click node_http_request "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/httpcli.py"
click node_web_ui "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/web/browser.js"
click node_upload_ui "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/web/up2k.js"
click node_configuration "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/cfg.py"
click node_identity_volumes "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/authsrv.py"
click node_filesystem "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/bos/bos.py"
click node_file_utilities "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/fsutil.py"
click node_transfer_index "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/up2k.py"
click node_search_index "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/u2idx.py"
click node_media_metadata "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/mtag.py"
click node_transfer_db "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/up2k.py"
click node_broker "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/broker_util.py"
click node_service_hub "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/svchub.py"
click node_ftp "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/ftpd.py"
click node_sftp "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/sftpd.py"
click node_smb "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/smbd.py"
click node_tftp "https://github.com/9001/copyparty/blob/hovudstraum/copyparty/tftpd.py"
click node_event_hooks "https://github.com/9001/copyparty/tree/hovudstraum/bin/hooks"

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_http_service,node_http_connection,node_identity_volumes,node_service_hub,node_ftp,node_sftp,node_smb,node_tftp,node_browser_user toneBlue
class node_http_request,node_web_ui,node_upload_ui toneAmber
class node_filesystem,node_file_utilities,node_transfer_index,node_search_index,node_media_metadata,node_transfer_db toneMint
class node_configuration,node_broker,node_event_hooks toneRose
```

## Components

### Access and services

- [HTTP service](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/httpsrv.py): `copyparty/httpsrv.py`
- [HTTP connection](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/httpconn.py): `copyparty/httpconn.py`
- [Users and volumes](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/authsrv.py): `copyparty/authsrv.py`
- [Service hub](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/svchub.py): `copyparty/svchub.py`
- [FTP service](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/ftpd.py): `copyparty/ftpd.py`
- [SFTP service](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/sftpd.py): `copyparty/sftpd.py`
- [SMB service](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/smbd.py): `copyparty/smbd.py`
- [TFTP service](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/tftpd.py): `copyparty/tftpd.py`

### HTTP experience

- [HTTP request handler](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/httpcli.py): `copyparty/httpcli.py`
- [Browser UI](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/web/browser.js): `copyparty/web/browser.js`
- [Upload client](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/web/up2k.js): `copyparty/web/up2k.js`

### File operations

- [Filesystem access](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/bos/bos.py): `copyparty/bos/bos.py`
- [Filesystem utilities](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/fsutil.py): `copyparty/fsutil.py`
- [Upload and index](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/up2k.py): `copyparty/up2k.py`
- [File search](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/u2idx.py): `copyparty/u2idx.py`
- [Media metadata](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/mtag.py): `copyparty/mtag.py`
- [Transfer database](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/up2k.py): `copyparty/up2k.py`

### Runtime support

- [Configuration](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/cfg.py): `copyparty/cfg.py`
- [Service broker](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/broker_util.py): `copyparty/broker_util.py`
- [Event hooks](https://github.com/9001/copyparty/tree/hovudstraum/bin/hooks): `bin/hooks`

### Other components

- **Browser user**

## Connections

- Browser user → HTTP service: accesses files (evidence: `README.md`)
- HTTP service → HTTP connection: accepts connections (evidence: `copyparty/httpconn.py`)
- HTTP connection → HTTP request handler: creates handler (evidence: `copyparty/httpconn.py`)
- Browser user → Browser UI: uses (evidence: `README.md`)
- Browser UI → HTTP service: requests files
- Upload client → HTTP service: uploads chunks (evidence: `README.md`)
- HTTP request handler → Users and volumes: checks access (evidence: `copyparty/httpcli.py`)
- Users and volumes → Configuration: loads settings (evidence: `copyparty/authsrv.py`)
- HTTP request handler → Filesystem access: serves files (evidence: `copyparty/httpcli.py`)
- HTTP request handler → Upload and index: handles uploads (evidence: `copyparty/httpcli.py`)
- HTTP request handler → File search: uses index (evidence: `copyparty/httpconn.py`)
- Upload and index → Filesystem access: writes files (evidence: `copyparty/up2k.py`)
- Upload and index → Filesystem utilities: uses utilities (evidence: `copyparty/up2k.py`)
- Upload and index → Users and volumes: reads volume config (evidence: `copyparty/up2k.py`)
- Upload and index → Media metadata: extracts tags (evidence: `copyparty/up2k.py`)
- Upload and index → Transfer database: stores index data (evidence: `copyparty/up2k.py`)
- HTTP request handler → Service broker: asks services (evidence: `copyparty/httpcli.py`)
- Service broker → Service hub: dispatches requests (evidence: `copyparty/broker_util.py`)
- Browser user → FTP service: transfers files (evidence: `README.md`)
- Browser user → SFTP service: transfers files (evidence: `README.md`)
- Browser user → SMB service: accesses shares (evidence: `README.md`)
- Browser user → TFTP service: transfers files (evidence: `README.md`)
- HTTP request handler → Event hooks: triggers hooks
