|
| 1 | +--- |
| 2 | +adr: "0022" |
| 3 | +status: In progress |
| 4 | +date: 2023-01-09 |
| 5 | +tags: [clients] |
| 6 | +--- |
| 7 | + |
| 8 | +# 0001 - Team-owned libs |
| 9 | + |
| 10 | +<AdrTable frontMatter={frontMatter}></AdrTable> |
| 11 | + |
| 12 | +## Context and Problem Statement |
| 13 | + |
| 14 | +Historically, much of the feature logic of Bitwarden has existed within the `apps/` directories, |
| 15 | +only being moved to `libs/` (usually `libs/common/` or `libs/angular/`) if it needed to be shared |
| 16 | +between multiple clients. |
| 17 | + |
| 18 | +This pattern makes it more difficult for teams to independently manage code they own. |
| 19 | + |
| 20 | +## Considered Options |
| 21 | + |
| 22 | +- **Do nothing** - Keep our current pattern. |
| 23 | +- **Template-driven forms** - Break functionality out of `apps/`, `libs/common/`, and |
| 24 | + `libs/angular/` and move into libs that are smaller, feature-focused, and owned by a team. |
| 25 | + |
| 26 | +Source: https://angular.io/guide/forms-overview#choosing-an-approach |
| 27 | + |
| 28 | +## Decision Outcome |
| 29 | + |
| 30 | +Chosen option: **Team-owned libs** |
| 31 | + |
| 32 | +### Positive Consequences |
| 33 | + |
| 34 | +- **Clear public API** - Each team can decide what is public and private within their library. This |
| 35 | + prevents teams from relying on code that is meant to be internal. |
| 36 | +- **Faster builds** - |
| 37 | +- **More team autonomy** - |
| 38 | +- **Easier to share code between apps** - |
| 39 | +- **Clearer dependency graph** - It will be easier to inspect which teams are relying internal and |
| 40 | + external dependencies. |
| 41 | +- **Simplified code ownership** - |
| 42 | + |
| 43 | +### Negative Consequences |
| 44 | + |
| 45 | +- **Managing circular dependencies** - |
| 46 | +- **More boilerplate** - |
0 commit comments