Building binary
Stefan Melmuk edited on Jul 7, 2025.
Note
The (MSRV) Minimum Support Rust Version policy is N-2, which means that if the current Rust version is v1.67, we support building with v1.65, and when v1.69 is stable, then the MSRV would be v1.67.
That means that new Rust features which come to stable can not be used once a new stable has been released, but have to wait for two more releases.
To be sure you are using the stable version we strongly suggest to use rustup which makes installing and updating Rust very easy.
Any version below the MSRV will generate a warning, and you are on your own when forcing to build with an older version.
This page is primarily for those interested in vaultwarden development, or who have a specific reason for wanting to build their own binary.
Typical users should either deploy via Docker, extract the pre-built binaries from the Alpine-based Docker images, or look for a third-party package.
Dependencies
Rust stable(strongly recommended to use rustup)
⚠️ The (MSRV) minimum support Rust version is N-2, which means that if the current Rust version is v1.67, we support building with v1.65.- On a Debian based distro some general packages to make sure building should go fine install the following:
build-essential,git OpenSSL(should be available in path, see openssl crate docs) On a Debian based distro, you need to installpkg-configandlibssl-dev- For the SQlite3 backend on a Debian based distro you need to install
libsqlite3-dev - For the MySQL backend on a Debian based distro you need to install
libmariadb-dev-compatandlibmariadb-dev - For the PostgreSQL on a Debian based distro you need to install
libpq-devandpkg-config NodeJS(only when compiling the web-vault, install through your system's package manager, use the prebuilt binaries) or nodesource binary distribution Note: Building the web-vault currently requires NodeJS v16 and NPM v8.11
Run/Compile
All backends
SQlite backend
MySQL backend
PostgreSQL backend
When run, the server is accessible in http://localhost:8000.
Install the web-vault
A compiled version of the web vault can be downloaded from dani-garcia/bw_web_builds.
Note: building the Vault needs ~1.5GB of RAM. On systems like a RaspberryPI with 1GB or less, please enable swapping or build it on a more powerful machine and copy the directory from there. This much memory is only needed for building it, running vaultwarden with vault needs only about 10MB of RAM.
If you prefer to compile it manually, follow these steps:
New (easy way):
- Clone the git repository at dani-garcia/bw_web_builds:
Important
The script requires you to enter a tag or a branch of a web-vault to build. The main branch is an out-of-date mirror of the bitwarden/clients repository that has not been patched, so it won't be compatible with Vaultwarden.
Old (very manual way):
- Clone the git repository at bitwarden/clients and checkout the latest release tag (e.g. v2022.6.0):
-
Patch all the images from resources according to the instructions in the apply_patches script
-
Download the patch file from dani-garcia/bw_web_builds and copy it to the
web-vaultfolder. To choose the version to use, assuming the web vault is versionvXXXX.Y.Z: - If there is a patch with version
vXXXX.Y.Z, use that one - Otherwise, pick the one with the largest version that is still smaller than
vXXXX.Y.Z - Apply the patch
- Then, build the Vault:
Note: You might be asked to run npm audit fix to fix vulnerability. This will automatically try to upgrade packages to newer version, which might not be compatible and break web-vault functionality``` Use it at your own risk, if you know what you are doing. We do use this on our own releases btw!
Finally copy the contents of the build folder into the destination folder:
- If you run with
cargo run --release, it'svaultwarden/web-vault. - If you run the compiled binary directly, it's next to the binary, in
vaultwarden/target/release/web-vault.
Configuration
The available configuration options are documented in the default .env.template file, and they can be modified by uncommenting the desired options in that file or by setting their respective environment variables. See the Configuration section of this wiki for the main configuration options available.
If you want to use this file you need to copy it, and name it .env and adjust the settings in that specific file.
Note: the environment variables override the values set in the .env file.
More information for deployment
How to recreate database schemas for the sqlite backend (for developers)
Install diesel-cli with cargo:
Make sure that the correct path to the database is in the .env file.
If you want to modify the schemas, create a new migration with:
Modify the *.sql files, making sure that any changes are reverted in the down.sql file.
Apply the migrations and save the generated schemas as follows:
How to migrate from SQLite backend to MySQL backend (for developers)
Refer to using the MariaDB (MySQL) Backend if you want to migrate from SQLite.
How to migrate from SQLite backend to PostgreSQL backend (for developers)
Refer to using the PostgreSQL backend if you want to migrate from SQLite.