| crates | ||
| deploy | ||
| scripts | ||
| .dockerignore | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| Dockerfile | ||
| LICENSE | ||
| NOTICE | ||
| README.md | ||
| rust-toolchain.toml | ||
| wariarr.example.toml | ||
wariarr
Invite management for a self-hosted Plex server, in Rust. Hand someone a link, they put in their Plex email, and the share is created. The links, the setup instructions and the help pages are all served from one place.
Built as an independent Rust program, with Wizarr read as a reference for the Plex sharing API and for what an invite manager has to track. See NOTICE.
Table of Contents
Install
Needs Rust 1.99.0, pinned in rust-toolchain.toml.
cargo build --release
The result is one binary at target/release/wariarr with the templates, the
stylesheet and htmx compiled in. Nothing else has to be copied beside it.
Then:
cp wariarr.example.toml wariarr.toml
$EDITOR wariarr.toml # set plex.url, plex.token, admin.password, database
./target/release/wariarr check # confirm Plex answers
The example keeps the database at /var/lib/wariarr/wariarr.db, which is where
the Docker setup mounts it. For a local run, set database to a path you can
write, such as wariarr.db. Wariarr creates the file. The directory has to
exist already.
Docker
docker build -t wariarr:local .
deploy/compose.yml runs that image with host networking, a read-only root,
no capabilities and a non-root user. It expects three things on the host:
| What | Default path | Notes |
|---|---|---|
| Config | /etc/wariarr/wariarr.toml |
Mounted read-only. It holds no secret |
| Secrets | /etc/wariarr/secrets.env |
WARIARR_PLEX_TOKEN and WARIARR_ADMIN_PASSWORD, one per line |
| Data | /var/lib/wariarr |
The SQLite database. Owned by the user the container runs as |
Copy deploy/env.example to .env beside compose.yml, set the image and the
user, then docker compose up -d --wait. Put a TLS proxy in front of it:
deploy/traefik.yml is a sample route, and deploy/wariarr.service is a
systemd unit for running the binary without Docker.
Usage
wariarr serve # run the web interface
wariarr check # confirm Plex answers, list its libraries
wariarr invite --label "Dave" --days 30 --uses 1
wariarr invites # list every invite
wariarr reap # withdraw access from lapsed memberships
wariarr invite prints the finished link, so it composes:
wariarr invite --label "Dave" --days 30 | xclip -selection clipboard
Pages
| Path | Who | What |
|---|---|---|
/ |
anyone | Landing page, plus a box to type an invite code into |
/help |
anyone | Setup instructions, app links, the usual failures |
/j/{code} |
a guest | The join page, or a plain sentence saying why the link is closed |
/admin |
you | Invitation and access counts, current viewers, recent viewing |
/admin/invites |
you | Create links; inspect uses, expiry, libraries, and guest acceptance |
/admin/users |
you | Search accepted and pending users, memberships, playback time, and current viewing; change a user's libraries or remove them |
/admin/history |
you | Filter the server's viewing history and playback time by viewer and period |
/healthz |
the proxy | ok |
/admin/login trades admin.password for a session cookie, and everything
under /admin asks for that cookie. Writes must also carry an Origin naming
this site, so a form on somebody else's page cannot spend the owner's session.
The admin pages include people the server was shared with before Wariarr existed, and history the server recorded before it. Current playback refreshes every 15 seconds. History shows recorded plays, titles, viewers, timestamps and devices. Plex records a play once the item counts as watched, so a film left halfway is absent. Playback time fills that gap from the server's daily statistics: minutes per viewer and the devices used, with no titles.
Each Users row can change the libraries its share covers. That works for any share of the server, whoever made it, and one button gives every existing share a Wariarr record without touching anybody's access. A share lists its libraries by name, so a library added to the server later reaches nobody until it is ticked for them.
What has run against a real Plex
The Plex sharing API is not documented by Plex. The calls here were read from Wizarr and from the Plex Web client, and then tried.
| Call | State |
|---|---|
| Server identity, libraries, share lists, history, playback statistics, sessions | Run live |
| Create a share for every library | Run live, accepted by a guest |
| Delete a share, accepted or pending | Run live |
| Create a share for selected libraries | Tested against the stub only |
| Change a share's libraries | Tested against the stub only |
| The reaper's withdrawal | Tested against the stub only, and doubtful. Leave the reaper off |
Access that ends on its own
An invite carries two separate clocks:
- Link expiry: after this, the link no longer opens.
- Membership length: how long a guest keeps access once they are in.
A membership that lapses is only marked lapsed until the reaper runs. The
reaper is off by default, and with it off nobody loses access without you
saying so. Its withdrawal call has not run against a real Plex yet; see the
table above before turning it on with reaper.enabled.
How it fits together
Five application crates and one integration-test crate. The invite rules can be tested without a database or a network.
| Crate | What it holds |
|---|---|
wariarr-core |
Invites, memberships, activity types, the MediaBackend trait. No I/O. |
wariarr-store |
SQLite, via sqlx. Every SQL statement in the project lives here. |
wariarr-plex |
The Plex backend: the local server plus plex.tv. |
wariarr-web |
Axum router, Askama templates, admin auth. |
wariarr |
The binary: config, CLI, the reaper. |
wariarr-e2e |
Integration harness, Plex stub, and optional live-container tests. |
No handler names Plex. The web layer holds Arc<dyn MediaBackend>, so Jellyfin
or Emby would be a new crate and a config arm. Only Plex is written.
A browser check drives the pages against a Plex stub at three widths. It needs Python Playwright and a Chromium browser. Build the preview once, start it twice, and pass both printed URLs:
cargo build -p wariarr-e2e --example preview
target/debug/examples/preview
target/debug/examples/preview --offline
python scripts/check-browser.py --base http://127.0.0.1:PORT --offline http://127.0.0.1:OFFLINE_PORT
The gate:
cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings
cargo fmt --all --check
Contributing
The author is Alan Gaudet <alan@aldermetric.com>.
Development happens in a private repository. The public copy at https://git.alangaudet.dev/alan/wariarr is a source snapshot: one commit per publication, with the operator's own deployment notes left out. The gate above runs by hand and has to be green before anything lands.