Prerequisites
Before you begin, ensure you have the following installed:- .NET SDK 8.0 - The server is built with .NET 8.0
- Docker - For running local dependencies (databases, mail catcher)
- Docker Compose - For orchestrating development containers
- Git - For version control
- PowerShell (optional) - For running setup scripts on Windows
The recommended .NET version is 8.0.100 or later. Check
global.json in the repository root for the exact version.Development Container Setup
Bitwarden Server includes development container configurations for easy setup.1
Clone the repository
2
Choose your dev container
There are multiple dev container configurations available in
.devcontainer/:- community_dev - For community contributors (recommended)
- internal_dev - For Bitwarden team members
- bitwarden_common - Base configuration shared by others
3
Initialize data directories
The dev container will automatically create these directories:
4
Configure environment variables
Create a
dev/.env file with your database password:5
Set up secrets and certificates
Run the post-create setup script:You’ll be prompted for:
- Installation ID - Get from https://bitwarden.com/host
- Installation Key - Get from https://bitwarden.com/host
- Installation ID:
00000000-0000-0000-0000-000000000001 - Installation Key: (leave empty for local dev)
6
Run database migrations
Manual Setup (Without Dev Container)
If you prefer not to use dev containers:1
Start required services
Using Docker Compose:This starts:
- SQL Server 2022 - Main database (port 1433)
- MailCatcher - Email testing (port 1080)
2
Configure secrets
Copy the example secrets file:Update connection strings in
dev/secrets.json:3
Run migrations
See the Database Migrations guide for details.
4
Build the solution
IDE Configuration
Visual Studio Code
Recommended extensions are configured in.vscode/extensions.json:
- C# Dev Kit - For C# development
- EditorConfig - For consistent code formatting
JetBrains Rider / Visual Studio
Open the solution file:Running the API
To run the API project locally:https://localhost:4000.
The API uses settings from
appsettings.Development.json when running in development mode.Running the Identity Service
https://localhost:33656.
Running Tests
See the Testing Guide for comprehensive testing instructions.Port Configuration
The development environment uses these ports:Git Hooks
Bitwarden uses git hooks for automatic code formatting:dotnet format automatically.
Troubleshooting
Database Connection Issues
-
Ensure SQL Server is running:
-
Verify your connection string in
dev/secrets.json -
Check SQL Server logs:
Build Errors
-
Clean and restore:
-
Verify .NET SDK version:
Port Conflicts
If ports are already in use, update the port mappings in:.devcontainer/community_dev/devcontainer.json- forwardPorts sectiondocker-compose.yml- ports section
Next Steps
- Database Migrations - Learn how to create and run migrations
- Testing Guide - Run and write tests
- Project Structure - Understand the codebase organization
- Contribution Guide - Submit your first contribution