Overview
Bitwarden Server follows a microservices architecture pattern, with each service responsible for specific functionality. Services communicate through HTTP APIs and message queues, with a shared database layer.High-Level Architecture
Service Architecture
Core Services
API Service
API Service
Port: 4000 (default)The main REST API service that handles:
- Vault operations (ciphers, folders, collections)
- Organization management
- User account operations
- Attachment uploads/downloads
- Sync endpoints
- Two-factor authentication
Controllers/- REST API endpointsValidators/- Request validationServices/- Business logicModels/- Request/response models
- SQL Database (primary data store)
- Redis (caching and distributed locking)
- Blob Storage (attachments)
- Service Bus (event publishing)
Identity Service
Identity Service
Port: 33656 (default)OAuth 2.0 / OpenID Connect authentication server:
- User login and registration
- Token issuance and validation
- OAuth 2.0 flows (authorization code, client credentials)
- Two-factor authentication enforcement
- Device authorization
/connect/token- Token endpoint/connect/authorize- Authorization endpoint/.well-known/openid-configuration- Discovery
- SQL Database
- Redis (rate limiting)
- Certificate store (signing keys)
Admin Service
Admin Service
Port: 5000 (default)Administrative portal and API:
- User management
- Organization administration
- System configuration
- License management
- Event log viewing
- SQL Database
- Identity Service (authentication)
Notifications Service
Notifications Service
Port: 5002 (default)Real-time notification delivery:
- WebSocket connections for live updates
- Push notifications to connected clients
- Vault sync notifications
- Anonymous client connections
- Service Bus (receives notifications)
- Redis (connection management)
Events Service
Events Service
Port: 5003 (default)Event collection and audit logging:
- Receives events from all services
- Batches events for storage
- Provides event query API
- Audit trail compliance
- User actions (login, cipher access)
- Administrative changes
- Policy violations
- Security events
- SQL Database (event storage)
- Service Bus (event ingestion)
Enterprise Services
SSO Service
SSO Service
Port: 51822 (default)Single Sign-On integration:
- SAML 2.0 service provider
- OpenID Connect integration
- Just-in-time user provisioning
- Multi-provider support per organization
- SAML 2.0
- OpenID Connect (OIDC)
SCIM Service
SCIM Service
Port: 44559 (default)Automated user provisioning:
- SCIM 2.0 protocol implementation
- User lifecycle management
- Group synchronization
- Directory integration (Azure AD, Okta, etc.)
- User CRUD operations
- Group management
- Bulk operations
Billing Service
Billing Service
Port: 5004 (default)Payment and subscription management:
- Stripe integration
- Subscription lifecycle
- Invoice generation
- Payment method management
- Stripe (credit cards)
- PayPal
- BitPay (cryptocurrency)
Background Services
Events Processor
Events Processor
Background worker service:
- Processes events from Service Bus
- Aggregates event data
- Triggers notifications
- Cleanup old events
- Asynchronous event handling
- Batch processing
- Retry logic
Icons Service
Icons Service
Port: 5005 (default)Website icon fetching:
- Downloads favicons for vault items
- Caches icons in blob storage
- Serves cached icons
- Fallback to default icons
- Aggressive caching (30+ days)
- CDN-friendly headers
Data Flow
Authentication Flow
Event Processing Flow
Technology Stack
Framework
- .NET 8.0
- ASP.NET Core
- Entity Framework Core
- Dapper (micro-ORM)
Authentication
- IdentityServer4
- OAuth 2.0 / OpenID Connect
- JWT tokens
- Certificate-based signing
Database
- SQL Server 2022
- PostgreSQL 14+
- MySQL 8.0 / MariaDB 10+
- Entity Framework migrations
Messaging
- Azure Service Bus
- RabbitMQ
- SignalR (WebSockets)
Storage
- Azure Blob Storage
- Local filesystem
- S3-compatible storage
Caching
- Redis
- In-memory caching
- Distributed cache
Scalability Considerations
Horizontal Scaling
Stateless Services
All services are stateless and can be scaled horizontally behind a load balancer.
Database
Use read replicas for read-heavy operations. Consider database sharding for large deployments.
High Availability
- Deploy services across multiple availability zones
- Use database clustering (SQL Server Always On, PostgreSQL replication)
- Redis Sentinel or Redis Cluster for cache high availability
- Load balancer health checks for automatic failover
Security Architecture
Transport Security
- TLS 1.2+ required
- Certificate pinning support
- HSTS headers
Data Security
- Client-side encryption
- Database encryption at rest
- Encrypted backups
Authentication
- OAuth 2.0 / OpenID Connect
- Two-factor authentication
- Device authorization
Authorization
- Role-based access control (RBAC)
- Organization policies
- Granular permissions
Network Ports
| Service | Default Port | Protocol | Public |
|---|---|---|---|
| API | 4000 | HTTPS | Yes |
| Identity | 33656 | HTTPS | Yes |
| Admin | 5000 | HTTPS | No |
| Notifications | 5002 | WSS | Yes |
| Events | 5003 | HTTPS | No |
| SSO | 51822 | HTTPS | Yes |
| SCIM | 44559 | HTTPS | Yes |
| Billing | 5004 | HTTPS | No |
| Icons | 5005 | HTTPS | Yes |
Next Steps
Docker Deployment
Deploy the full stack using Docker Compose
Configuration
Configure services using appsettings.json
Database Setup
Set up and configure the database
Service Documentation
Learn about individual services