Skip to main content
Bitwarden Server is a large .NET solution containing 55+ projects organized into core libraries, hosted services, infrastructure implementations, and utilities.

Solution Organization

The repository is organized into three main directories:

Source Projects (src/)

The src/ directory contains all application code:

Core Library

Location: src/Core/ The Core project is the heart of the application, containing:
  • Entities - Domain models (User, Organization, Cipher, etc.)
  • Repository Interfaces - Data access contracts
  • Service Interfaces - Business logic contracts
  • Enums - Application-wide enumerations
  • Constants - Application constants
Core is a class library (.csproj) and contains no ASP.NET dependencies. It’s referenced by all other projects.

Hosted Services

These are ASP.NET applications that run as microservices:

API (src/Api/)

The main REST API for vault operations:
Runs on: Port 4000 (development)

Identity (src/Identity/)

Authentication service based on IdentityServer:
Runs on: Port 33656 (development)

Admin (src/Admin/)

Administration portal and system utilities:

Billing (src/Billing/)

Billing and subscription management service:

Events (src/Events/)

Event logging service for audit trails:

EventsProcessor (src/EventsProcessor/)

Background worker for processing event data.

Notifications (src/Notifications/)

Real-time notification hub using SignalR:

Icons (src/Icons/)

Website icon fetching service for login entries.

Infrastructure Projects

These implement data access using different ORMs:

Infrastructure.Dapper (src/Infrastructure.Dapper/)

Dapper-based repository implementations using stored procedures:
Database: SQL Server (primary)

Infrastructure.EntityFramework (src/Infrastructure.EntityFramework/)

Entity Framework Core implementations:
Databases: PostgreSQL, MySQL

Shared Projects

SharedWeb (src/SharedWeb/)

Shared utilities for web applications:
  • Middleware
  • Filters
  • Model binders

Utility Projects (util/)

Utilities for database management and deployment:

Test Projects (test/)

Organized by the source project they test:

Project Dependencies

The dependency flow follows this hierarchy:

Dependency Rules

  1. Core has no dependencies on hosted services or infrastructure
  2. Infrastructure projects reference Core only
  3. Hosted services reference Core and one Infrastructure project
  4. SharedWeb can reference Core but not Infrastructure

Domain Organization

Core domains are organized as subdirectories within Core/:
  • AdminConsole - Organizations, users, groups, policies
  • Auth - Authentication, SSO, device management
  • Vault - Ciphers (vault items), collections, folders
  • Billing - Subscriptions, payments, invoices
  • SecretsManager - Secrets Manager specific features
  • NotificationCenter - In-app notifications
  • Tools - Send, emergency access, reports
  • Platform - Cross-cutting concerns (push, email, etc.)
Each domain typically contains:

Configuration Files

Solution Level

  • bitwarden-server.sln - Main Visual Studio solution
  • global.json - .NET SDK version configuration
  • Directory.Build.props - Shared MSBuild properties
  • .editorconfig - Code style rules

Development

  • .devcontainer/ - VS Code dev container configurations
  • dev/ - Local development settings and secrets
  • docker-compose.yml - Local development services

Git

  • .gitignore - Ignored files and directories
  • .git-hooks/ - Pre-commit hooks for formatting
  • .github/ - GitHub Actions workflows

Technology Stack

Framework & Language

  • .NET 8.0 - Application framework
  • C# 11 - Programming language
  • ASP.NET Core - Web framework

Data Access

  • Dapper - Micro-ORM for SQL Server
  • Entity Framework Core - ORM for PostgreSQL/MySQL
  • SQL Server - Primary database
  • PostgreSQL - Alternative database
  • MySQL - Alternative database

Testing

  • xUnit - Test framework
  • AutoFixture - Test data generation
  • NSubstitute - Mocking framework

Third-Party Libraries

  • IdentityServer - OAuth/OIDC provider
  • SignalR - Real-time communications
  • Stripe/Braintree - Payment processing
  • Azure Storage - File storage

Build Artifacts

Build outputs are organized by project:

Docker Structure

Each hosted service has its own Dockerfile:
Images are published to GitHub Container Registry.

Key Files to Know

Finding Features

  1. Business Logic - Look in Core/{Domain}/Services/
  2. Data Models - Look in Core/{Domain}/Entities/
  3. API Endpoints - Look in src/Api/Controllers/
  4. Database Queries - Look in Infrastructure.Dapper/Repositories/

Understanding Flow

Typical request flow:

See Also