bitwarden/server
Bitwarden Server
The Bitwarden Server repository contains the APIs, database schema, and core infrastructure that power the "backend" for every Bitwarden client (web vault, browser extensions, desktop, mobile, CLI, and the directory-connector). It is a multi-service .NET 8 / ASP.NET Core application with a SQL-Server-first data layer that also supports MySQL, Postgres, and SQLite via Entity Framework.
The codebase is split into several deployable services (Api, Identity, Admin, Billing, Events, EventsProcessor, Notifications, Icons, plus the commercially-licensed Sso and Scim) and a large shared Core library that holds entities, repositories, services, commands, and queries grouped by product domain (Vault, Auth, AdminConsole, Billing, Tools, KeyManagement, Platform, NotificationCenter, SecretsManager, Dirt).
What this wiki covers
- Architecture — system map, data flow, and service-to-service interactions.
- Getting started — prerequisites, building, running, seeding the database, and signing in locally.
- Glossary — Bitwarden-specific vocabulary (cipher, send, organization-user, master password hash, KDF, etc.).
After the introductory material, the wiki splits the codebase into four lenses:
- Apps — every deployable service in the solution (
Api,Identity,Admin,Billing,Events,EventsProcessor,Notifications,Icons,Sso,Scim). - Systems — internal building blocks that span multiple apps: the data infrastructure layer, IdentityServer/OAuth, push notifications, jobs/scheduling, mail, event integrations, configuration.
- Features — cross-cutting capabilities (vault, sends, two-factor auth, organizations & policies, billing & subscriptions, key management & rotation, secrets manager, SSO/SAML, SCIM provisioning, reports/Dirt).
- Primitives — the foundational domain objects (
User,Organization,Cipher,Collection,Group,Device,Send).
The rest of the wiki is reference material: the API surface, deployment, security model, configuration / data models / dependencies, and the maintainers table that maps each subsystem to the team that owns it.
Who uses this codebase
- Bitwarden cloud operators — running production clusters in US (
bitwarden.com) and EU (bitwarden.eu). - Self-hosted operators — anyone who deploys Bitwarden behind their own firewall using the
bitwarden.sh/bitwarden.ps1Docker scripts. - Bitwarden developers — internal teams (Auth, Vault, Admin Console, Billing, Tools, Platform, Key Management, Dirt, AppSec, BRE, DBOps) who extend and operate the platform.
- Open-source contributors — the bulk of the repo is licensed under AGPL-3.0; the
bitwarden_license/directory holds commercial features (SSO, SCIM, Secrets Manager) under the Bitwarden License.
Repository layout at a glance
bitwarden_server/
├── src/ # OSS deployable services + shared Core
│ ├── Api/ # Public + internal REST API
│ ├── Identity/ # OAuth/OIDC token endpoint (IdentityServer)
│ ├── Admin/ # Razor Pages internal admin UI
│ ├── Billing/ # Stripe + PayPal webhook receivers
│ ├── Events/ # Audit-log ingest API
│ ├── EventsProcessor/# Drains the event queue into storage
│ ├── Notifications/ # SignalR push hub
│ ├── Icons/ # Favicon proxy/cache
│ ├── Core/ # Shared domain library (entities, services, commands)
│ ├── Infrastructure.Dapper/ # SQL Server repositories (Dapper)
│ ├── Infrastructure.EntityFramework/# EF Core repositories (MySQL/Postgres/SQLite)
│ ├── SharedWeb/ # ASP.NET Core middleware/extensions used by every service
│ └── Sql/ # T-SQL: tables, views, stored procs (canonical schema)
├── bitwarden_license/ # Commercial-licensed features
│ └── src/{Sso, Scim, Commercial.Core, Commercial.Infrastructure.EntityFramework}
├── util/ # DB migrators, Setup/SelfHost wizard, RustSdk, Seeder, Nginx config
├── test/ # xUnit unit + integration tests
├── dev/ # Developer compose stack (mssql, postgres, mysql, redis, ...)
└── perf/ # k6 load-test scripts and runnerThe codebase is large: ~118k lines of C# across src/ and bitwarden_license/, plus ~80k lines of T-SQL in src/Sql/, ~470 SQL migration scripts in util/Migrator/DbScripts/, and ~900 EF migrations. See by-the-numbers for the numerical snapshot and lore for the historical timeline.
Where to start
- New to the repo? Read getting-started and architecture in that order, then pick the app closest to your work.
- Working on a specific feature? Jump to the features lens.
- Adding a new database column? Read reference/data-models and the migrations workflow.
- Investigating a production issue? See debugging and security.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.