Development
Work on Transmission VPN from source with the repository's npm workspaces, Docker build stages, and documentation checks.
Repository Layout
Repository root
transmission-vpn/
|-- apps/
| |-- transmission/ # Web interface (React and Vite) and control-api/ (Go)
| `-- docs/ # This documentation site (Docusaurus)
|-- packages/
| `-- docker/ # Container rootfs, s6 services, manifest, and container tests
|-- tests/ # Root project tests
|-- Dockerfile # The single image, built from the repository root
`-- compose.yml # Local build and run
PROJECT_RULES.md at the repository root describes the runtime design and project boundaries.
Commands
| Command | Purpose |
|---|---|
npm run check | Lints, type-checks, and tests the root, then runs check in every workspace. |
npm run build | Runs build in every workspace. |
npm run deploy:container | Runs docker compose up --build --detach. |
npm run dev --workspace transmission-vpn-app-transmission | Runs the container in the foreground and the interface development server together. |
npm run dev:web --workspace transmission-vpn-app-transmission | Starts Vite on port 5173, which forwards /api to 127.0.0.1:22602 and /transmission/rpc to 127.0.0.1:9091. |
npm run mock --workspace transmission-vpn-app-transmission | Starts Vite on port 5173 with a built-in mock API, so the interface runs without the container. |
npm run check --workspace transmission-vpn-app-transmission | Lints, type-checks, and unit-tests the web interface. |
npm run check --workspace transmission-vpn-tool-docker | Runs the Go tests in a Docker build stage, plus the foundation, fail-closed, OpenVPN, WireGuard, and several-connection container tests. |
npm run dev --workspace transmission-vpn-docs | Starts the documentation development server. |
With the mock API, setting MOCK_KEY_REPLACED=true starts the interface as if the installation keyUnlocks your saved secrets; lose it and they're removed had been lost, so the Saved secrets were removed notice and a paused notification show.
Architecture
The image runs one service graph under s6-overlayStarts the firewall first and keeps every service running:
Service graph
base
`-- config-init (oneshot)
|-- directory-controller (longrun)
| `-- control-api (longrun)
`-- firewall-init (oneshot)
|-- vpn-controller (longrun)
|-- web-proxy (longrun)
`-- transmission (longrun)
config-init— ValidatesPUIDWhich user owns your downloads on the host,PGIDWhich user owns your downloads on the host,TZ, and the TUN deviceThe /dev/net/tun device the container needs for tunnels, and prepares persistent folders.firewall-init— Installs the firewall boundaryFirewall rules that drop anything not going through a VPN, and its down script removes the rules after the protected services stop.- Go binaries —
transmission-vpn-api,transmission-vpn-directory-controller,transmission-vpn-web-proxy,transmission-vpn-vpn-controller, andtransmission-vpn-transmission-runner, all built fromapps/transmission/control-api. - Web interface — Built with Vite and served by
transmission-vpn-apifrom/usr/local/share/transmission-vpn/web.
Testing
- Go — The image build runs
go test ./...in itscontrol-api-teststage, so a failing test stops the build. - Web interface — Vitest unit tests run through the workspace's
checkscript. - Container —
packages/docker/testsholds a foundation test and a fail-closedWhen the VPN drops, traffic stops instead of leaking integration test that builds the image and checks identities, firewall rules, blocked egress, connections opened through the VPN controller, the claim flow, a controlled restartRestarts Transmission to apply settings, not the container, and a missingNET_ADMINThe Docker capability that lets it manage its firewall. - OpenVPN —
check:openvpnverifies policy routing, fixed source binding, SNAT, peer loss, and recovery through an OpenVPN server container. - Several connections —
check:multi-vpnruns two isolated tunnels and Transmission daemons, then verifies combined RPC, per-login proxy routes, torrent moves, removal with a move target, and duplicate WireGuard provider addresses. - WireGuard —
check:wireguardinpackages/dockerruns an end-to-end test against a WireGuard server in a second container, once with the kernel module and once withwireguard-goWireGuard without a kernel module; slower, no setup. It checks that:- Slot 0 Transmission traffic leaves only through
wg0, from its fixed private address. - The uploaded file's IPv6 lines are stripped.
- A dead server blocks Transmission until the server returns.
- Shutdown blocks the tunnel before the firewall is removed.
- Slot 0 Transmission traffic leaves only through
Documentation Site
- Pages — Each sidebar category is a folder in
apps/docs/docs/with a_category_.json, andsidebars.tsgenerates the sidebar from the folders. - Conventions — Page structure, frontmatter, and voice follow
conventions/documentation.md. - Glossary — Terms are rows in topic tables under H2 sections in
docs/reference/terminology.mdx, and pages link to a term's section with theTerminologycomponent from@cbnventures/docusaurus-preset-nova/blocks, using one short hover line per term.
Homepage Blocks
src/pages/index.tsxbuilds the homepage from blocks exported by@cbnventures/docusaurus-preset-nova/blocks, such asCanvas,InstallStrip,Features,Stats, andBlogPreview, with its own hero and VPN panel insideCanvas.docusaurus.config.tsreads the site identity from the rootnova.config.jsonthroughNovaIdentity.
Checks and Build
npm run check --workspace transmission-vpn-docs
npm run build --workspace transmission-vpn-docs
checkruns ESLint, three type-checks, and Vitest suites for frontmatter, links, Markdown tables, terminology, dotenv files, and type declarations.- The Markdown table suite expects every table to match the output of Nova's
MarkdownTable. - The terminology suite checks every
Terminologylink against the H2 headings indocs/reference/terminology.mdx. buildproduces the static site and fails on broken links.