How eziomercer/web-rtc-chat works
web-rtc-chat is a browser-based, end-to-end encrypted peer-to-peer messenger. Its main workflow is local identity setup, contact introduction and verification, relay-assisted connection negotiation, then direct WebRTC messaging, calls, and file transfer; chats are saved encrypted on-device. The README documents the product stages and capabilities, while source excerpts and the index support the app/store wiring and selected internal dependencies. Several feature implementations were not sampled, so their links are shown only where documented, not as inferred call chains.
Main entry points: chatSlice.ts Chat state · store.ts App state store · config.ts WebRTC transport · App.tsx App lifecycle
Components 20
App and state
- Browser entry
src/main.tsx - App lifecycle
src/App.tsx - App state store
src/store/store.ts - Messenger UI
src/features/app/Messenger/Messenger.tsx
Identity and contact
- Identity setup
src/store/thunks/app/setupIdentity.ts - Identity and keys
src/core/identity - Contacts and invites
src/store/contacts/contactsSlice.ts
Connection and calls
- Relay signaling
src/core/nostr - Session management
src/store/sessions/sessionsSlice.ts - WebRTC transport
src/core/webrtc/config.ts - Audio and video calls
src/store/thunks/call/startCall.ts - Manual connection
src/store/manual/manualSlice.ts
Messaging and sharing
- Chat state
src/store/chat/chatSlice.ts - Chat interface
src/features/chat/ChatPane/ChatPane.tsx - Voice and video notes
src/features/recording/useRecording.ts - Location sharing
src/store/thunks/location
Local data and backup
- Encrypted chat history
src/core/history - Browser storage
src/core/storage/kv.ts - Password-locked backup
src/core/backup/RecordType.ts
Other components
- User
Connections 26
- User → Browser entry: opens app
- Browser entry → App lifecycle: renders
src/main.tsx - App lifecycle → App state store: dispatches init
src/App.tsx - App lifecycle → Messenger UI: renders ready state
src/App.tsx - User → Identity setup: sets up identity
- Identity setup → Identity and keys: creates keys
- User → Contacts and invites: adds contact
- Contacts and invites → Relay signaling: exchanges rendezvous notes
- Relay signaling → Session management: enables negotiation
- Session management → WebRTC transport: establishes peer link
- User → Manual connection: uses manual mode
- Messenger UI → Chat state: manages conversations
- Chat state → WebRTC transport: sends messages and files
src/store/chat/chatSlice.ts - WebRTC transport → Chat state: delivers peer data
src/store/chat/chatSlice.ts - User → Audio and video calls: starts call
- Audio and video calls → WebRTC transport: uses media tracks
- User → Voice and video notes: records note
src/features/recording/useRecording.ts - Voice and video notes → Chat state: dispatches note
src/features/recording/useRecording.ts - User → Location sharing: shares location
- Chat state → Encrypted chat history: persists encrypted chats
- Encrypted chat history → Browser storage: writes local data
- User → Password-locked backup: exports or restores
- Password-locked backup → Encrypted chat history: moves chat data
- App state store → Chat state: registers reducer
src/store/store.ts - App state store → Session management: registers reducer
src/store/store.ts - App state store → Manual connection: registers reducer
src/store/store.ts