# noormohammadiazad/textor architecture

> Architecture diagram of the GitHub repository noormohammadiazad/textor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/noormohammadiazad/textor
- Repository: https://github.com/noormohammadiazad/textor

## Overview

Textor is a browser-based, end-to-end encrypted messenger with no operated backend. The main workflow runs from the user interface through app state and the messenger engine: messages are sealed, sent through public relays (and optionally direct WebRTC), then persisted in the locally encrypted vault. The graph also preserves identity and restore, attachments, calls, groups, and location as distinct product capabilities. Edges follow the README’s architecture diagrams and workflow, or visible source references; unsampled feature wiring is omitted or marked unverified.

Main entry points: [`src/core/engine/messenger.ts`](https://github.com/noormohammadiazad/textor/blob/main/src/core/engine/messenger.ts) (Messenger engine), [`src/app/store.ts`](https://github.com/noormohammadiazad/textor/blob/main/src/app/store.ts) (App store), [`src/app/App.tsx`](https://github.com/noormohammadiazad/textor/blob/main/src/app/App.tsx) (App shell), [`src/ui/screens/ChatView.tsx`](https://github.com/noormohammadiazad/textor/blob/main/src/ui/screens/ChatView.tsx) (Chat screens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Browser app"]
  node_app_shell["App shell<br/>[App.tsx]"]
  node_screens["Chat screens<br/>[ChatView.tsx]"]
  node_app_state["App store<br/>[store.ts]"]
end

subgraph group_messaging["Messaging and privacy"]
  node_messenger["Messenger engine<br/>[messenger.ts]"]
  node_giftwrap["Gift wrapping<br/>[giftwrap.ts]"]
  node_protocol["Wire protocol<br/>[protocol.ts]"]
  node_transport["Nostr transport<br/>[nostrTransport.ts]"]
  node_relay_pool["Relay pool<br/>[relayPool.ts]"]
  node_direct["Direct WebRTC<br/>[directManager.ts]"]
end

subgraph group_identity["Identity and storage"]
  node_identity_keys["Identity keys<br/>[keys.ts]"]
  node_vault_repo["Vault repository<br/>[repo.ts]"]
  node_vault["Encrypted vault<br/>[vault.ts]"]
  node_local_db[("IndexedDB<br/>[db.ts]")]
  node_backup["Backup and restore<br/>[exportImport.ts]"]
end

subgraph group_features["Communication features"]
  node_attachments["Media transfer<br/>[blobTransfer.ts]"]
  node_calls["Voice and video calls<br/>[callManager.ts]"]
  node_groups["Secure groups<br/>[marmot.ts]"]
  node_location["Location sharing<br/>[sharer.ts]"]
end

node_user(("User"))
node_relays[("Public relays")]
node_peer(("Contact device"))

node_user -->|"uses"| node_app_shell
node_app_shell -->|"shows"| node_screens
node_screens -->|"reads and updates"| node_app_state
node_app_state -->|"commands"| node_messenger
node_messenger -->|"persists through"| node_vault_repo
node_vault_repo -->|"uses"| node_vault
node_vault -->|"stores sealed data"| node_local_db
node_messenger -->|"wraps messages"| node_giftwrap
node_messenger -->|"sends and receives"| node_transport
node_transport -->|"uses"| node_relay_pool
node_relay_pool -->|"connects to"| node_relays
node_messenger -.->|"dispatches directly"| node_direct
node_direct -->|"opens WebRTC"| node_peer
node_messenger -->|"handles frames"| node_protocol
node_app_state -->|"uses identity"| node_identity_keys
node_user -->|"creates identity"| node_identity_keys
node_user -->|"restores with words"| node_backup
node_messenger -->|"transfers media"| node_attachments
node_app_state -->|"loads call manager"| node_calls
node_messenger -.->|"supports secure groups"| node_groups
node_messenger -.->|"supports location sharing"| node_location

click node_app_shell "https://github.com/noormohammadiazad/textor/blob/main/src/app/App.tsx"
click node_screens "https://github.com/noormohammadiazad/textor/blob/main/src/ui/screens/ChatView.tsx"
click node_app_state "https://github.com/noormohammadiazad/textor/blob/main/src/app/store.ts"
click node_messenger "https://github.com/noormohammadiazad/textor/blob/main/src/core/engine/messenger.ts"
click node_giftwrap "https://github.com/noormohammadiazad/textor/blob/main/src/core/crypto/giftwrap.ts"
click node_protocol "https://github.com/noormohammadiazad/textor/blob/main/src/core/models/protocol.ts"
click node_transport "https://github.com/noormohammadiazad/textor/blob/main/src/core/transport/nostrTransport.ts"
click node_relay_pool "https://github.com/noormohammadiazad/textor/blob/main/src/core/transport/relayPool.ts"
click node_direct "https://github.com/noormohammadiazad/textor/blob/main/src/core/transport/webrtc/directManager.ts"
click node_identity_keys "https://github.com/noormohammadiazad/textor/blob/main/src/core/identity/keys.ts"
click node_vault_repo "https://github.com/noormohammadiazad/textor/blob/main/src/core/vault/repo.ts"
click node_vault "https://github.com/noormohammadiazad/textor/blob/main/src/core/vault/vault.ts"
click node_local_db "https://github.com/noormohammadiazad/textor/blob/main/src/core/vault/db.ts"
click node_backup "https://github.com/noormohammadiazad/textor/blob/main/src/core/vault/exportImport.ts"
click node_attachments "https://github.com/noormohammadiazad/textor/blob/main/src/core/engine/blobTransfer.ts"
click node_calls "https://github.com/noormohammadiazad/textor/blob/main/src/core/calls/callManager.ts"
click node_groups "https://github.com/noormohammadiazad/textor/blob/main/src/core/mls/marmot.ts"
click node_location "https://github.com/noormohammadiazad/textor/blob/main/src/core/location/sharer.ts"

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_shell,node_screens,node_app_state,node_user toneBlue
class node_messenger,node_giftwrap,node_protocol,node_transport,node_relay_pool,node_direct,node_relays toneAmber
class node_identity_keys,node_vault_repo,node_vault,node_local_db,node_backup toneMint
class node_attachments,node_calls,node_groups,node_location toneRose
class node_peer toneIndigo
```

## Components

### Browser app

- [App shell](https://github.com/noormohammadiazad/textor/blob/main/src/app/App.tsx): `src/app/App.tsx`
- [Chat screens](https://github.com/noormohammadiazad/textor/blob/main/src/ui/screens/ChatView.tsx): `src/ui/screens/ChatView.tsx`
- [App store](https://github.com/noormohammadiazad/textor/blob/main/src/app/store.ts): `src/app/store.ts`

### Messaging and privacy

- [Messenger engine](https://github.com/noormohammadiazad/textor/blob/main/src/core/engine/messenger.ts): `src/core/engine/messenger.ts`
- [Gift wrapping](https://github.com/noormohammadiazad/textor/blob/main/src/core/crypto/giftwrap.ts): `src/core/crypto/giftwrap.ts`
- [Wire protocol](https://github.com/noormohammadiazad/textor/blob/main/src/core/models/protocol.ts): `src/core/models/protocol.ts`
- [Nostr transport](https://github.com/noormohammadiazad/textor/blob/main/src/core/transport/nostrTransport.ts): `src/core/transport/nostrTransport.ts`
- [Relay pool](https://github.com/noormohammadiazad/textor/blob/main/src/core/transport/relayPool.ts): `src/core/transport/relayPool.ts`
- [Direct WebRTC](https://github.com/noormohammadiazad/textor/blob/main/src/core/transport/webrtc/directManager.ts): `src/core/transport/webrtc/directManager.ts`

### Identity and storage

- [Identity keys](https://github.com/noormohammadiazad/textor/blob/main/src/core/identity/keys.ts): `src/core/identity/keys.ts`
- [Vault repository](https://github.com/noormohammadiazad/textor/blob/main/src/core/vault/repo.ts): `src/core/vault/repo.ts`
- [Encrypted vault](https://github.com/noormohammadiazad/textor/blob/main/src/core/vault/vault.ts): `src/core/vault/vault.ts`
- [IndexedDB](https://github.com/noormohammadiazad/textor/blob/main/src/core/vault/db.ts): `src/core/vault/db.ts`
- [Backup and restore](https://github.com/noormohammadiazad/textor/blob/main/src/core/vault/exportImport.ts): `src/core/vault/exportImport.ts`

### Communication features

- [Media transfer](https://github.com/noormohammadiazad/textor/blob/main/src/core/engine/blobTransfer.ts): `src/core/engine/blobTransfer.ts`
- [Voice and video calls](https://github.com/noormohammadiazad/textor/blob/main/src/core/calls/callManager.ts): `src/core/calls/callManager.ts`
- [Secure groups](https://github.com/noormohammadiazad/textor/blob/main/src/core/mls/marmot.ts): `src/core/mls/marmot.ts`
- [Location sharing](https://github.com/noormohammadiazad/textor/blob/main/src/core/location/sharer.ts): `src/core/location/sharer.ts`

### Other components

- **User**
- **Public relays**
- **Contact device**

## Connections

- User → App shell: uses (evidence: `README.md`)
- App shell → Chat screens: shows (evidence: `src/app/App.tsx`)
- Chat screens → App store: reads and updates (evidence: `src/ui/screens/ChatView.tsx`)
- App store → Messenger engine: commands (evidence: `src/app/store.ts`)
- Messenger engine → Vault repository: persists through (evidence: `README.md`)
- Vault repository → Encrypted vault: uses (evidence: `README.md`)
- Encrypted vault → IndexedDB: stores sealed data (evidence: `README.md`)
- Messenger engine → Gift wrapping: wraps messages (evidence: `src/core/engine/messenger.ts`)
- Messenger engine → Nostr transport: sends and receives (evidence: `README.md`)
- Nostr transport → Relay pool: uses (evidence: `README.md`)
- Relay pool → Public relays: connects to (evidence: `README.md`)
- Messenger engine → Direct WebRTC: dispatches directly (evidence: `src/core/engine/messenger.ts`)
- Direct WebRTC → Contact device: opens WebRTC (evidence: `README.md`)
- Messenger engine → Wire protocol: handles frames (evidence: `src/core/engine/messenger.ts`)
- App store → Identity keys: uses identity (evidence: `src/app/store.ts`)
- User → Identity keys: creates identity (evidence: `README.md`)
- User → Backup and restore: restores with words (evidence: `README.md`)
- Messenger engine → Media transfer: transfers media (evidence: `src/core/engine/messenger.ts`)
- App store → Voice and video calls: loads call manager (evidence: `src/app/store.ts`)
- Messenger engine → Secure groups: supports secure groups
- Messenger engine → Location sharing: supports location sharing
