How stevemoraco/bitchat-in-browser works
BitChat In Browser is a private, offline-first messaging PWA interoperable with native BitChat through Nostr. Users create or import an identity, enter location-based channels or private DMs, and exchange encrypted messages; the app also supports peer management, offline storage and sync, notifications, emergency wipe, and nearby app sharing. The README documents the product workflow and capabilities; sampled source confirms app routing, command-to-store updates, and storage backend selection. Other internal links are limited to README or SOURCE INDEX evidence, so unsampled implementation details are not inferred.
Main entry points: ChatView.tsx Chat interface · storage-manager.ts Storage manager · client.ts Nostr protocol · App.tsx App shell
Components 29
App and navigation
- App shell
src/App.tsx - Route guards
src/router/guards.tsx - Identity onboarding
src/components/onboarding/OnboardingFlow.tsx - Channel pages
src/pages/ChannelsPage.tsx
Messaging experience
- Channel details
src/components/channels/ChannelInfo.tsx - Location channel setup
src/components/channels/LocationChannelCreate.tsx - Chat interface
src/components/chat/ChatView.tsx - Message composition
src/components/chat/MessageInput.tsx - Image selection
src/components/chat/ImagePicker.tsx - Payment messages
src/components/chat/PaymentChip.tsx - Message formatting
src/services/formatting/renderer.ts
Identity and networking
- Identity and crypto
src/services/crypto/encryption.ts - Nostr protocol
src/services/nostr/client.ts - Relay selection
src/services/nostr/relay-list.ts - WebRTC connections
src/services/webrtc/peer-connection.ts - Nearby app sharing
src/services/sharing/hotspot-bridge.ts
Offline and device services
- Offline sync queue
src/services/sync/offline-queue.ts - Service worker
src/workers/sw.ts - Emergency wipe
src/features/emergency/wipe.ts - Storage manager
src/services/storage/storage-manager.ts - OPFS adapter
src/services/storage/opfs-storage.ts - IndexedDB adapter
src/services/storage/indexeddb-storage.ts - Performance utilities
src/utils/performance.ts
Application state
- Message state
src/stores/messages-store.ts - Channel state
src/stores/channels-store.ts - Mesh state
src/stores/mesh-store.ts - Settings state
src/stores/settings-store.ts
Other components
- User
- Native BitChat users
Connections 26
- User → App shell: opens app
README.md - App shell → Route guards: routes through
src/App.tsx - Route guards → Identity onboarding: redirects to
- User → Identity onboarding: creates or imports
README.md - User → Channel pages: joins channels
README.md - Channel pages → Channel details: shows details
src/pages/ChannelsPage.tsx - Channel pages → Location channel setup: opens setup
src/pages/ChannelsPage.tsx - User → Chat interface: opens conversation
README.md - Chat interface → Message composition: composes messages
src/components/chat/index.ts - Message composition → Image selection: selects images
- Chat interface → Payment messages: shows payment
- Chat interface → Message formatting: renders text
- User → Identity and crypto: uses identity
README.md - Identity and crypto → Nostr protocol: encrypts DMs
README.md - Nostr protocol → Relay selection: selects relays
- Nostr protocol → Native BitChat users: interoperates with
README.md - User → Nearby app sharing: shares app nearby
README.md - Chat interface → Offline sync queue: queues offline messages
README.md - Offline sync queue → Nostr protocol: syncs when online
README.md - App shell → Service worker: registers worker
- User → Emergency wipe: triggers wipe
README.md - Storage manager → OPFS adapter: selects backend
src/services/storage/storage-manager.ts - Storage manager → IndexedDB adapter: selects fallback
src/services/storage/storage-manager.ts - Message state → Storage manager: persists messages
- Channel state → Storage manager: persists channels
- Performance utilities → Storage manager: measures operations