# Cloud Torrent — AI Rewrite (`airewrite`) > A ground-up rewrite of [cloud-torrent](https://github.com/jpillora/cloud-torrent) that preserves the > **exact user experience** while replacing the implementation with a modern, type-safe stack. Cloud Torrent is a self-hosted remote torrent client: you add torrents from a browser, they download to the server's disk as sets of files, and those files are then retrievable or streamable over HTTP. This document is the source of truth for the rewrite. The original implementation lives on the `master` branch and is the **functional reference** — when behaviour is ambiguous, match `master`. --- ## 1. Goals & Principles 1. **Identical UX.** Same five sections, same flows, same visual language. A user familiar with the old app must feel zero difference. The first deliverable is the core loop: **choose a torrent in the Omni bar → watch progress in the Torrent engine → download the resulting files.** 2. **Ground-up implementation.** No code is copied from `master`. AngularJS + Semantic UI + hand-rolled JS are replaced by Vue 3 + Vite + TypeScript. The Go backend is re-implemented cleanly. 3. **One canonical data model.** Application state is defined **once** as Go structs and **generated** into TypeScript. The frontend never hand-writes a shape that exists in Go. 4. **Realtime by default.** Server → browser state is synced in realtime with [`jpillora/velox`](https://github.com/jpillora/velox) (same library as `master`). 5. **Single binary.** The built frontend is embedded into the Go binary. `go build` produces one cross-platform, dependency-free executable. 6. **Verified against reality.** End-to-end correctness is proven by downloading real, legal torrents from (they carry WebSeeds, so they complete reliably). ### Non-goals (for the initial rewrite) - The "0.9 / general cloud-transfer engine" vision (remote backends, transforms, RSS). Out of scope. - Changing the torrent engine. We stay on [`anacrolix/torrent`](https://github.com/anacrolix/torrent). - Auth/TLS feature expansion — port the existing basic-auth + TLS options as-is, no more. --- ## 2. Tech Stack | Layer | Choice | |------------------|------------------------------------------------------------------------| | Language (server)| Go (match `go.mod` toolchain on `master`) | | Torrent engine | `github.com/anacrolix/torrent` (`v1.59.x`) | | Realtime sync | `github.com/jpillora/velox` (`v0.4.2`) — same API as `master` | | CLI / flags | `github.com/jpillora/opts` | | Search scraper | `github.com/jpillora/scraper` | | System stats | `github.com/shirou/gopsutil/v3` | | Zip streaming | `github.com/jpillora/archive` | | Language (web) | TypeScript | | UI framework | Vue 3 (`