# adminbjkai/boxy architecture

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

- Interactive diagram: https://gitdiagram.com/adminbjkai/boxy
- Repository: https://github.com/adminbjkai/boxy

## Overview

Boxy is a self-hosted file-sharing web app: users manage files in an embedded browser UI, the Rust server handles API requests, and files live in a local upload directory. The main runtime is concentrated in one Rust source file; the UI is embedded from static/index.html. The README documents major file-management, editing, search, ZIP, thumbnail, and live-update capabilities. Handler internals and frontend call sites were not sampled, so those detailed links are omitted.

Main entry points: [`src/main.rs`](https://github.com/adminbjkai/boxy/blob/main/src/main.rs) (File API), [`static/index.html`](https://github.com/adminbjkai/boxy/blob/main/static/index.html) (File manager UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser experience"]
  node_ui["File manager UI<br/>[index.html]"]
end

subgraph group_service["Rust application"]
  node_server["HTTP server<br/>[main.rs]"]
  node_file_api["File API<br/>[main.rs]"]
  node_path_safety["Path safety<br/>[main.rs]"]
end

subgraph group_files["File operations"]
  node_browse["Browse and search<br/>[main.rs]"]
  node_mutate["Upload and organize<br/>[main.rs]"]
  node_edit["Text editing<br/>[main.rs]"]
  node_preview["Preview and thumbnails<br/>[main.rs]"]
  node_archives["ZIP downloads<br/>[main.rs]"]
  node_storage[("Upload directory")]
  node_thumb_cache[("Thumbnail cache")]
end

subgraph group_realtime["Live updates"]
  node_ws["WebSocket channel<br/>[main.rs]"]
  node_clients(("Connected clients"))
end

node_user(("User"))

node_user -->|"uses"| node_ui
node_ui -.->|"requests"| node_server
node_server -->|"routes"| node_file_api
node_file_api -->|"serves"| node_browse
node_file_api -->|"serves"| node_mutate
node_file_api -->|"serves"| node_edit
node_file_api -->|"serves"| node_preview
node_file_api -->|"serves"| node_archives
node_file_api -->|"validates paths"| node_path_safety
node_browse -->|"reads"| node_storage
node_mutate -->|"writes"| node_storage
node_edit -->|"reads and writes"| node_storage
node_preview -->|"reads"| node_storage
node_preview -->|"caches thumbnails"| node_thumb_cache
node_archives -->|"reads"| node_storage
node_server -->|"routes"| node_ws
node_ws -->|"broadcasts updates"| node_clients
node_mutate -.->|"notifies"| node_ws

click node_ui "https://github.com/adminbjkai/boxy/blob/main/static/index.html"
click node_server "https://github.com/adminbjkai/boxy/blob/main/src/main.rs"
click node_file_api "https://github.com/adminbjkai/boxy/blob/main/src/main.rs"
click node_path_safety "https://github.com/adminbjkai/boxy/blob/main/src/main.rs"
click node_browse "https://github.com/adminbjkai/boxy/blob/main/src/main.rs"
click node_mutate "https://github.com/adminbjkai/boxy/blob/main/src/main.rs"
click node_edit "https://github.com/adminbjkai/boxy/blob/main/src/main.rs"
click node_preview "https://github.com/adminbjkai/boxy/blob/main/src/main.rs"
click node_archives "https://github.com/adminbjkai/boxy/blob/main/src/main.rs"
click node_ws "https://github.com/adminbjkai/boxy/blob/main/src/main.rs"

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_user toneBlue
class node_server,node_file_api,node_path_safety toneAmber
class node_browse,node_mutate,node_edit,node_preview,node_archives,node_storage,node_thumb_cache toneMint
class node_ws,node_clients toneRose
```

## Components

### Browser experience

- [File manager UI](https://github.com/adminbjkai/boxy/blob/main/static/index.html): `static/index.html`

### Rust application

- [HTTP server](https://github.com/adminbjkai/boxy/blob/main/src/main.rs): `src/main.rs`
- [File API](https://github.com/adminbjkai/boxy/blob/main/src/main.rs): `src/main.rs`
- [Path safety](https://github.com/adminbjkai/boxy/blob/main/src/main.rs): `src/main.rs`

### File operations

- [Browse and search](https://github.com/adminbjkai/boxy/blob/main/src/main.rs): `src/main.rs`
- [Upload and organize](https://github.com/adminbjkai/boxy/blob/main/src/main.rs): `src/main.rs`
- [Text editing](https://github.com/adminbjkai/boxy/blob/main/src/main.rs): `src/main.rs`
- [Preview and thumbnails](https://github.com/adminbjkai/boxy/blob/main/src/main.rs): `src/main.rs`
- [ZIP downloads](https://github.com/adminbjkai/boxy/blob/main/src/main.rs): `src/main.rs`
- **Upload directory**
- **Thumbnail cache**

### Live updates

- [WebSocket channel](https://github.com/adminbjkai/boxy/blob/main/src/main.rs): `src/main.rs`
- **Connected clients**

### Other components

- **User**

## Connections

- User → File manager UI: uses (evidence: `README.md`)
- File manager UI → HTTP server: requests
- HTTP server → File API: routes (evidence: `src/main.rs`)
- File API → Browse and search: serves (evidence: `README.md`)
- File API → Upload and organize: serves (evidence: `README.md`)
- File API → Text editing: serves (evidence: `README.md`)
- File API → Preview and thumbnails: serves (evidence: `README.md`)
- File API → ZIP downloads: serves (evidence: `README.md`)
- File API → Path safety: validates paths (evidence: `README.md`)
- Browse and search → Upload directory: reads (evidence: `README.md`)
- Upload and organize → Upload directory: writes (evidence: `README.md`)
- Text editing → Upload directory: reads and writes (evidence: `README.md`)
- Preview and thumbnails → Upload directory: reads (evidence: `README.md`)
- Preview and thumbnails → Thumbnail cache: caches thumbnails (evidence: `README.md`)
- ZIP downloads → Upload directory: reads (evidence: `README.md`)
- HTTP server → WebSocket channel: routes (evidence: `src/main.rs`)
- WebSocket channel → Connected clients: broadcasts updates (evidence: `README.md`)
- Upload and organize → WebSocket channel: notifies (evidence: `src/main.rs`)
