How vuxenn1/decentralized-p2p-chat-system works
This is a decentralized Go chat application with both a desktop CLI and a browser interface. Users discover or address peers, request and approve connections, then exchange encrypted messages; trusted peers and encrypted conversation histories persist locally. The graph reflects the documented identity, discovery, approval, messaging, and storage capabilities. Some runtime wiring is inferred only from the README because the Go entry-point and web excerpts are partial.
Main entry points: main.go Stream manager · web.go WebSocket API · dht.go DHT discovery · app.js Browser UI
Components 14
User interfaces
- Desktop CLI
main.go - Browser UI
web/app.js - WebSocket API
web.go
Peer runtime
- Stream manager
main.go - DHT discovery
discovery/dht.go - Discovery config
discovery/config.go - Connection approval
main.go
Identity and security
- Session encryption
security/e2ee.go - Persistent identity
main.go
Local persistence
- Encrypted history
storage/history.go - Trusted peers
storage/peers.go
Other components
- Chat user
- Peer network
- Bootstrap peers
Connections 21
- Chat user → Desktop CLI: uses commands
- Chat user → Browser UI: uses chat UI
- Browser UI → WebSocket API: sends WebSocket events
- WebSocket API → Stream manager: dispatches commands
- Desktop CLI → Stream manager: controls sessions
- Stream manager → Persistent identity: loads identity
- Persistent identity → Stream manager: provides key
- Stream manager → Connection approval: requests approval
- Chat user → Connection approval: accepts or rejects
- Stream manager → DHT discovery: starts discovery
- WebSocket API → DHT discovery: requests discovery
- DHT discovery → Discovery config: reads bootstrap list
- DHT discovery → Bootstrap peers: bootstraps
- DHT discovery → Peer network: finds peers
- Stream manager → Peer network: connects and exchanges streams
- Stream manager → Session encryption: encrypts and decrypts
- WebSocket API → Session encryption: encrypts outgoing messages
- Stream manager → Encrypted history: loads and saves messages
- WebSocket API → Encrypted history: clears history
- WebSocket API → Trusted peers: manages saved peers
- WebSocket API → Browser UI: broadcasts state