Automatically Sync your Password Managers Data to Bitwarden/Vaultwarden
BitwardenSync is a docker service that syncs your password manager data to your Bitwarden/Vaultwarden instance.
It watches a directory for export files. For each file it purges the vault through the Bitwarden REST API, verifies the vault is empty, imports the file with the Bitwarden CLI, and removes the file. The import only runs after the server confirms an empty vault, thus repeated imports can never create duplicate entries.
- Start by duplicating the
.env.examplefile, renaming the duplicate to.env. Fill in the required fields within.env.
- Supported import formats.
BITWARDEN_SYNC_BW_CLIENTIDandBITWARDEN_SYNC_BW_CLIENTSECRETcome from your account's API key (Web vault -> Settings -> Security -> Keys).
- Proceed to craft your
docker-compose.ymlfile, tailoring it to your environment.
Upgrading from 1.x: version 2.0.0 purges the vault through the REST API instead of browser automation. The
BITWARDEN_SYNC_BW_OTP_CODE,UID, andGIDvariables are gone; remove them from your.envand compose file.
To start the BitwardenSync service, use the following command:
docker-compose up -d --force-recreate
- Configure the BitwardenSync tool to export data into the directory:
/opt/appdata/bitwardensync/data
- Once the data file is placed in the above directory, BitwardenSync automatically:
-
Detects the new file and waits until it stops growing. Hidden files and partial uploads (
.incomplete,.part,.tmp) are skipped. -
Purges the existing vault data through the REST API and verifies with the server that the vault is empty. When the purge cannot be verified, the import is aborted and the container exits, thus old and new entries never mix.
-
Imports the new data file into the vault and logs the resulting item count.
-
Deletes the imported file to maintain a clean directory. Files that fail to import move to the
.failed/subdirectory for inspection instead of retrying forever.
- The process repeats each time new data is exported into the directory.
Note: SSH keys in Ed25519 format are not supported by Bitwarden. Attempting to use them will result in the error:
Failed to execute 'encrypt' on 'SubtleCrypto': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'. For more information, see the Bitwarden SSH Agent documentation.
BitwardenSync also works on its own, without an export tool such as BackupOnePass. Place the input file in the directory mentioned above and it processes the data automatically as described.
Install the dev dependencies and run the checks:
bun install # or: npm install
npm run typecheck # TypeScript check of the vault tool
npm test # unit tests (crypto, config, API client, purge logic)
npm run test:e2e # full loop against a disposable local Vaultwarden (needs docker and the bw CLI)
npm run prettier:check
The container code lives in docker/: entrypoint.sh runs the watch/import loop and src/ holds the TypeScript vault tool (cli.js purge and cli.js count). docker/package.json carries the runtime dependencies; the image builds in two stages and ships only the compiled dist/.
We're happy to welcome @Breadfishman's contributions to our work this project. They collaborated closely on the project under our shared account.
Please see the contributing guide
Created by NorkzYT with 💛
► Twitch https://www.twitch.tv/polymathnorkz
► Discord https://discord.com/users/282100214024896522
► GitHub https://github.com/NorkzYT
