# wireapp/wire-web-packages architecture

> Architecture diagram of the GitHub repository wireapp/wire-web-packages, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wireapp/wire-web-packages
- Repository: https://github.com/wireapp/wire-web-packages

## Overview

##### Project type and purpose
- This is a monorepo of TypeScript-based npm libraries maintained by Wire’s web team.
- It uses Lerna and Yarn Workspaces to organize dozens of packages (API clients, UI components, utilities, tooling).
- Purpose: provide reusable building blocks (connectivity, core logic, UI, storage engines, utilities, internal tools) for Wire’s web applications and third-party developers.

##### File structure
- Top-level files: lerna.json, package.json, yarnrc.yml, .github CI workflows, tsconfig.json.
- ‘packages/’: each subfolder is an independent npm module.
- Configuration packages: eslint-config, prettier-config
- Core libraries: core, commons, priority-queue, promise-queue, store-engine and its engines (dexie, fs, bro-fs, sqleet, web-storage), api-client, cli-client
- UI kit: react-ui-kit, storybook config
- Bots: bot-api, changelog-bot
- Internal tools: copy-config, license-collector, telemetry, webapp-events, certificate-check
- Build/test: each package has its own tsconfig.json, jest.config.js or jasmine.json, build scripts.
- CI: workflows for linting, testing, publishing.

##### README for additional insights
- It enumerates all published packages grouped by domain (Bots, Commons, Configuration, Connectivity, Encoding, Tools, UI).
- It prescribes Yarn + Lerna to bootstrap and test, and a standardized release process.

##### Main components and relationships
a. Components
1) Monorepo root (Lerna/Yarn Workspaces orchestrator)
2) Package groups (by domain):
- Configuration (eslint/prettier)
- Core logic (core, commons, priority-queue, promise-queue, store-engine family)
- Connectivity (api-client, cli-client)
- UI (react-ui-kit)
- Bots (bot-api, changelog-bot)
- Internal tools (copy-config, license-collector, telemetry, webapp-events, certificate-check)
3) Build/test/CI subsystem
4) External systems: npm registry, GitHub Actions, Storybook UI
b. Relationships & interactions
- The monorepo root configures workspaces and dependency graph.
- Core logic packages have minimal mutual dependencies:
- commons is a low-level utility used by many others
- store-engine and its engines provide storage abstractions used by core
- core implements domain services (account, auth, conversation) on top of store-engine
- Connectivity packages depend on core and commons for building client SDKs:
- api-client uses core services and HTTP layer to expose REST/WS APIs
- cli-client is a thin CLI wrapper over api-client + core-crypto
- UI kit depends on commons (utilities) and optionally on core messages/types to render UI components.
- Bots sit atop api-client to implement specific automation scenarios.
- Internal tools are standalone CLIs or libraries for code-gen, license collection, telemetry embed.
- CI orchestrates build/test/publish across all packages, using GitHub Actions, Husky, Prettier, ESLint, Jest/ Jasmine.

##### Architectural patterns and design principles
- Monorepo with explicit domain grouping
- Strict boundary between layers: utilities → core → connectivity → UI/tools → bots
- Each package is small, single-responsibility, with its own test suite and build config
- Dependency inversion: higher-level packages (bots, UI) depend on abstractions in lower layers (core, commons)
- Workspace tooling: Lerna for versioning, Yarn Workspaces for fast installs

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External systems
    GitHubActions((CI/CD)):::cloud
    npmRegistry[(npm Registry)]:::db

    %% Monorepo container
    subgraph "Wire Monorepo (Lerna + Yarn Workspaces)" 
        MonorepoRoot["Monorepo Root"]:::root

        %% Configuration layer
        subgraph "Configuration"
            ESLintConfig["@wireapp/eslint-config"] 
            PrettierConfig["@wireapp/prettier-config"] 
        end

        %% Core layer
        subgraph "Core"
            Commons["@wireapp/commons"] 
            PriorityQueue["@wireapp/priority-queue"] 
            PromiseQueue["@wireapp/promise-queue"] 
            StoreEngine["@wireapp/store-engine"] 
            StoreDexie["@wireapp/store-engine-dexie"] 
            StoreFs["@wireapp/store-engine-fs"] 
            CoreLib["@wireapp/core"] 
        end

        %% Connectivity layer
        subgraph "Connectivity"
            APIClient["@wireapp/api-client"] 
            CLIClient["@wireapp/cli-client"] 
        end

        %% UI layer
        subgraph "UI"
            ReactUIKit["@wireapp/react-ui-kit"] 
        end

        %% Bots layer
        subgraph "Bots"
            BotAPI["@wireapp/bot-api"] 
            ChangelogBot["@wireapp/changelog-bot"] 
        end

        %% Tools layer
        subgraph "Tools"
            CopyConfig["@wireapp/copy-config"] 
            LicenseCollector["@wireapp/license-collector"] 
            Telemetry["@wireapp/telemetry"] 
            WebappEvents["@wireapp/webapp-events"] 
            CertCheck["@wireapp/certificate-check"] 
        end
    end

    %% Dependencies
    Commons -->|depends on| PriorityQueue
    PriorityQueue -->|depends on| PromiseQueue
    StoreEngine -->|engine for| CoreLib
    Commons -->|provides utilities| CoreLib
    CoreLib -->|core services| APIClient
    APIClient -->|used by| CLIClient
    APIClient -->|used by| BotAPI
    APIClient -->|used by| ChangelogBot
    Commons -->|utilities| ReactUIKit

    %% CI/CD and publishing
    GitHubActions -->|build/test/publish| MonorepoRoot
    MonorepoRoot -->|publish packages| npmRegistry

    %% Click Events - Monorepo Root
    click MonorepoRoot "https://github.com/wireapp/wire-web-packages/blob/main/lerna.json"
    click MonorepoRoot "https://github.com/wireapp/wire-web-packages/blob/main/package.json"
    click MonorepoRoot "https://github.com/wireapp/wire-web-packages/blob/main/yarnrc.yml"
    click MonorepoRoot "https://github.com/wireapp/wire-web-packages/blob/main/tsconfig.json"
    click MonorepoRoot "https://github.com/wireapp/wire-web-packages/tree/main/.github/"
    click MonorepoRoot "https://github.com/wireapp/wire-web-packages/tree/main/.husky/"

    %% Click Events - Configuration
    click ESLintConfig "https://github.com/wireapp/wire-web-packages/blob/main/packages/eslint-config/eslintrc.js"
    click ESLintConfig "https://github.com/wireapp/wire-web-packages/blob/main/packages/eslint-config/package.json"
    click PrettierConfig "https://github.com/wireapp/wire-web-packages/blob/main/packages/prettier-config/index.json"
    click PrettierConfig "https://github.com/wireapp/wire-web-packages/blob/main/packages/prettier-config/package.json"

    %% Click Events - Core
    click Commons "https://github.com/wireapp/wire-web-packages/tree/main/packages/commons/src"
    click Commons "https://github.com/wireapp/wire-web-packages/blob/main/packages/commons/jest.config.js"
    click Commons "https://github.com/wireapp/wire-web-packages/blob/main/packages/commons/package.json"
    click PriorityQueue "https://github.com/wireapp/wire-web-packages/tree/main/packages/priority-queue/src"
    click PriorityQueue "https://github.com/wireapp/wire-web-packages/blob/main/packages/priority-queue/jest.config.js"
    click PriorityQueue "https://github.com/wireapp/wire-web-packages/blob/main/packages/priority-queue/package.json"
    click PromiseQueue "https://github.com/wireapp/wire-web-packages/tree/main/packages/promise-queue/src"
    click PromiseQueue "https://github.com/wireapp/wire-web-packages/blob/main/packages/promise-queue/jest.config.js"
    click PromiseQueue "https://github.com/wireapp/wire-web-packages/blob/main/packages/promise-queue/package.json"
    click StoreEngine "https://github.com/wireapp/wire-web-packages/tree/main/packages/store-engine/src"
    click StoreEngine "https://github.com/wireapp/wire-web-packages/blob/main/packages/store-engine/jest.config.js"
    click StoreEngine "https://github.com/wireapp/wire-web-packages/blob/main/packages/store-engine/package.json"
    click StoreDexie "https://github.com/wireapp/wire-web-packages/tree/main/packages/store-engine-dexie/src"
    click StoreDexie "https://github.com/wireapp/wire-web-packages/blob/main/packages/store-engine-dexie/jest.config.js"
    click StoreDexie "https://github.com/wireapp/wire-web-packages/blob/main/packages/store-engine-dexie/package.json"
    click StoreFs "https://github.com/wireapp/wire-web-packages/tree/main/packages/store-engine-fs/src"
    click StoreFs "https://github.com/wireapp/wire-web-packages/blob/main/packages/store-engine-fs/jest.config.js"
    click StoreFs "https://github.com/wireapp/wire-web-packages/blob/main/packages/store-engine-fs/package.json"
    click CoreLib "https://github.com/wireapp/wire-web-packages/tree/main/packages/core/src"
    click CoreLib "https://github.com/wireapp/wire-web-packages/blob/main/packages/core/jest.config.js"
    click CoreLib "https://github.com/wireapp/wire-web-packages/blob/main/packages/core/package.json"

    %% Click Events - Connectivity
    click APIClient "https://github.com/wireapp/wire-web-packages/tree/main/packages/api-client/src"
    click APIClient "https://github.com/wireapp/wire-web-packages/blob/main/packages/api-client/jest.config.js"
    click APIClient "https://github.com/wireapp/wire-web-packages/blob/main/packages/api-client/package.json"
    click CLIClient "https://github.com/wireapp/wire-web-packages/tree/main/packages/cli-client/src"
    click CLIClient "https://github.com/wireapp/wire-web-packages/blob/main/packages/cli-client/jest.config.js"
    click CLIClient "https://github.com/wireapp/wire-web-packages/blob/main/packages/cli-client/package.json"

    %% Click Events - UI
    click ReactUIKit "https://github.com/wireapp/wire-web-packages/tree/main/packages/react-ui-kit/src"
    click ReactUIKit "https://github.com/wireapp/wire-web-packages/blob/main/packages/react-ui-kit/jest.config.js"
    click ReactUIKit "https://github.com/wireapp/wire-web-packages/blob/main/packages/react-ui-kit/package.json"
    click ReactUIKit "https://github.com/wireapp/wire-web-packages/blob/main/packages/react-ui-kit/.storybook"

    %% Click Events - Tools
    click CopyConfig "https://github.com/wireapp/wire-web-packages/tree/main/packages/copy-config/src"
    click CopyConfig "https://github.com/wireapp/wire-web-packages/blob/main/packages/copy-config/jest.config.js"
    click CopyConfig "https://github.com/wireapp/wire-web-packages/blob/main/packages/copy-config/package.json"
    click LicenseCollector "https://github.com/wireapp/wire-web-packages/tree/main/packages/license-collector/src"
    click LicenseCollector "https://github.com/wireapp/wire-web-packages/blob/main/packages/license-collector/package.json"
    click Telemetry "https://github.com/wireapp/wire-web-packages/tree/main/packages/telemetry/src"
    click Telemetry "https://github.com/wireapp/wire-web-packages/blob/main/packages/telemetry/package.json"
    click WebappEvents "https://github.com/wireapp/wire-web-packages/tree/main/packages/webapp-events/src"
    click WebappEvents "https://github.com/wireapp/wire-web-packages/blob/main/packages/webapp-events/package.json"
    click CertCheck "https://github.com/wireapp/wire-web-packages/tree/main/packages/certificate-check/src"
    click CertCheck "https://github.com/wireapp/wire-web-packages/blob/main/packages/certificate-check/jest.config.js"
    click CertCheck "https://github.com/wireapp/wire-web-packages/blob/main/packages/certificate-check/package.json"

    %% Click Events - CI config
    click GitHubActions "https://github.com/wireapp/wire-web-packages/tree/main/.github/workflows"
    click MonorepoRoot "https://github.com/wireapp/wire-web-packages/blob/main/jest.config.js"
    click MonorepoRoot "https://github.com/wireapp/wire-web-packages/blob/main/jest.config.base.js"
    click MonorepoRoot "https://github.com/wireapp/wire-web-packages/tree/main/.husky/pre-commit"
    click MonorepoRoot "https://github.com/wireapp/wire-web-packages/blob/main/yarnrc.yml"
    click MonorepoRoot "https://github.com/wireapp/wire-web-packages/tree/main/.yarn/"

    %% Styles
    classDef root fill:#ffe066,stroke:#333,stroke-width:1px
    classDef config fill:#f9c74f,stroke:#333
    classDef core fill:#90be6d,stroke:#333
    classDef conn fill:#4dabf7,stroke:#333
    classDef ui fill:#f9844a,stroke:#333
    classDef bots fill:#e76f51,stroke:#333
    classDef tools fill:#adb5bd,stroke:#333
    classDef cloud fill:#64dfdf,stroke:#333
    classDef db fill:#bdb2ff,stroke:#333

    class ESLintConfig,PrettierConfig config
    class Commons,PriorityQueue,PromiseQueue,StoreEngine,StoreDexie,StoreFs,CoreLib core
    class APIClient,CLIClient conn
    class ReactUIKit ui
    class BotAPI,ChangelogBot bots
    class CopyConfig,LicenseCollector,Telemetry,WebappEvents,CertCheck tools
```
