How minghsu0107/go-random-chat works
Go Random Chat is a stateless, multi-service real-time chat platform. Users enter through the web service, authenticate through the user service, request a match, then communicate in a chat channel; messages are persisted and published for forwarding to the chat server serving their recipients. File upload and channel-level access are separate capabilities. The graph reflects documented service roles and sampled service behavior; handler-level wiring was not sampled, so uncertain call paths are omitted.
Main entry points: chat/service.go Channel and messages · user/service.go User service · match/service.go Matching logic · router.go Chat HTTP/gRPC
Components 20
Entry and identity
- Web frontend
pkg/web/router.go - User service
pkg/user/service.go - User HTTP/gRPC
pkg/user/router.go - Google OAuth
Matching
- Match HTTP
pkg/match/router.go - Matching logic
pkg/match/service.go - Match state
pkg/match/repo.go
Messaging
- Chat HTTP/gRPC
pkg/chat/router.go - Channel and messages
pkg/chat/service.go - Chat repositories
pkg/chat/repo.go - Chat cache
pkg/chat/repo_cache.go - Kafka
pkg/infra/kafka.go - Message forwarder
pkg/forwarder/service.go - Forwarder gRPC
pkg/forwarder/router.go
File uploads
- Uploader API
pkg/uploader/router.go - Presigned access
pkg/uploader/presigner.go - S3 storage
Connections 20
- Chat user → Web frontend: opens app
- Chat user → User HTTP/gRPC: authenticates
- User HTTP/gRPC → User service: handles identity
- User service → Google OAuth: fetches profile
- User service → Redis: stores sessions
- Chat user → Match HTTP: requests match
- Match HTTP → Matching logic: dispatches
- Matching logic → Match state: updates waitlist
- Matching logic → Chat HTTP/gRPC: creates channel
- Chat user → Chat HTTP/gRPC: joins channel
- Chat HTTP/gRPC → Channel and messages: dispatches
- Channel and messages → Chat repositories: persists messages
- Channel and messages → Chat cache: reads and writes
- Channel and messages → Kafka: publishes messages
- Kafka → Message forwarder: delivers events
- Message forwarder → Forwarder gRPC: routes messages
- Chat user → Uploader API: uploads files
- Uploader API → Presigned access: creates access URL
- Presigned access → S3 storage: signs object access
- Channel and messages → Cassandra: stores chat history