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:
Identity (src/Identity/)
Authentication service based on IdentityServer:
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:
Infrastructure.EntityFramework (src/Infrastructure.EntityFramework/)
Entity Framework Core implementations:
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
- Core has no dependencies on hosted services or infrastructure
- Infrastructure projects reference Core only
- Hosted services reference Core and one Infrastructure project
- SharedWeb can reference Core but not Infrastructure
Domain Organization
Core domains are organized as subdirectories withinCore/:
- 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.)
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:Key Files to Know
| File | Purpose |
|---|---|
src/Core/Constants.cs:1 | Application-wide constants |
src/Core/Entities/ITableObject.cs:1 | Base entity interface |
src/Core/Repositories/IRepository.cs:1 | Base repository interface |
src/Api/Startup.cs:1 | API service configuration |
src/Identity/Startup.cs:1 | Identity service configuration |
util/Migrator/DbMigrator.cs:15 | Database migration engine |
Navigation Tips
Finding Features
- Business Logic - Look in
Core/{Domain}/Services/ - Data Models - Look in
Core/{Domain}/Entities/ - API Endpoints - Look in
src/Api/Controllers/ - Database Queries - Look in
Infrastructure.Dapper/Repositories/
Understanding Flow
Typical request flow:See Also
- Core Concepts - Understand the architecture patterns
- Data Models - Explore entity relationships
- Repositories - Learn the data access layer