How hutrisemendawai/cp-chat works
CP Chat is a Flutter Android messaging client backed here by a TypeScript REST API and WebSocket gateway. The documented user workflow is account/profile and friend management, conversation setup, encrypted message send and live delivery, then sync and receipts; media, calls, presence, search, and diagnostics are major supporting capabilities. The tree and index establish the backend surfaces, but no Flutter Dart sources are provided, so client-side workflow links and several route-to-domain calls are not asserted. Edges reflect excerpted calls, indexed references, or README documentation.
Main entry points: context.ts App context · chat-gateway.ts WebSocket gateway · messages.ts Message service · call-signaling.ts Call signaling
Components 24
API and identity
- REST server
backend/src/rest.ts - HTTP routes
backend/src/http - App context
backend/src/http/context.ts - Authentication
backend/src/http/auth-routes.ts
Messaging and realtime
- Conversations
backend/src/domain/conversations.ts - Message service
backend/src/domain/messages.ts - Scylla history
backend/src/domain/scylla-messages.ts - WebSocket gateway
backend/src/gateway/chat-gateway.ts - Inbound dispatch
backend/src/gateway/inbound.ts - Message search
backend/src/http/search-routes.ts
People and presence
- User profiles
backend/src/domain/users.ts - Friends directory
backend/src/domain/friends.ts - Presence service
backend/src/domain/presence.ts
Calls and media
- Call signaling
backend/src/domain/call-signaling.ts - Call records
backend/src/domain/calls.ts - Media handling
backend/src/domain/media.ts - E2EE keys
backend/src/domain/keys.ts
State and operations
- PostgreSQL
backend/src/lib/db.ts - Redis
backend/src/lib/redis.ts - Realtime broker
backend/src/lib/broker.ts - Push notifications
backend/src/lib/fcm.ts - Media object storage
backend/src/lib/storage.ts - Log timeline
backend/src/lib/log-store.ts
Other components
- Android client
Connections 37
- Android client → REST server: uses REST
README.md - Android client → WebSocket gateway: uses WebSocket
README.md - REST server → HTTP routes: serves routes
backend/src/rest.ts - HTTP routes → App context: uses context
backend/src/http/context.ts - App context → User profiles: constructs
backend/src/http/context.ts - App context → Conversations: constructs
backend/src/http/context.ts - App context → Message service: constructs
backend/src/http/context.ts - App context → Presence service: constructs
backend/src/http/context.ts - App context → Friends directory: constructs
backend/src/http/context.ts - App context → Call signaling: constructs
backend/src/http/context.ts - App context → Call records: constructs
backend/src/http/context.ts - App context → E2EE keys: constructs
backend/src/http/context.ts - App context → PostgreSQL: uses database
backend/src/http/context.ts - App context → Redis: uses cache
backend/src/http/context.ts - Authentication → User profiles: looks up users
backend/src/http/auth-routes.ts - Authentication → App context: authenticates
backend/src/http/auth-routes.ts - Conversations → User profiles: projects members
backend/src/domain/conversations.ts - Message service → Scylla history: uses history store
backend/src/domain/messages.ts - Message service → PostgreSQL: queries database
backend/src/domain/messages.ts - User profiles → PostgreSQL: queries database
backend/src/domain/users.ts - Conversations → PostgreSQL: queries database
backend/src/domain/conversations.ts - WebSocket gateway → Message service: dispatches messages
backend/src/gateway/chat-gateway.ts - WebSocket gateway → Conversations: checks membership
backend/src/gateway/chat-gateway.ts - WebSocket gateway → Inbound dispatch: uses dispatch
backend/src/gateway/chat-gateway.ts - WebSocket gateway → Presence service: updates presence
backend/src/gateway/chat-gateway.ts - WebSocket gateway → Realtime broker: publishes frames
backend/src/gateway/chat-gateway.ts - WebSocket gateway → Redis: reads connections
backend/src/gateway/chat-gateway.ts - Call signaling → Call records: uses call records
backend/src/domain/call-signaling.ts - Call signaling → Realtime broker: publishes signaling
backend/src/domain/call-signaling.ts - Call signaling → Push notifications: sends call alerts
backend/src/domain/call-signaling.ts - App context → Log timeline: constructs store
backend/src/http/context.ts - REST server → Log timeline: configures logging
backend/src/rest.ts - Log timeline → Redis: stores timeline
backend/src/lib/log-store.ts - Message search → Message service: searches messages
- Media handling → Media object storage: stores media
- App context → Media handling: constructs
backend/src/http/context.ts - App context → Realtime broker: constructs
backend/src/http/context.ts