# livealieen/d-mesh architecture

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

## Overview

D-Mesh is a decentralized group-messaging client with signed membership events, peer discovery and transport, history reconciliation, and an optional RAID-style group file store. The main client assembles internal services and exposes them through a GUI or headless command channel; users send messages or membership actions, which the message engine validates and floods to peers. Group state, backfill, and netdisk are distinct product stages. The evidence includes integration comments and sampled calls, but the README is empty and several subsystem implementations were not sampled, so uncertain links are omitted or marked unverified.

Main entry points: [`cmd/dmesh/app.go`](https://github.com/livealieen/d-mesh/blob/master/cmd/dmesh/app.go) (Node Host), [`cmd/dmesh/main.go`](https://github.com/livealieen/d-mesh/blob/master/cmd/dmesh/main.go) (Client Entry), [`internal/transport/handshake.go`](https://github.com/livealieen/d-mesh/blob/master/internal/transport/handshake.go) (Secure Transport), [`internal/netdisk/manager.go`](https://github.com/livealieen/d-mesh/blob/master/internal/netdisk/manager.go) (Group Netdisk)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_client_entry["Client Entry<br/>[main.go]"]
  node_host["Node Host<br/>[app.go]"]
  node_gui["Desktop UI<br/>[app.go]"]
  node_tool["Group Tool<br/>[main.go]"]
end

subgraph group_identity_group["Identity and Groups"]
  node_identity["Identity and Seeds<br/>[seed.go]"]
  node_roster["Membership State<br/>[events.go]"]
end

subgraph group_network["Peer Networking"]
  node_discovery["Peer Discovery<br/>[manager.go]"]
  node_neighbors["Neighbor Manager<br/>[neighbor.go]"]
  node_transport["Secure Transport<br/>[handshake.go]"]
end

subgraph group_messaging["Messaging"]
  node_engine["Message Engine<br/>[engine.go]"]
  node_backfill["History Backfill<br/>[backfill.go]"]
end

subgraph group_data["Persistence and Files"]
  node_store[("Message Store<br/>[messages.go]")]
  node_netdisk["Group Netdisk<br/>[manager.go]"]
  node_block_store[("Block Store<br/>[store.go]")]
end

node_user(("User"))
node_peer(("Group Peers"))

node_user -->|"uses"| node_gui
node_gui -->|"calls actions"| node_host
node_client_entry -->|"assembles"| node_host
node_client_entry -->|"loads and verifies"| node_identity
node_client_entry -->|"restores state"| node_roster
node_tool -->|"creates and verifies"| node_identity
node_host -->|"publishes messages"| node_engine
node_host -->|"runs audit"| node_backfill
node_engine -->|"sends to peers"| node_transport
node_transport -->|"secures sessions"| node_peer
node_host -->|"exposes file actions"| node_netdisk
node_netdisk -->|"stores local blocks"| node_block_store
node_netdisk -->|"pushes and fetches blocks"| node_transport
node_host -.->|"persists messages"| node_store
node_client_entry -.->|"configures discovery"| node_discovery
node_neighbors -.->|"uses sessions"| node_transport
node_backfill -.->|"reconciles history"| node_store

click node_client_entry "https://github.com/livealieen/d-mesh/blob/master/cmd/dmesh/main.go"
click node_host "https://github.com/livealieen/d-mesh/blob/master/cmd/dmesh/app.go"
click node_gui "https://github.com/livealieen/d-mesh/blob/master/internal/ui/app.go"
click node_tool "https://github.com/livealieen/d-mesh/blob/master/cmd/dmesh-tool/main.go"
click node_identity "https://github.com/livealieen/d-mesh/blob/master/internal/identity/seed.go"
click node_roster "https://github.com/livealieen/d-mesh/blob/master/internal/group/events.go"
click node_discovery "https://github.com/livealieen/d-mesh/blob/master/internal/discovery/manager.go"
click node_neighbors "https://github.com/livealieen/d-mesh/blob/master/internal/neighbor/neighbor.go"
click node_transport "https://github.com/livealieen/d-mesh/blob/master/internal/transport/handshake.go"
click node_engine "https://github.com/livealieen/d-mesh/blob/master/internal/message/engine.go"
click node_backfill "https://github.com/livealieen/d-mesh/blob/master/internal/backfill/backfill.go"
click node_store "https://github.com/livealieen/d-mesh/blob/master/internal/store/messages.go"
click node_netdisk "https://github.com/livealieen/d-mesh/blob/master/internal/netdisk/manager.go"
click node_block_store "https://github.com/livealieen/d-mesh/blob/master/internal/netdisk/store.go"

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_client_entry,node_host,node_gui,node_tool,node_user toneBlue
class node_identity,node_roster toneAmber
class node_discovery,node_neighbors,node_transport toneMint
class node_engine,node_backfill toneRose
class node_store,node_netdisk,node_block_store,node_peer toneIndigo
```

## Components

### Client

- [Client Entry](https://github.com/livealieen/d-mesh/blob/master/cmd/dmesh/main.go): `cmd/dmesh/main.go`
- [Node Host](https://github.com/livealieen/d-mesh/blob/master/cmd/dmesh/app.go): `cmd/dmesh/app.go`
- [Desktop UI](https://github.com/livealieen/d-mesh/blob/master/internal/ui/app.go): `internal/ui/app.go`
- [Group Tool](https://github.com/livealieen/d-mesh/blob/master/cmd/dmesh-tool/main.go): `cmd/dmesh-tool/main.go`

### Identity and Groups

- [Identity and Seeds](https://github.com/livealieen/d-mesh/blob/master/internal/identity/seed.go): `internal/identity/seed.go`
- [Membership State](https://github.com/livealieen/d-mesh/blob/master/internal/group/events.go): `internal/group/events.go`

### Peer Networking

- [Peer Discovery](https://github.com/livealieen/d-mesh/blob/master/internal/discovery/manager.go): `internal/discovery/manager.go`
- [Neighbor Manager](https://github.com/livealieen/d-mesh/blob/master/internal/neighbor/neighbor.go): `internal/neighbor/neighbor.go`
- [Secure Transport](https://github.com/livealieen/d-mesh/blob/master/internal/transport/handshake.go): `internal/transport/handshake.go`

### Messaging

- [Message Engine](https://github.com/livealieen/d-mesh/blob/master/internal/message/engine.go): `internal/message/engine.go`
- [History Backfill](https://github.com/livealieen/d-mesh/blob/master/internal/backfill/backfill.go): `internal/backfill/backfill.go`

### Persistence and Files

- [Message Store](https://github.com/livealieen/d-mesh/blob/master/internal/store/messages.go): `internal/store/messages.go`
- [Group Netdisk](https://github.com/livealieen/d-mesh/blob/master/internal/netdisk/manager.go): `internal/netdisk/manager.go`
- [Block Store](https://github.com/livealieen/d-mesh/blob/master/internal/netdisk/store.go): `internal/netdisk/store.go`

### Other components

- **User**
- **Group Peers**

## Connections

- User → Desktop UI: uses (evidence: `internal/ui/app.go`)
- Desktop UI → Node Host: calls actions (evidence: `internal/ui/app.go`)
- Client Entry → Node Host: assembles (evidence: `cmd/dmesh/main.go`)
- Client Entry → Identity and Seeds: loads and verifies (evidence: `cmd/dmesh/main.go`)
- Client Entry → Membership State: restores state (evidence: `cmd/dmesh/main.go`)
- Group Tool → Identity and Seeds: creates and verifies (evidence: `cmd/dmesh-tool/main.go`)
- Node Host → Message Engine: publishes messages (evidence: `cmd/dmesh/app.go`)
- Node Host → History Backfill: runs audit (evidence: `cmd/dmesh/app.go`)
- Message Engine → Secure Transport: sends to peers (evidence: `internal/message/engine.go`)
- Secure Transport → Group Peers: secures sessions (evidence: `internal/transport/handshake.go`)
- Node Host → Group Netdisk: exposes file actions (evidence: `cmd/dmesh/app.go`)
- Group Netdisk → Block Store: stores local blocks (evidence: `internal/netdisk/manager.go`)
- Group Netdisk → Secure Transport: pushes and fetches blocks (evidence: `internal/netdisk/manager.go`)
- Node Host → Message Store: persists messages
- Client Entry → Peer Discovery: configures discovery
- Neighbor Manager → Secure Transport: uses sessions
- History Backfill → Message Store: reconciles history
