Skip to main content

Building applications

This guide covers how to build each Bitwarden client application, including development builds, production builds, and watch mode for active development.
Before building, ensure you’ve completed the installation steps and have all dependencies installed.

Using Nx

The repository uses Nx for build orchestration. While each app has npm scripts, you can also use Nx directly:
Nx caches build outputs. If you need a clean build, use npx nx reset to clear the cache.

Browser extension

The browser extension must be built for each target browser.

Development builds

Build for Chrome and Chromium-based browsers:
Output: apps/browser/build/Load in Chrome:
  1. Navigate to chrome://extensions/
  2. Enable “Developer mode”
  3. Click “Load unpacked”
  4. Select the build/ directory

Watch mode

For active development, use watch mode to automatically rebuild on file changes:
After the extension rebuilds, you’ll need to reload it in your browser (click the reload button in the extensions page).

Production builds

Production builds are optimized and minified:

Distribution packages

Create distributable packages:

Build configuration

Builds use environment variables:
  • BROWSER=chrome|firefox|safari|edge|opera - Target browser
  • MANIFEST_VERSION=3 - Manifest version (Chrome uses MV3)
  • NODE_ENV=production - Production optimization
  • NODE_OPTIONS="--max-old-space-size=8192" - Allocate 8GB for build

Desktop application

The desktop app requires building three components: main process, renderer process, and preload scripts.

Development build

Build all components:
This runs three builds in parallel:
  • build:main:dev - Main process (Electron)
  • build:renderer:dev - Renderer process (Angular)
  • build:preload:dev - Preload scripts
Output: apps/desktop/build/

Run the application

After building:
Or run with certificate errors ignored (for local testing):

Watch mode

For active development, run watch mode in separate terminals:
The desktop app uses electron-reload to automatically restart when files change.

Production build

Production builds with optimization:
This builds all three components in production mode.

Platform packages

Create distributable packages for each platform:
Creates installers for x64, x86, and ARM64.

Native modules

The desktop app includes Rust native modules:

Web vault

The web vault can be built as open source (OSS) or commercial (bit).

Development build

Open source build:
Commercial build:
Output: apps/web/build/

Development server

Run with live reload:
Access at: http://localhost:8080
The dev server includes hot module replacement for faster development.

Production builds

Optimized builds for different environments:

Environment configuration

Builds use environment variables:
  • ENV=development|qa|production|selfhosted|cloud
  • NODE_ENV=production - Enable production optimization
  • NODE_OPTIONS="--max-old-space-size=8192" - Memory allocation

Command-line interface

The CLI can be built as a Node.js script or packaged as a native executable.

Development build

Output: apps/cli/build/bw.js Run the CLI:

Watch mode

Automatically rebuilds on file changes.

Production build

Optimized and minified output.

Native executables

Create standalone binaries with no Node.js requirement:
Creates a standalone .exe (x64).
Native executables are created using @yao-pkg/pkg.

Debug mode

Run with Node.js inspector:
Attach a debugger on chrome://inspect or VS Code.

Build optimization

Parallel builds

Build multiple apps simultaneously using Nx:

Incremental builds

Nx caches build outputs. Subsequent builds are much faster:

Build only changed projects

Troubleshooting

Build fails with memory errors

Browser/Web builds already allocate 8GB:

TypeScript errors

Webpack cache issues

Native module errors (Desktop)

Permission errors on build output

Next steps

Contributing

Learn the development workflow

Architecture

Understand the codebase structure

Requirements

Platform-specific requirements

Testing

Run tests and write new ones