Skip to content

Run bwtidy

bwtidy runs as one Docker container with the official Bitwarden CLI inside. It works with a vault on a Bitwarden or Vaultwarden server. You need Docker with Compose. The usual way is the ready-made image docker.io/tnek213/bwtidy from Docker Hub. compose.yaml pulls it, so you have nothing to build. Every tag of the image is a release:

  • latest is the newest release, betas and release candidates included.
  • A version (like 1.0.0-beta.3) is one release and never moves to another image.

The Release notes say what each one brings. Docker Hub has no image of main between releases. To run unreleased code, build the image yourself.

GitHub Actions builds every published image from this repository. It signs a provenance attestation for each one, which shows the commit the image was built from. Verifying the image in SECURITY.md shows how to check it.

Start it

Get compose.yaml and example.env by cloning the repository. You can also download compose.yaml and example.env into one directory instead. Then copy example.env to .env, which is your settings file. With a clone it takes these two commands.

git clone https://github.com/tnek213/bwtidy.git bwtidy && cd bwtidy
cp example.env .env

Each setting is a variable in .env, and example.env says what it does. The defaults are fine to start with. Configuration lists them all.

You can pin BWTIDY_VERSION in .env to a version instead of latest. Then start the container.

docker compose up -d

Open http://127.0.0.1:8765 on the host. Compose publishes only that port and only on the host's 127.0.0.1 (BWTIDY_HOST_PORT in .env changes the port). These docs are at http://127.0.0.1:8765/docs/ for anyone who can reach that address, without a login.

Log in the first time

The first login goes through a few forms and may need a code from your mail.

  1. Enter the server and your email, then click Continue. The server is https://vault.bitwarden.com unless you use another one.

    The account form with the server and email filled in and Continue outlined

  2. For an account bwtidy does not know yet, a dialog offers to create it. Click Create. bwtidy keeps a new account only when its first login and unlock succeed.

  3. bwtidy shows a vault login with the server and email filled in. Type your master password and click Log in. A console below the form shows what the Bitwarden CLI prints.
  4. On a first login from a new device bitwarden.com emails you a one-time code. Type it into Answer to the CLI under the console and press Enter. An account with two-step login asks for its code in the same field.

bwtidy then unlocks the vault with the same master password, so you type it only once. From then on the page asks only for the master password to unlock. It shows "Starting" for a few seconds while the account's worker starts.

The unlock form with the master password typed and Unlock outlined

The browser remembers the account. One browser profile works with one account at a time, but several accounts can use the same URL. Each one is kept apart from the others (see How accounts are kept apart).

Logging in explains when the session ends and what happens to your unsaved changes then.

Warning

Do not run bw unlock, bw lock or bw logout in the container while you are logged in to the web UI. Each of them invalidates the session key bwtidy uses for backups (see How bwtidy uses the Bitwarden CLI).

Build the image yourself

Build the image from a checkout instead of pulling it when you want to run unreleased code or only what you built yourself. compose.build.yaml adds the build to compose.yaml. It builds the target app of the Dockerfile from the checkout and names the image bwtidy:local. Everything else comes from compose.yaml and .env.

Building with Compose needs buildx 0.17 or later. The build also draws the diagrams of these docs on a Kroki server. That is https://kroki.io unless the build arg BWTIDY_KROKI_URL names your own, which compose.build.yaml takes from the environment (see the section Diagrams of dev/release.md).

git clone https://github.com/tnek213/bwtidy.git bwtidy && cd bwtidy
cp example.env .env
BWTIDY_COMMIT="$(git log -1 --format='%cd %h' --date=format:%y%m%d)" \
  docker compose -f compose.yaml -f compose.build.yaml up -d --build

The version comes from backend/pyproject.toml in the checkout. The build has no .git, so the commit comes in as the build arg BWTIDY_COMMIT. It holds the committer date (YYMMDD) and the short hash with a space between them, the way the project's own image workflow sets it.

The About page then shows both, like 0.1.0-alpha.1 (261111 7db8830). Without the commit it shows the version alone. The published images also carry the OCI labels org.opencontainers.image.version and org.opencontainers.image.revision. The workflow sets them and a build of your own leaves them out.

With a buildx older than 0.17, build with plain Docker first. Then start it without --build.

docker build --target app -t bwtidy:local \
  --build-arg BWTIDY_COMMIT="$(git log -1 --format='%cd %h' --date=format:%y%m%d)" .
docker compose -f compose.yaml -f compose.build.yaml up -d

To update, run git pull and then the same commands again.

Behind a reverse proxy

A reverse proxy (Caddy, nginx or Traefik) on the same host lets other machines reach bwtidy. It terminates TLS and forwards plain HTTP to 127.0.0.1:8765.

A browser and an MCP client connect over HTTPS to the reverse proxy at bwtidy.example. The proxy terminates TLS and forwards plain HTTP to the host's 127.0.0.1:8765. Docker passes that port on to the bwtidy container on the same host.

Then set these two in .env with your own host name and run docker compose up -d again.

BWTIDY_SECURE_COOKIES=1
BWTIDY_MCP_HOSTS=bwtidy.example

The first marks the cookies Secure. The second lets /mcp accept requests addressed to your host name, which it reads from the Host header. So the proxy must pass that header on unchanged. Caddy and Traefik do so by default, while nginx needs proxy_set_header Host $host. Configuration has the details of both settings.

Update, stop and logs

  • To update the published image, change BWTIDY_VERSION in .env or keep latest. Then run docker compose pull && docker compose up -d. Your data is kept.
  • docker compose down stops bwtidy. The stop ends every session, which first tries to write your unsaved edits (see Logging in). The volumes stay and with them your accounts and their backups. docker compose down -v deletes the volumes, but a backup directory on the host stays.
  • Run docker logs bwtidy to read the gateway's log. Each account's worker writes worker.log in its account directory (see Files and volumes). When a worker exits before it answers, the gateway's log also holds the last line the worker wrote.

The About page (More actions, About bwtidy) shows the version and the commit the running image was built from.