# gwill1337/severus architecture

> Architecture diagram of the GitHub repository gwill1337/severus, 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/gwill1337/severus
- Repository: https://github.com/gwill1337/severus

## Overview

Severus is a self-hosted, real-time P2P messenger with Direct TCP/LAN and Iroh QUIC connection modes, TLS, Noise E2EE, TOFU trust, and room chat. The user chooses Host or Client in the React app; Tauri commands start a host or connect a client, after which packets carry registration, peer messages, and room operations. Rust networking handles transport and encryption, while shared packet/state types and room management support chat. The README documents both transports and security capabilities; links reflect only shown calls or documented behavior, since several source excerpts are partial.

Main entry points: [`src-tauri/src/lib.rs`](https://github.com/gwill1337/severus/blob/main/src-tauri/src/lib.rs) (Command runtime), [`src-tauri/src/net/direct.rs`](https://github.com/gwill1337/severus/blob/main/src-tauri/src/net/direct.rs) (Direct transport), [`src-tauri/src/net/quic.rs`](https://github.com/gwill1337/severus/blob/main/src-tauri/src/net/quic.rs) (Iroh QUIC transport), [`src/App.tsx`](https://github.com/gwill1337/severus/blob/main/src/App.tsx) (Chat interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_app["Chat interface<br/>[App.tsx]"]
  node_entry["React entry<br/>[main.tsx]"]
end

subgraph group_runtime["Tauri runtime"]
  node_runtime["Command runtime<br/>[lib.rs]"]
end

subgraph group_transport["Networking"]
  node_direct["Direct transport<br/>[direct.rs]"]
  node_quic["Iroh QUIC transport<br/>[quic.rs]"]
end

subgraph group_security["Security"]
  node_security["TLS and Noise<br/>[security.rs]"]
end

subgraph group_chat["Chat and telemetry"]
  node_packets["Packet and state types<br/>[mod.rs]"]
  node_rooms["Room operations<br/>[room.rs]"]
  node_metrics["Network metrics<br/>[logger.rs]"]
end

node_user(("Messenger user"))
node_peer(("Remote peers"))

node_user -->|"uses"| node_app
node_entry -->|"renders"| node_app
node_app -->|"invokes commands"| node_runtime
node_runtime -->|"registers commands"| node_direct
node_runtime -->|"dispatches connections"| node_quic
node_runtime -->|"registers commands"| node_rooms
node_runtime -->|"registers trust command"| node_security
node_runtime -->|"serves host connections"| node_peer
node_app -->|"connects to"| node_peer
node_direct -->|"uses TLS and Noise"| node_security
node_quic -->|"uses TLS and Noise"| node_security
node_direct -->|"handles packets"| node_packets
node_quic -->|"handles packets"| node_packets
node_direct -->|"handles room operations"| node_rooms
node_quic -->|"handles room operations"| node_rooms
node_app -->|"sends room commands"| node_rooms
node_direct -->|"records traffic"| node_metrics
node_quic -->|"records traffic"| node_metrics
node_runtime -->|"starts reporting"| node_metrics

click node_app "https://github.com/gwill1337/severus/blob/main/src/App.tsx"
click node_entry "https://github.com/gwill1337/severus/blob/main/src/main.tsx"
click node_runtime "https://github.com/gwill1337/severus/blob/main/src-tauri/src/lib.rs"
click node_direct "https://github.com/gwill1337/severus/blob/main/src-tauri/src/net/direct.rs"
click node_quic "https://github.com/gwill1337/severus/blob/main/src-tauri/src/net/quic.rs"
click node_packets "https://github.com/gwill1337/severus/blob/main/src-tauri/src/net/mod.rs"
click node_rooms "https://github.com/gwill1337/severus/blob/main/src-tauri/src/net/room.rs"
click node_security "https://github.com/gwill1337/severus/blob/main/src-tauri/src/security.rs"
click node_metrics "https://github.com/gwill1337/severus/blob/main/src-tauri/src/logger.rs"

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_entry,node_user toneBlue
class node_runtime toneAmber
class node_direct,node_quic toneMint
class node_security toneRose
class node_packets,node_rooms,node_metrics,node_peer toneIndigo
```

## Components

### Desktop interface

- [Chat interface](https://github.com/gwill1337/severus/blob/main/src/App.tsx): `src/App.tsx`
- [React entry](https://github.com/gwill1337/severus/blob/main/src/main.tsx): `src/main.tsx`

### Tauri runtime

- [Command runtime](https://github.com/gwill1337/severus/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`

### Networking

- [Direct transport](https://github.com/gwill1337/severus/blob/main/src-tauri/src/net/direct.rs): `src-tauri/src/net/direct.rs`
- [Iroh QUIC transport](https://github.com/gwill1337/severus/blob/main/src-tauri/src/net/quic.rs): `src-tauri/src/net/quic.rs`

### Security

- [TLS and Noise](https://github.com/gwill1337/severus/blob/main/src-tauri/src/security.rs): `src-tauri/src/security.rs`

### Chat and telemetry

- [Packet and state types](https://github.com/gwill1337/severus/blob/main/src-tauri/src/net/mod.rs): `src-tauri/src/net/mod.rs`
- [Room operations](https://github.com/gwill1337/severus/blob/main/src-tauri/src/net/room.rs): `src-tauri/src/net/room.rs`
- [Network metrics](https://github.com/gwill1337/severus/blob/main/src-tauri/src/logger.rs): `src-tauri/src/logger.rs`

### Other components

- **Messenger user**
- **Remote peers**

## Connections

- Messenger user → Chat interface: uses (evidence: `README.md`)
- React entry → Chat interface: renders (evidence: `src/main.tsx`)
- Chat interface → Command runtime: invokes commands (evidence: `src/App.tsx`)
- Command runtime → Direct transport: registers commands (evidence: `src-tauri/src/lib.rs`)
- Command runtime → Iroh QUIC transport: dispatches connections (evidence: `src-tauri/src/lib.rs`)
- Command runtime → Room operations: registers commands (evidence: `src-tauri/src/lib.rs`)
- Command runtime → TLS and Noise: registers trust command (evidence: `src-tauri/src/lib.rs`)
- Command runtime → Remote peers: serves host connections (evidence: `src-tauri/src/lib.rs`)
- Chat interface → Remote peers: connects to (evidence: `README.md`)
- Direct transport → TLS and Noise: uses TLS and Noise (evidence: `src-tauri/src/net/direct.rs`)
- Iroh QUIC transport → TLS and Noise: uses TLS and Noise (evidence: `src-tauri/src/net/quic.rs`)
- Direct transport → Packet and state types: handles packets (evidence: `src-tauri/src/net/direct.rs`)
- Iroh QUIC transport → Packet and state types: handles packets (evidence: `src-tauri/src/net/quic.rs`)
- Direct transport → Room operations: handles room operations (evidence: `src-tauri/src/net/direct.rs`)
- Iroh QUIC transport → Room operations: handles room operations (evidence: `src-tauri/src/net/quic.rs`)
- Chat interface → Room operations: sends room commands (evidence: `src/App.tsx`)
- Direct transport → Network metrics: records traffic (evidence: `src-tauri/src/net/direct.rs`)
- Iroh QUIC transport → Network metrics: records traffic (evidence: `src-tauri/src/net/quic.rs`)
- Command runtime → Network metrics: starts reporting (evidence: `src-tauri/src/lib.rs`)
