Skip to content

System overview

Trinity is one end-to-end encrypted Matrix client delivered through four host environments. The Angular application and its libraries are shared; the Web/PWA runs the bundle directly, while Capacitor and Electron package the same root www/ output.

The main parts have distinct responsibilities:

PartResponsibility
apps/trinitySelect routes, environment values, lazy features, and application providers
Application librariesCoordinate startup, workspace navigation, appearance, search, and badge state across capabilities
Data-access librariesOwn product capability state and isolate Matrix SDK access
Feature librariesPresent workflows and connect UI to capability APIs
Component librariesProvide reusable, domain-neutral Trinity controls and layouts
Runtime librariesSupply policy-free projection, preference, and host primitives
Host adaptersTranslate browser, Capacitor, and Electron behavior into shared host contracts

provideTrinityApplication() is the host-neutral composition boundary. It installs zoneless Angular change detection, the router, capability providers, shared UI providers, host capabilities, and the Application Runtime adapter. The application entrypoint supplies routes, environment configuration, build information, and lazy dialog loaders.

Application Runtime owns ordered startup: negotiate the host, hydrate preferences, restore accounts, prepare session capabilities, restore Workspace, then open readiness and ongoing session streams. A feature does not start a parallel application lifetime.

After startup, capability services project authoritative Matrix or host events into read-only signals. Feature components render those signals and invoke finite commands. The result of a command normally returns through the same event projection rather than a second hand-maintained application store.

A typical room action moves through these boundaries:

  1. A feature component invokes a public data-access command.
  2. The data-access adapter calls matrix-js-sdk for the exact active account and room.
  3. SDK events invalidate or reconcile the owned projection.
  4. Read-only signals update the OnPush UI.
  5. Workspace remains responsible for the canonical destination and browser history.

Use capability ownership to select the owner, dependency boundaries before adding an import, and host capabilities before branching on an environment.