Skip to main content

Development

Work on Transmission VPN from source with the repository's npm workspaces, Docker build stages, and documentation checks.

Repository Layout

Repository root
text
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

CommandPurpose
npm run checkLints, type-checks, and tests the root, then runs check in every workspace.
npm run buildRuns build in every workspace.
npm run deploy:containerRuns docker compose up --build --detach.
npm run dev --workspace transmission-vpn-app-transmissionRuns the container in the foreground and the interface development server together.
npm run dev:web --workspace transmission-vpn-app-transmissionStarts 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-transmissionStarts Vite on port 5173 with a built-in mock API, so the interface runs without the container.
npm run check --workspace transmission-vpn-app-transmissionLints, type-checks, and unit-tests the web interface.
npm run check --workspace transmission-vpn-tool-dockerRuns 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-docsStarts the documentation development server.

With the mock API, setting MOCK_KEY_REPLACED=true starts the interface as if the installation key had been lost, so the Saved secrets were removed notice and a paused notification show.

Architecture

The image runs one service graph under s6-overlay:

Service graph
text
base
`-- config-init (oneshot)
    |-- directory-controller (longrun)
    |   `-- control-api (longrun)
    `-- firewall-init (oneshot)
        |-- vpn-controller (longrun)
        |-- web-proxy (longrun)
        `-- transmission (longrun)

Testing

  • Go — The image build runs go test ./... in its control-api-test stage, so a failing test stops the build.
  • Web interface — Vitest unit tests run through the workspace's check script.
  • Container — packages/docker/tests holds a foundation test and a fail-closed integration test that builds the image and checks identities, firewall rules, blocked egress, connections opened through the VPN controller, the claim flow, a controlled restart, and a missing NET_ADMIN.
  • OpenVPN — check:openvpn verifies policy routing, fixed source binding, SNAT, peer loss, and recovery through an OpenVPN server container.
  • Several connections — check:multi-vpn runs 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:wireguard in packages/docker runs an end-to-end test against a WireGuard server in a second container, once with the kernel module and once with wireguard-go. 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.

Documentation Site

  • Pages — Each sidebar category is a folder in apps/docs/docs/ with a _category_.json, and sidebars.ts generates 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 the Terminology component from @cbnventures/docusaurus-preset-nova/blocks, using one short hover line per term.

Homepage Blocks

  • src/pages/index.tsx builds the homepage from blocks exported by @cbnventures/docusaurus-preset-nova/blocks, such as Canvas, InstallStrip, Features, Stats, and BlogPreview, with its own hero and VPN panel inside Canvas.
  • docusaurus.config.ts reads the site identity from the root nova.config.json through NovaIdentity.

Checks and Build

bash
npm run check --workspace transmission-vpn-docs
npm run build --workspace transmission-vpn-docs
  • check runs 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 Terminology link against the H2 headings in docs/reference/terminology.mdx.
  • build produces the static site and fails on broken links.