# ars-anosov/matrix-react architecture

> Architecture diagram of the GitHub repository ars-anosov/matrix-react, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ars-anosov/matrix-react
- Repository: https://github.com/ars-anosov/matrix-react

## Overview

matrix-react is a browser Matrix messenger with optional Active Directory (AD) authentication. Users can sign in directly or authenticate through AD, then use the Matrix session to browse rooms, accept invitations, view spaces and chat with text or encrypted file attachments. Device verification is a distinct E2EE workflow. The graph follows documented UI and service boundaries; unsampled implementation details are omitted, and optional external Matrix/AD endpoints are not wired to specific components without source evidence.

Main entry points: [`src/services/matrixClient.js`](https://github.com/ars-anosov/matrix-react/blob/main/src/services/matrixClient.js) (Matrix client service), [`src/containers/AuthContainer.jsx`](https://github.com/ars-anosov/matrix-react/blob/main/src/containers/AuthContainer.jsx) (Auth coordination), [`src/actions/mtrxControlActions.js`](https://github.com/ars-anosov/matrix-react/blob/main/src/actions/mtrxControlActions.js) (Matrix actions), [`src/services/matrixRooms.js`](https://github.com/ars-anosov/matrix-react/blob/main/src/services/matrixRooms.js) (Room operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_app["Application shell<br/>[App.jsx]"]
  node_theme["Theme and verification config<br/>[theme.js]"]
end

subgraph group_auth["Authentication"]
  node_authui["Auth forms and toggle<br/>[AuthPad.jsx]"]
  node_adform["AD login form<br/>[AuthAd.jsx]"]
  node_authbridge["Auth coordination<br/>[AuthContainer.jsx]"]
  node_authactions["AD auth actions"]
  node_adauth["AD auth service<br/>[adAuth.js]"]
end

subgraph group_matrix["Matrix session"]
  node_mtrxcontainer["Matrix session container<br/>[MtrxContainer.jsx]"]
  node_regform["Matrix login form<br/>[MtrxReg.jsx]"]
  node_mtrxactions["Matrix actions"]
  node_client["Matrix client service<br/>[matrixClient.js]"]
  node_sdk["SDK loader<br/>[matrixSdk.js]"]
  node_verification["Device verification UI"]
end

subgraph group_chat["Rooms and messaging"]
  node_padcontainer["Messenger container"]
  node_pad["Messenger panel<br/>[MtrxPad.jsx]"]
  node_roomlist["Room list<br/>[MtrxRoomList.jsx]"]
  node_room["Active room<br/>[MtrxRoom.jsx]"]
  node_composer["Message composer<br/>[MtrxComposer.jsx]"]
  node_attachment["File attachments<br/>[MtrxAttachment.jsx]"]
  node_roomservice["Room operations<br/>[matrixRooms.js]"]
  node_mediaservice["Media transfer<br/>[matrixMedia.js]"]
end

subgraph group_state["State and persistence"]
  node_redux["Redux state<br/>[rootReducer.js]"]
  node_authreducer["Auth state<br/>[authControlRdcr.js]"]
  node_mtrxreducer["Matrix state<br/>[mtrxControlRdcr.js]"]
  node_constants["Action and UI constants<br/>[redux.js]"]
  node_clientstore["Client reference"]
  node_storage[("Browser session storage<br/>[storage.js]")]
end

node_user(("User"))
node_matrixserver{{"Matrix homeserver"}}
node_adserver{{"AD auth endpoint"}}

node_user -->|"uses"| node_app
node_app -->|"renders"| node_authbridge
node_authbridge -->|"renders"| node_authui
node_authbridge -->|"renders"| node_adform
node_authbridge -->|"dispatches"| node_authactions
node_authactions -->|"calls"| node_adauth
node_adform -->|"submits through"| node_adauth
node_adauth -->|"POSTs credentials"| node_adserver
node_authbridge -->|"coordinates session"| node_mtrxcontainer
node_mtrxcontainer -->|"renders"| node_regform
node_mtrxcontainer -->|"renders"| node_padcontainer
node_padcontainer -->|"renders"| node_pad
node_pad -->|"renders"| node_roomlist
node_pad -->|"renders"| node_room
node_pad -->|"renders"| node_verification
node_room -->|"uses"| node_composer
node_room -->|"renders"| node_attachment
node_mtrxcontainer -->|"dispatches"| node_mtrxactions
node_padcontainer -->|"dispatches"| node_mtrxactions
node_mtrxactions -->|"calls session operations"| node_client
node_mtrxactions -->|"calls room operations"| node_roomservice
node_client -->|"loads"| node_sdk
node_client -->|"sets and reads"| node_clientstore
node_client -->|"clears room cache"| node_roomservice
node_client -->|"clears media cache"| node_mediaservice
node_roomservice -->|"gets client"| node_clientstore
node_roomservice -->|"uses media operations"| node_mediaservice
node_roomservice -.->|"room operations"| node_matrixserver
node_mediaservice -.->|"media transfer"| node_matrixserver
node_adauth -->|"persists AD session"| node_storage
node_client -->|"persists Matrix session"| node_storage
node_redux -->|"combines"| node_authreducer
node_redux -->|"combines"| node_mtrxreducer
node_authactions -->|"dispatches action types"| node_constants
node_mtrxactions -->|"dispatches action types"| node_constants

click node_app "https://github.com/ars-anosov/matrix-react/blob/main/src/App.jsx"
click node_authui "https://github.com/ars-anosov/matrix-react/blob/main/src/components/AuthPad.jsx"
click node_adform "https://github.com/ars-anosov/matrix-react/blob/main/src/components/AuthAd.jsx"
click node_authbridge "https://github.com/ars-anosov/matrix-react/blob/main/src/containers/AuthContainer.jsx"
click node_authactions "https://github.com/ars-anosov/matrix-react/blob/main/src/actions/authControlActions.js"
click node_adauth "https://github.com/ars-anosov/matrix-react/blob/main/src/services/adAuth.js"
click node_mtrxcontainer "https://github.com/ars-anosov/matrix-react/blob/main/src/containers/MtrxContainer.jsx"
click node_regform "https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxReg.jsx"
click node_mtrxactions "https://github.com/ars-anosov/matrix-react/blob/main/src/actions/mtrxControlActions.js"
click node_client "https://github.com/ars-anosov/matrix-react/blob/main/src/services/matrixClient.js"
click node_sdk "https://github.com/ars-anosov/matrix-react/blob/main/src/services/matrixSdk.js"
click node_verification "https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxDeviceVerification.jsx"
click node_padcontainer "https://github.com/ars-anosov/matrix-react/blob/main/src/containers/MtrxPadContainer.jsx"
click node_pad "https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxPad.jsx"
click node_roomlist "https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxRoomList.jsx"
click node_room "https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxRoom.jsx"
click node_composer "https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxComposer.jsx"
click node_attachment "https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxAttachment.jsx"
click node_roomservice "https://github.com/ars-anosov/matrix-react/blob/main/src/services/matrixRooms.js"
click node_mediaservice "https://github.com/ars-anosov/matrix-react/blob/main/src/services/matrixMedia.js"
click node_redux "https://github.com/ars-anosov/matrix-react/blob/main/src/reducers/rootReducer.js"
click node_authreducer "https://github.com/ars-anosov/matrix-react/blob/main/src/reducers/authControlRdcr.js"
click node_mtrxreducer "https://github.com/ars-anosov/matrix-react/blob/main/src/reducers/mtrxControlRdcr.js"
click node_constants "https://github.com/ars-anosov/matrix-react/blob/main/src/constants/redux.js"
click node_clientstore "https://github.com/ars-anosov/matrix-react/blob/main/src/services/matrixClientStore.js"
click node_storage "https://github.com/ars-anosov/matrix-react/blob/main/src/constants/storage.js"
click node_theme "https://github.com/ars-anosov/matrix-react/blob/main/src/theme.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_theme,node_user toneBlue
class node_authui,node_adform,node_authbridge,node_authactions,node_adauth toneAmber
class node_mtrxcontainer,node_regform,node_mtrxactions,node_client,node_sdk,node_verification,node_matrixserver toneMint
class node_padcontainer,node_pad,node_roomlist,node_room,node_composer,node_attachment,node_roomservice,node_mediaservice toneRose
class node_redux,node_authreducer,node_mtrxreducer,node_constants,node_clientstore,node_storage,node_adserver toneIndigo
```

## Components

### Application UI

- [Application shell](https://github.com/ars-anosov/matrix-react/blob/main/src/App.jsx): `src/App.jsx`
- [Theme and verification config](https://github.com/ars-anosov/matrix-react/blob/main/src/theme.js): `src/theme.js`

### Authentication

- [Auth forms and toggle](https://github.com/ars-anosov/matrix-react/blob/main/src/components/AuthPad.jsx): `src/components/AuthPad.jsx`
- [AD login form](https://github.com/ars-anosov/matrix-react/blob/main/src/components/AuthAd.jsx): `src/components/AuthAd.jsx`
- [Auth coordination](https://github.com/ars-anosov/matrix-react/blob/main/src/containers/AuthContainer.jsx): `src/containers/AuthContainer.jsx`
- [AD auth actions](https://github.com/ars-anosov/matrix-react/blob/main/src/actions/authControlActions.js): `src/actions/authControlActions.js`
- [AD auth service](https://github.com/ars-anosov/matrix-react/blob/main/src/services/adAuth.js): `src/services/adAuth.js`

### Matrix session

- [Matrix session container](https://github.com/ars-anosov/matrix-react/blob/main/src/containers/MtrxContainer.jsx): `src/containers/MtrxContainer.jsx`
- [Matrix login form](https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxReg.jsx): `src/components/MtrxReg.jsx`
- [Matrix actions](https://github.com/ars-anosov/matrix-react/blob/main/src/actions/mtrxControlActions.js): `src/actions/mtrxControlActions.js`
- [Matrix client service](https://github.com/ars-anosov/matrix-react/blob/main/src/services/matrixClient.js): `src/services/matrixClient.js`
- [SDK loader](https://github.com/ars-anosov/matrix-react/blob/main/src/services/matrixSdk.js): `src/services/matrixSdk.js`
- [Device verification UI](https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxDeviceVerification.jsx): `src/components/MtrxDeviceVerification.jsx`

### Rooms and messaging

- [Messenger container](https://github.com/ars-anosov/matrix-react/blob/main/src/containers/MtrxPadContainer.jsx): `src/containers/MtrxPadContainer.jsx`
- [Messenger panel](https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxPad.jsx): `src/components/MtrxPad.jsx`
- [Room list](https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxRoomList.jsx): `src/components/MtrxRoomList.jsx`
- [Active room](https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxRoom.jsx): `src/components/MtrxRoom.jsx`
- [Message composer](https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxComposer.jsx): `src/components/MtrxComposer.jsx`
- [File attachments](https://github.com/ars-anosov/matrix-react/blob/main/src/components/MtrxAttachment.jsx): `src/components/MtrxAttachment.jsx`
- [Room operations](https://github.com/ars-anosov/matrix-react/blob/main/src/services/matrixRooms.js): `src/services/matrixRooms.js`
- [Media transfer](https://github.com/ars-anosov/matrix-react/blob/main/src/services/matrixMedia.js): `src/services/matrixMedia.js`

### State and persistence

- [Redux state](https://github.com/ars-anosov/matrix-react/blob/main/src/reducers/rootReducer.js): `src/reducers/rootReducer.js`
- [Auth state](https://github.com/ars-anosov/matrix-react/blob/main/src/reducers/authControlRdcr.js): `src/reducers/authControlRdcr.js`
- [Matrix state](https://github.com/ars-anosov/matrix-react/blob/main/src/reducers/mtrxControlRdcr.js): `src/reducers/mtrxControlRdcr.js`
- [Action and UI constants](https://github.com/ars-anosov/matrix-react/blob/main/src/constants/redux.js): `src/constants/redux.js`
- [Client reference](https://github.com/ars-anosov/matrix-react/blob/main/src/services/matrixClientStore.js): `src/services/matrixClientStore.js`
- [Browser session storage](https://github.com/ars-anosov/matrix-react/blob/main/src/constants/storage.js): `src/constants/storage.js`

### Other components

- **User**
- **Matrix homeserver**
- **AD auth endpoint**

## Connections

- User → Application shell: uses (evidence: `src/App.jsx`)
- Application shell → Auth coordination: renders (evidence: `src/App.jsx`)
- Auth coordination → Auth forms and toggle: renders (evidence: `src/containers/AuthContainer.jsx`)
- Auth coordination → AD login form: renders (evidence: `src/containers/AuthContainer.jsx`)
- Auth coordination → AD auth actions: dispatches (evidence: `src/containers/AuthContainer.jsx`)
- AD auth actions → AD auth service: calls (evidence: `src/actions/authControlActions.js`)
- AD login form → AD auth service: submits through (evidence: `src/components/AuthAd.jsx`)
- AD auth service → AD auth endpoint: POSTs credentials (evidence: `src/services/adAuth.js`)
- Auth coordination → Matrix session container: coordinates session (evidence: `src/containers/AuthContainer.jsx`)
- Matrix session container → Matrix login form: renders (evidence: `src/containers/MtrxContainer.jsx`)
- Matrix session container → Messenger container: renders (evidence: `src/containers/MtrxContainer.jsx`)
- Messenger container → Messenger panel: renders (evidence: `src/containers/MtrxPadContainer.jsx`)
- Messenger panel → Room list: renders (evidence: `src/components/MtrxPad.jsx`)
- Messenger panel → Active room: renders (evidence: `src/components/MtrxPad.jsx`)
- Messenger panel → Device verification UI: renders (evidence: `src/components/MtrxPad.jsx`)
- Active room → Message composer: uses (evidence: `README.md`)
- Active room → File attachments: renders (evidence: `README.md`)
- Matrix session container → Matrix actions: dispatches (evidence: `src/containers/MtrxContainer.jsx`)
- Messenger container → Matrix actions: dispatches (evidence: `src/containers/MtrxPadContainer.jsx`)
- Matrix actions → Matrix client service: calls session operations (evidence: `src/actions/mtrxControlActions.js`)
- Matrix actions → Room operations: calls room operations (evidence: `src/actions/mtrxControlActions.js`)
- Matrix client service → SDK loader: loads (evidence: `src/services/matrixClient.js`)
- Matrix client service → Client reference: sets and reads (evidence: `src/services/matrixClient.js`)
- Matrix client service → Room operations: clears room cache (evidence: `src/services/matrixClient.js`)
- Matrix client service → Media transfer: clears media cache (evidence: `src/services/matrixClient.js`)
- Room operations → Client reference: gets client (evidence: `src/services/matrixRooms.js`)
- Room operations → Media transfer: uses media operations (evidence: `src/services/matrixRooms.js`)
- Room operations → Matrix homeserver: room operations
- Media transfer → Matrix homeserver: media transfer
- AD auth service → Browser session storage: persists AD session (evidence: `src/services/adAuth.js`)
- Matrix client service → Browser session storage: persists Matrix session (evidence: `src/services/matrixClient.js`)
- Redux state → Auth state: combines (evidence: `src/reducers/rootReducer.js`)
- Redux state → Matrix state: combines (evidence: `src/reducers/rootReducer.js`)
- AD auth actions → Action and UI constants: dispatches action types (evidence: `src/actions/authControlActions.js`)
- Matrix actions → Action and UI constants: dispatches action types (evidence: `src/actions/mtrxControlActions.js`)
