# element-hq/element-x-android architecture

> Architecture diagram of the GitHub repository element-hq/element-x-android, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/element-hq/element-x-android
- Repository: https://github.com/element-hq/element-x-android

## Overview

Element X Android is a Matrix client for Android, using a Compose UI, Appyx navigation, and the Matrix Rust SDK. Its main user journey is app launch, authentication or session restoration, then navigation into a logged-in session and its rooms and timelines. Distinct supporting capabilities include room creation, media previews, session verification, calling, push notifications, and account security. The tree and excerpts support the named subsystems; unsampled integrations and navigation links are shown only as unverified where needed.

Main entry points: [`appnav/src/main/kotlin/io/element/android/appnav/session/SyncOrchestrator.kt`](https://github.com/element-hq/element-x-android/blob/develop/appnav/src/main/kotlin/io/element/android/appnav/session/SyncOrchestrator.kt) (Session orchestration), [`libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt`](https://github.com/element-hq/element-x-android/blob/develop/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt) (Matrix client API), [`app/src/main/kotlin/io/element/android/x/ElementXApplication.kt`](https://github.com/element-hq/element-x-android/blob/develop/app/src/main/kotlin/io/element/android/x/ElementXApplication.kt) (Android app), [`appnav/src/main/kotlin/io/element/android/appnav/root/RootPresenter.kt`](https://github.com/element-hq/element-x-android/blob/develop/appnav/src/main/kotlin/io/element/android/appnav/root/RootPresenter.kt) (Root navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_appflow["App and navigation"]
  node_app["Android app"]
  node_rootnav["Root navigation<br/>[RootPresenter.kt]"]
  node_flow["App flow nodes<br/>[RootFlowNode.kt]"]
  node_navstate["Navigation state"]
end

subgraph group_matrix["Matrix session"]
  node_auth["Authentication"]
  node_session["Session orchestration"]
  node_sessionstore[("Session storage")]
  node_matrixapi["Matrix client API<br/>[MatrixClient.kt]"]
end

subgraph group_features["User capabilities"]
  node_room["Room navigation<br/>[RoomFlowNode.kt]"]
  node_timeline["Room timeline<br/>[Timeline.kt]"]
  node_create["Room creation"]
  node_media["Media previews"]
  node_verification["Session verification"]
  node_call["Call management"]
end

subgraph group_platform["Platform services"]
  node_push["Push notifications"]
  node_lock["App lock"]
end

node_user(("User"))
node_rustsdk["Matrix Rust SDK"]

node_user -.->|"opens"| node_app
node_app -.->|"starts"| node_rootnav
node_rootnav -.->|"routes"| node_flow
node_flow -.->|"offers login"| node_auth
node_auth -->|"restores session"| node_sessionstore
node_auth -->|"creates client"| node_matrixapi
node_matrixapi -.->|"uses SDK"| node_rustsdk
node_flow -.->|"enters session"| node_session
node_session -.->|"routes rooms"| node_room
node_room -.->|"shows timeline"| node_timeline
node_room -.->|"starts creation"| node_create
node_matrixapi -->|"provides settings"| node_media
node_matrixapi -.->|"provides verification"| node_verification
node_session -.->|"coordinates calls"| node_call
node_session -.->|"registers push"| node_push
node_app -.->|"protects access"| node_lock
node_rootnav -.->|"tracks navigation"| node_navstate

click node_app "https://github.com/element-hq/element-x-android/blob/develop/app/src/main/kotlin/io/element/android/x/ElementXApplication.kt"
click node_rootnav "https://github.com/element-hq/element-x-android/blob/develop/appnav/src/main/kotlin/io/element/android/appnav/root/RootPresenter.kt"
click node_flow "https://github.com/element-hq/element-x-android/blob/develop/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt"
click node_auth "https://github.com/element-hq/element-x-android/blob/develop/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt"
click node_session "https://github.com/element-hq/element-x-android/blob/develop/appnav/src/main/kotlin/io/element/android/appnav/session/SyncOrchestrator.kt"
click node_sessionstore "https://github.com/element-hq/element-x-android/blob/develop/libraries/session-storage/impl/src/main/kotlin/io/element/android/libraries/sessionstorage/impl/DatabaseSessionStore.kt"
click node_matrixapi "https://github.com/element-hq/element-x-android/blob/develop/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt"
click node_room "https://github.com/element-hq/element-x-android/blob/develop/appnav/src/main/kotlin/io/element/android/appnav/room/RoomFlowNode.kt"
click node_timeline "https://github.com/element-hq/element-x-android/blob/develop/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/Timeline.kt"
click node_create "https://github.com/element-hq/element-x-android/blob/develop/features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/CreateRoomFlowNode.kt"
click node_media "https://github.com/element-hq/element-x-android/blob/develop/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/media/RustMediaPreviewService.kt"
click node_verification "https://github.com/element-hq/element-x-android/blob/develop/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/verification/RustSessionVerificationService.kt"
click node_call "https://github.com/element-hq/element-x-android/blob/develop/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/ActiveCallManager.kt"
click node_push "https://github.com/element-hq/element-x-android/blob/develop/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/DefaultPushService.kt"
click node_lock "https://github.com/element-hq/element-x-android/blob/develop/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/DefaultLockScreenService.kt"
click node_navstate "https://github.com/element-hq/element-x-android/blob/develop/services/appnavstate/impl/src/main/kotlin/io/element/android/services/appnavstate/impl/DefaultAppNavigationStateService.kt"

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_rootnav,node_flow,node_navstate,node_user toneBlue
class node_auth,node_session,node_sessionstore,node_matrixapi toneAmber
class node_room,node_timeline,node_create,node_media,node_verification,node_call toneMint
class node_push,node_lock toneRose
class node_rustsdk toneIndigo
```

## Components

### App and navigation

- [Android app](https://github.com/element-hq/element-x-android/blob/develop/app/src/main/kotlin/io/element/android/x/ElementXApplication.kt): `app/src/main/kotlin/io/element/android/x/ElementXApplication.kt`
- [Root navigation](https://github.com/element-hq/element-x-android/blob/develop/appnav/src/main/kotlin/io/element/android/appnav/root/RootPresenter.kt): `appnav/src/main/kotlin/io/element/android/appnav/root/RootPresenter.kt`
- [App flow nodes](https://github.com/element-hq/element-x-android/blob/develop/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt): `appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt`
- [Navigation state](https://github.com/element-hq/element-x-android/blob/develop/services/appnavstate/impl/src/main/kotlin/io/element/android/services/appnavstate/impl/DefaultAppNavigationStateService.kt): `services/appnavstate/impl/src/main/kotlin/io/element/android/services/appnavstate/impl/DefaultAppNavigationStateService.kt`

### Matrix session

- [Authentication](https://github.com/element-hq/element-x-android/blob/develop/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt): `libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt`
- [Session orchestration](https://github.com/element-hq/element-x-android/blob/develop/appnav/src/main/kotlin/io/element/android/appnav/session/SyncOrchestrator.kt): `appnav/src/main/kotlin/io/element/android/appnav/session/SyncOrchestrator.kt`
- [Session storage](https://github.com/element-hq/element-x-android/blob/develop/libraries/session-storage/impl/src/main/kotlin/io/element/android/libraries/sessionstorage/impl/DatabaseSessionStore.kt): `libraries/session-storage/impl/src/main/kotlin/io/element/android/libraries/sessionstorage/impl/DatabaseSessionStore.kt`
- [Matrix client API](https://github.com/element-hq/element-x-android/blob/develop/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt): `libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/MatrixClient.kt`

### User capabilities

- [Room navigation](https://github.com/element-hq/element-x-android/blob/develop/appnav/src/main/kotlin/io/element/android/appnav/room/RoomFlowNode.kt): `appnav/src/main/kotlin/io/element/android/appnav/room/RoomFlowNode.kt`
- [Room timeline](https://github.com/element-hq/element-x-android/blob/develop/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/Timeline.kt): `libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/timeline/Timeline.kt`
- [Room creation](https://github.com/element-hq/element-x-android/blob/develop/features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/CreateRoomFlowNode.kt): `features/createroom/impl/src/main/kotlin/io/element/android/features/createroom/impl/CreateRoomFlowNode.kt`
- [Media previews](https://github.com/element-hq/element-x-android/blob/develop/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/media/RustMediaPreviewService.kt): `libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/media/RustMediaPreviewService.kt`
- [Session verification](https://github.com/element-hq/element-x-android/blob/develop/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/verification/RustSessionVerificationService.kt): `libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/verification/RustSessionVerificationService.kt`
- [Call management](https://github.com/element-hq/element-x-android/blob/develop/features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/ActiveCallManager.kt): `features/call/impl/src/main/kotlin/io/element/android/features/call/impl/utils/ActiveCallManager.kt`

### Platform services

- [Push notifications](https://github.com/element-hq/element-x-android/blob/develop/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/DefaultPushService.kt): `libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/DefaultPushService.kt`
- [App lock](https://github.com/element-hq/element-x-android/blob/develop/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/DefaultLockScreenService.kt): `features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/DefaultLockScreenService.kt`

### Other components

- **User**
- **Matrix Rust SDK**

## Connections

- User → Android app: opens
- Android app → Root navigation: starts
- Root navigation → App flow nodes: routes
- App flow nodes → Authentication: offers login
- Authentication → Session storage: restores session (evidence: `libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt`)
- Authentication → Matrix client API: creates client (evidence: `libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/auth/RustMatrixAuthenticationService.kt`)
- Matrix client API → Matrix Rust SDK: uses SDK (evidence: `README.md`)
- App flow nodes → Session orchestration: enters session
- Session orchestration → Room navigation: routes rooms
- Room navigation → Room timeline: shows timeline
- Room navigation → Room creation: starts creation
- Matrix client API → Media previews: provides settings (evidence: `libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/media/RustMediaPreviewService.kt`)
- Matrix client API → Session verification: provides verification
- Session orchestration → Call management: coordinates calls
- Session orchestration → Push notifications: registers push
- Android app → App lock: protects access
- Root navigation → Navigation state: tracks navigation
