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
- Chrome
- Firefox
- Safari
- Edge
- Opera
Build for Chrome and Chromium-based browsers:Output:
apps/browser/build/Load in Chrome:- Navigate to
chrome://extensions/ - Enable “Developer mode”
- Click “Load unpacked”
- 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 browserMANIFEST_VERSION=3- Manifest version (Chrome uses MV3)NODE_ENV=production- Production optimizationNODE_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:build:main:dev- Main process (Electron)build:renderer:dev- Renderer process (Angular)build:preload:dev- Preload scripts
apps/desktop/build/
Run the application
After building: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:Platform packages
Create distributable packages for each platform:- Windows
- macOS
- Linux
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:apps/web/build/
Development server
Run with live reload: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|cloudNODE_ENV=production- Enable production optimizationNODE_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
apps/cli/build/bw.js
Run the CLI:
Watch mode
Production build
Native executables
Create standalone binaries with no Node.js requirement:- Windows
- macOS
- Linux
@yao-pkg/pkg.
Debug mode
Run with Node.js inspector: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