# nithishkumar2772/tbox-drive architecture

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

- Interactive diagram: https://gitdiagram.com/nithishkumar2772/tbox-drive
- Repository: https://github.com/nithishkumar2772/tbox-drive

## Overview

TBox Drive is a Windows-first TeraBox client with desktop and self-hosted browser interfaces, a shared Go service/provider layer, persistent transfer state, and a virtual-drive prototype. The main workflow connects an account through device authorization, browses and manages cloud files, then transfers files while recording progress. The graph preserves the documented browser and virtual-drive branches. Some UI bindings and transfer internals were not sampled, so those connections are shown only where documentation or indexed references support them.

Main entry points: [`cmd/tboxdrive-desktop/app.go`](https://github.com/nithishkumar2772/tbox-drive/blob/main/cmd/tboxdrive-desktop/app.go) (Desktop app), [`internal/providers/terabox/provider.go`](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/providers/terabox/provider.go) (Provider adapter), [`internal/app/web/server.go`](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/app/web/server.go) (Local web server), [`internal/app/terabox_service.go`](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/app/terabox_service.go) (TeraBox service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_desktop_ui["Desktop UI<br/>[App.tsx]"]
  node_browser_ui["Browser UI<br/>[WebApp.tsx]"]
end

subgraph group_application["Application services"]
  node_desktop_app["Desktop app<br/>[app.go]"]
  node_web_server["Local web server<br/>[server.go]"]
  node_service["TeraBox service<br/>[terabox_service.go]"]
  node_virtual_drive["Virtual drive<br/>[manager_windows.go]"]
end

subgraph group_cloud["TeraBox integration"]
  node_oauth["Device authorization<br/>[oauth.go]"]
  node_provider["Provider adapter<br/>[provider.go]"]
  node_file_ops["Cloud file operations<br/>[filemanager.go]"]
end

subgraph group_transfers["Transfer workflow"]
  node_upload["Multipart upload<br/>[upload.go]"]
  node_download["Streaming download<br/>[download.go]"]
  node_transfer_core["Transfer engine"]
end

subgraph group_state["Local state"]
  node_sqlite[("SQLite store<br/>[store.go]")]
  node_account_model["Account model<br/>[account.go]"]
  node_keyring["OS credential vault<br/>[store.go]"]
end

node_user(("User"))
node_terabox_service{{"TeraBox Open Platform"}}

node_user -->|"uses"| node_desktop_ui
node_user -->|"uses"| node_browser_ui
node_desktop_ui -.->|"invokes"| node_desktop_app
node_browser_ui -->|"requests API"| node_web_server
node_desktop_app -->|"initializes"| node_service
node_desktop_app -->|"opens"| node_sqlite
node_desktop_app -->|"configures"| node_oauth
node_desktop_app -->|"mounts via"| node_virtual_drive
node_desktop_app -->|"uploads and downloads via"| node_provider
node_web_server -->|"creates API client via"| node_service
node_web_server -->|"records transfers"| node_sqlite
node_web_server -->|"requests file operations"| node_provider
node_web_server -->|"creates transfer tasks"| node_transfer_core
node_service -.->|"uses"| node_oauth
node_provider -.->|"implements"| node_file_ops
node_provider -.->|"implements"| node_upload
node_provider -.->|"implements"| node_download
node_upload -.->|"persists transfer parts"| node_transfer_core
node_sqlite -->|"stores accounts"| node_account_model
node_sqlite -->|"persists tasks and parts"| node_transfer_core
node_service -.->|"stores credentials via"| node_keyring
node_oauth -->|"authorizes with"| node_terabox_service
node_file_ops -->|"sends operations to"| node_terabox_service
node_virtual_drive -->|"uses API client"| node_provider

click node_desktop_ui "https://github.com/nithishkumar2772/tbox-drive/blob/main/frontend/src/App.tsx"
click node_browser_ui "https://github.com/nithishkumar2772/tbox-drive/blob/main/frontend/src/WebApp.tsx"
click node_desktop_app "https://github.com/nithishkumar2772/tbox-drive/blob/main/cmd/tboxdrive-desktop/app.go"
click node_web_server "https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/app/web/server.go"
click node_service "https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/app/terabox_service.go"
click node_virtual_drive "https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/virtualdrive/manager_windows.go"
click node_oauth "https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/providers/terabox/oauth.go"
click node_provider "https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/providers/terabox/provider.go"
click node_file_ops "https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/providers/terabox/filemanager.go"
click node_upload "https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/providers/terabox/upload.go"
click node_download "https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/providers/terabox/download.go"
click node_transfer_core "https://github.com/nithishkumar2772/tbox-drive/tree/main/internal/core/transfer"
click node_sqlite "https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/storage/sqlite/store.go"
click node_account_model "https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/core/account/account.go"
click node_keyring "https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/security/keyring/store.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_desktop_ui,node_browser_ui,node_user toneBlue
class node_desktop_app,node_web_server,node_service,node_virtual_drive toneAmber
class node_oauth,node_provider,node_file_ops toneMint
class node_upload,node_download,node_transfer_core toneRose
class node_sqlite,node_account_model,node_keyring,node_terabox_service toneIndigo
```

## Components

### User clients

- [Desktop UI](https://github.com/nithishkumar2772/tbox-drive/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Browser UI](https://github.com/nithishkumar2772/tbox-drive/blob/main/frontend/src/WebApp.tsx): `frontend/src/WebApp.tsx`

### Application services

- [Desktop app](https://github.com/nithishkumar2772/tbox-drive/blob/main/cmd/tboxdrive-desktop/app.go): `cmd/tboxdrive-desktop/app.go`
- [Local web server](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/app/web/server.go): `internal/app/web/server.go`
- [TeraBox service](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/app/terabox_service.go): `internal/app/terabox_service.go`
- [Virtual drive](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/virtualdrive/manager_windows.go): `internal/virtualdrive/manager_windows.go`

### TeraBox integration

- [Device authorization](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/providers/terabox/oauth.go): `internal/providers/terabox/oauth.go`
- [Provider adapter](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/providers/terabox/provider.go): `internal/providers/terabox/provider.go`
- [Cloud file operations](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/providers/terabox/filemanager.go): `internal/providers/terabox/filemanager.go`

### Transfer workflow

- [Multipart upload](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/providers/terabox/upload.go): `internal/providers/terabox/upload.go`
- [Streaming download](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/providers/terabox/download.go): `internal/providers/terabox/download.go`
- [Transfer engine](https://github.com/nithishkumar2772/tbox-drive/tree/main/internal/core/transfer): `internal/core/transfer`

### Local state

- [SQLite store](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/storage/sqlite/store.go): `internal/storage/sqlite/store.go`
- [Account model](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/core/account/account.go): `internal/core/account/account.go`
- [OS credential vault](https://github.com/nithishkumar2772/tbox-drive/blob/main/internal/security/keyring/store.go): `internal/security/keyring/store.go`

### Other components

- **User**
- **TeraBox Open Platform**

## Connections

- User → Desktop UI: uses (evidence: `README.md`)
- User → Browser UI: uses (evidence: `README.md`)
- Desktop UI → Desktop app: invokes
- Browser UI → Local web server: requests API (evidence: `README.md`)
- Desktop app → TeraBox service: initializes (evidence: `cmd/tboxdrive-desktop/app.go`)
- Desktop app → SQLite store: opens (evidence: `cmd/tboxdrive-desktop/app.go`)
- Desktop app → Device authorization: configures (evidence: `cmd/tboxdrive-desktop/app.go`)
- Desktop app → Virtual drive: mounts via (evidence: `cmd/tboxdrive-desktop/app.go`)
- Desktop app → Provider adapter: uploads and downloads via (evidence: `cmd/tboxdrive-desktop/app.go`)
- Local web server → TeraBox service: creates API client via (evidence: `internal/app/web/server.go`)
- Local web server → SQLite store: records transfers (evidence: `internal/app/web/server.go`)
- Local web server → Provider adapter: requests file operations (evidence: `internal/app/web/server.go`)
- Local web server → Transfer engine: creates transfer tasks (evidence: `internal/app/web/server.go`)
- TeraBox service → Device authorization: uses
- Provider adapter → Cloud file operations: implements
- Provider adapter → Multipart upload: implements
- Provider adapter → Streaming download: implements
- Multipart upload → Transfer engine: persists transfer parts
- SQLite store → Account model: stores accounts (evidence: `internal/storage/sqlite/store.go`)
- SQLite store → Transfer engine: persists tasks and parts (evidence: `internal/storage/sqlite/store.go`)
- TeraBox service → OS credential vault: stores credentials via
- Device authorization → TeraBox Open Platform: authorizes with (evidence: `internal/providers/terabox/oauth.go`)
- Cloud file operations → TeraBox Open Platform: sends operations to (evidence: `internal/providers/terabox/filemanager.go`)
- Virtual drive → Provider adapter: uses API client
