Services
Audience: Bitwarden engineers and AI agents building, extracting, or reviewing a server-side service.
This page is the living standard for how Bitwarden's services relate to one another: what a service owns, how a boundary is crossed, and what every service publishes. It was adopted in ADR-0035. The rules below evolve by pull request without superseding that decision.
RFC 2119 keywords (MUST, MUST NOT, SHOULD,
SHOULD NOT, MAY) are used deliberately. A MUST or MUST NOT is not negotiable at team level;
a team that needs an exception brings the case to the architecture group.
Terms
| Term | Definition |
|---|---|
| Consumer | Anything that calls a service: another service, a user interface, or an external integration. |
| Row-level security | The rules an owning service applies to decide which rows a caller may see, covering both organization scoping and any narrower per-user visibility. |
| Service | An independently deployable process that owns a set of resources and publishes a contract over them. |
| Service client | The package a service publishes so consumers can call it without hand-writing transport. |
Principles
- Service boundaries
MUSTderive from data ownership, not from team structure. - Every resource
MUSThave exactly one owning service, and that service is the only process that reads or writes its data store. - Services
MUSTbe built on theBitwarden.Server.Sdkpackage. - Services
MUSTdocument their APIs in OpenAPI format and conform to API Standards. - Services
MUST NOTmake breaking changes. Changes that would be breakingMUSTfollow the API versioning process as outlined by API Standards. - Services
MUSTprovide a service client for consumers. - Service clients
SHOULDmake use of a network cache to mitigate performance issues.- Any cache used
MUSTbe owned and invalidated by the owning service. - Serving results from cache
MUST NOTbypass authorization the owning service would otherwise enforce.
- Any cache used
- Services that need to read, write, or validate data owned by another service
SHOULDdo so via the service's published service client. - A service
MAYhold a local copy of another service's data only with a recorded justification (e.g. a measured hot-path volume, a stated availability requirement, etc.).- Any service holding a local copy
MUSTenforce the owner's row-level security on that copy and document the security ramifications of a stale copy (due to messaging lag, event processing failures, etc.).
- Any service holding a local copy
- Services
MUSTpublish events for every state change using the "transactional outbox" pattern, regardless of whether there are any known consumers.