# aysar94-prog/lan-messenger architecture

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

- Interactive diagram: https://gitdiagram.com/aysar94-prog/lan-messenger
- Repository: https://github.com/aysar94-prog/lan-messenger

## Overview

LAN Messenger is a private, account-free LAN chat application with separate Android and Windows implementations. The main workflow is composing a conversation in the client UI, sending it through the peer engine to verified LAN contacts, and syncing group membership and message state. Users can also exchange attachments and voice messages, or place calls. The graph preserves these major capabilities across the platform-specific paths. Some runtime wiring is unsampled, so edges are limited to documented behavior and source-index references.

Main entry points: [`android/src/net/lanmsg/chat/PeerEngine.java`](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/PeerEngine.java) (Android peer engine), [`android/src/net/lanmsg/chat/MainActivity.java`](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/MainActivity.java) (Android app UI), [`windows/ChatWindowMessages.cs`](https://github.com/aysar94-prog/lan-messenger/blob/main/windows/ChatWindowMessages.cs) (Windows chat UI), [`windows/PeerEngine.cs`](https://github.com/aysar94-prog/lan-messenger/blob/main/windows/PeerEngine.cs) (Windows peer engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client interfaces"]
  node_android_ui["Android app UI<br/>[MainActivity.java]"]
  node_windows_ui["Windows chat UI"]
  node_android_service["Android service"]
end

subgraph group_messaging["Messaging and identity"]
  node_android_peer["Android peer engine<br/>[PeerEngine.java]"]
  node_windows_peer["Windows peer engine<br/>[PeerEngine.cs]"]
  node_android_identity["Android identity"]
  node_windows_identity["Windows identity<br/>[SecureIdentity.cs]"]
  node_group_sync["Group synchronization<br/>[GroupSync.java]"]
  node_conversation_state["Conversation state<br/>[Conversations.cs]"]
end

subgraph group_media["Attachments and voice"]
  node_attachment_flow["Attachment workflow"]
  node_attachment_store[("Attachment storage")]
  node_file_transfer["File transfers"]
  node_download_destination["Download destination"]
  node_android_voice["Android voice messages<br/>[VoiceMessages.java]"]
  node_windows_voice["Windows voice messages<br/>[VoiceMessages.cs]"]
end

subgraph group_calls["Calling"]
  node_android_call["Android call controller"]
  node_android_call_ui["Android call UI<br/>[CallUi.java]"]
  node_android_call_media["Android WebRTC media"]
  node_windows_call["Windows call controller<br/>[CallController.cs]"]
  node_windows_call_media["Windows WebRTC media<br/>[WebRtcCallMedia.cs]"]
end

node_user(("Messenger user"))
node_lan_peers(("Verified LAN peers"))

node_user -->|"uses"| node_android_ui
node_user -->|"uses"| node_windows_ui
node_android_ui -->|"accesses"| node_android_peer
node_android_ui -->|"binds service"| node_android_service
node_android_service -->|"creates"| node_android_peer
node_android_peer -->|"exchanges messages"| node_lan_peers
node_windows_ui -->|"accesses"| node_windows_peer
node_windows_peer -->|"exchanges messages"| node_lan_peers
node_android_peer -->|"uses identity"| node_android_identity
node_windows_peer -->|"uses identity"| node_windows_identity
node_android_peer -->|"delegates sync"| node_group_sync
node_windows_ui -->|"manages conversations"| node_conversation_state
node_android_ui -->|"starts attachments"| node_attachment_flow
node_attachment_flow -->|"uses peer engine"| node_android_peer
node_android_peer -->|"uses storage"| node_attachment_store
node_android_peer -->|"delegates transfer"| node_file_transfer
node_file_transfer -->|"selects destination"| node_download_destination
node_android_ui -->|"records and plays"| node_android_voice
node_windows_ui -.->|"offers voice messages"| node_windows_voice
node_android_service -->|"owns controller"| node_android_call
node_android_ui -->|"presents calls"| node_android_call_ui
node_android_call_ui -->|"forwards actions"| node_android_call
node_android_call -->|"uses peer state"| node_android_peer
node_android_call -->|"drives media"| node_android_call_media
node_windows_call -->|"uses peer state"| node_windows_peer
node_windows_call -->|"drives media"| node_windows_call_media
node_windows_ui -.->|"hosts calls"| node_windows_call

click node_android_ui "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/MainActivity.java"
click node_windows_ui "https://github.com/aysar94-prog/lan-messenger/blob/main/windows/ChatWindowMessages.cs"
click node_android_service "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/MessengerService.java"
click node_android_peer "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/PeerEngine.java"
click node_windows_peer "https://github.com/aysar94-prog/lan-messenger/blob/main/windows/PeerEngine.cs"
click node_android_identity "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/SecureIdentity.java"
click node_windows_identity "https://github.com/aysar94-prog/lan-messenger/blob/main/windows/SecureIdentity.cs"
click node_group_sync "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/GroupSync.java"
click node_conversation_state "https://github.com/aysar94-prog/lan-messenger/blob/main/windows/Conversations.cs"
click node_attachment_flow "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/AttachmentFlow.java"
click node_attachment_store "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/AttachmentStore.java"
click node_file_transfer "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/DirectFileTransfer.java"
click node_download_destination "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/DownloadDestination.java"
click node_android_voice "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/VoiceMessages.java"
click node_windows_voice "https://github.com/aysar94-prog/lan-messenger/blob/main/windows/VoiceMessages.cs"
click node_android_call "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/CallController.java"
click node_android_call_ui "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/CallUi.java"
click node_android_call_media "https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/WebRtcCallMedia.java"
click node_windows_call "https://github.com/aysar94-prog/lan-messenger/blob/main/windows/CallController.cs"
click node_windows_call_media "https://github.com/aysar94-prog/lan-messenger/blob/main/windows/WebRtcCallMedia.cs"

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_android_ui,node_windows_ui,node_android_service,node_user toneBlue
class node_android_peer,node_windows_peer,node_android_identity,node_windows_identity,node_group_sync,node_conversation_state toneAmber
class node_attachment_flow,node_attachment_store,node_file_transfer,node_download_destination,node_android_voice,node_windows_voice toneMint
class node_android_call,node_android_call_ui,node_android_call_media,node_windows_call,node_windows_call_media toneRose
class node_lan_peers toneIndigo
```

## Components

### Client interfaces

- [Android app UI](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/MainActivity.java): `android/src/net/lanmsg/chat/MainActivity.java`
- [Windows chat UI](https://github.com/aysar94-prog/lan-messenger/blob/main/windows/ChatWindowMessages.cs): `windows/ChatWindowMessages.cs`
- [Android service](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/MessengerService.java): `android/src/net/lanmsg/chat/MessengerService.java`

### Messaging and identity

- [Android peer engine](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/PeerEngine.java): `android/src/net/lanmsg/chat/PeerEngine.java`
- [Windows peer engine](https://github.com/aysar94-prog/lan-messenger/blob/main/windows/PeerEngine.cs): `windows/PeerEngine.cs`
- [Android identity](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/SecureIdentity.java): `android/src/net/lanmsg/chat/SecureIdentity.java`
- [Windows identity](https://github.com/aysar94-prog/lan-messenger/blob/main/windows/SecureIdentity.cs): `windows/SecureIdentity.cs`
- [Group synchronization](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/GroupSync.java): `android/src/net/lanmsg/chat/GroupSync.java`
- [Conversation state](https://github.com/aysar94-prog/lan-messenger/blob/main/windows/Conversations.cs): `windows/Conversations.cs`

### Attachments and voice

- [Attachment workflow](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/AttachmentFlow.java): `android/src/net/lanmsg/chat/AttachmentFlow.java`
- [Attachment storage](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/AttachmentStore.java): `android/src/net/lanmsg/chat/AttachmentStore.java`
- [File transfers](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/DirectFileTransfer.java): `android/src/net/lanmsg/chat/DirectFileTransfer.java`
- [Download destination](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/DownloadDestination.java): `android/src/net/lanmsg/chat/DownloadDestination.java`
- [Android voice messages](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/VoiceMessages.java): `android/src/net/lanmsg/chat/VoiceMessages.java`
- [Windows voice messages](https://github.com/aysar94-prog/lan-messenger/blob/main/windows/VoiceMessages.cs): `windows/VoiceMessages.cs`

### Calling

- [Android call controller](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/CallController.java): `android/src/net/lanmsg/chat/CallController.java`
- [Android call UI](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/CallUi.java): `android/src/net/lanmsg/chat/CallUi.java`
- [Android WebRTC media](https://github.com/aysar94-prog/lan-messenger/blob/main/android/src/net/lanmsg/chat/WebRtcCallMedia.java): `android/src/net/lanmsg/chat/WebRtcCallMedia.java`
- [Windows call controller](https://github.com/aysar94-prog/lan-messenger/blob/main/windows/CallController.cs): `windows/CallController.cs`
- [Windows WebRTC media](https://github.com/aysar94-prog/lan-messenger/blob/main/windows/WebRtcCallMedia.cs): `windows/WebRtcCallMedia.cs`

### Other components

- **Messenger user**
- **Verified LAN peers**

## Connections

- Messenger user → Android app UI: uses (evidence: `README.md`)
- Messenger user → Windows chat UI: uses (evidence: `README.md`)
- Android app UI → Android peer engine: accesses (evidence: `android/src/net/lanmsg/chat/MainActivity.java`)
- Android app UI → Android service: binds service (evidence: `android/src/net/lanmsg/chat/MainActivity.java`)
- Android service → Android peer engine: creates (evidence: `android/src/net/lanmsg/chat/MessengerService.java`)
- Android peer engine → Verified LAN peers: exchanges messages (evidence: `README.md`)
- Windows chat UI → Windows peer engine: accesses
- Windows peer engine → Verified LAN peers: exchanges messages (evidence: `README.md`)
- Android peer engine → Android identity: uses identity (evidence: `android/src/net/lanmsg/chat/PeerEngine.java`)
- Windows peer engine → Windows identity: uses identity (evidence: `windows/PeerEngine.cs`)
- Android peer engine → Group synchronization: delegates sync (evidence: `android/src/net/lanmsg/chat/PeerEngine.java`)
- Windows chat UI → Conversation state: manages conversations (evidence: `windows/Conversations.cs`)
- Android app UI → Attachment workflow: starts attachments (evidence: `android/src/net/lanmsg/chat/MainActivity.java`)
- Attachment workflow → Android peer engine: uses peer engine (evidence: `android/src/net/lanmsg/chat/AttachmentFlow.java`)
- Android peer engine → Attachment storage: uses storage (evidence: `android/src/net/lanmsg/chat/PeerEngine.java`)
- Android peer engine → File transfers: delegates transfer (evidence: `android/src/net/lanmsg/chat/PeerEngine.java`)
- File transfers → Download destination: selects destination (evidence: `android/src/net/lanmsg/chat/DirectFileTransfer.java`)
- Android app UI → Android voice messages: records and plays (evidence: `android/src/net/lanmsg/chat/MainActivity.java`)
- Windows chat UI → Windows voice messages: offers voice messages (evidence: `README.md`)
- Android service → Android call controller: owns controller (evidence: `android/src/net/lanmsg/chat/MessengerService.java`)
- Android app UI → Android call UI: presents calls (evidence: `android/src/net/lanmsg/chat/MainActivity.java`)
- Android call UI → Android call controller: forwards actions (evidence: `android/src/net/lanmsg/chat/CallUi.java`)
- Android call controller → Android peer engine: uses peer state (evidence: `android/src/net/lanmsg/chat/CallController.java`)
- Android call controller → Android WebRTC media: drives media (evidence: `android/src/net/lanmsg/chat/CallController.java`)
- Windows call controller → Windows peer engine: uses peer state (evidence: `windows/CallController.cs`)
- Windows call controller → Windows WebRTC media: drives media (evidence: `windows/CallController.cs`)
- Windows chat UI → Windows call controller: hosts calls
