How saell-s/gin_chat_app works
Gin Chat is a browser-based messaging and calling app with account management, presence, dashboards, and reports. Users sign in, load conversations and directory data, exchange messages and call events over REST and WebSocket, and use WebRTC media for calls. The backend routes requests to feature handlers and services, with PostgreSQL-backed repositories and shared realtime infrastructure. The README names the web stack; source excerpts show client API and WebSocket usage and server wiring. Unsampled feature internals are represented by their source directories, without asserting unshown calls.
Main entry points: main.go Gin server · app.ts Chat application · chat/service.go Chat and presence · call/service.go Call service
Components 21
Web client
- Chat application
web/ts/app.ts - HTTP client
web/ts/api.ts - WebSocket client
web/ts/ws.ts - WebRTC manager
web/ts/webrtc.ts - Templ pages
web/app_templ.go
Identity and users
- Authentication
app/features/auth/service.go - User management
app/features/user/service.go
Messaging and calls
- Chat and presence
app/features/chat/service.go - Call service
app/features/call/service.go
Dashboard and reports
Shared platform
- Gin server
main.go - Realtime hub
app/shared/realtime/hub.go - Database
app/shared/db/db.go - Schema migrations
app/shared/db/migrate.go - Event repository
app/shared/db/events.go - Kafka producer
app/shared/kafka/producer.go - Configuration
app/shared/configs/config.go - JWT security
app/shared/security/jwt.go - Auth middleware
app/shared/middleware/auth.go
Other components
- User
Connections 21
- User → Chat application: uses
- Chat application → HTTP client: requests API
web/ts/app.ts - Chat application → WebSocket client: sends events
web/ts/app.ts - Chat application → WebRTC manager: manages media
web/ts/app.ts - Gin server → Templ pages: registers pages
main.go - Gin server → Authentication: registers routes
main.go - Gin server → User management: registers routes
main.go - Gin server → Chat and presence: registers routes
main.go - Gin server → Call service: registers routes
main.go - Gin server → Dashboard: registers routes
main.go - Gin server → Reporting: registers routes
main.go - Gin server → Realtime hub: serves WebSocket
main.go - Gin server → Chat and presence: dispatches chat events
main.go - Gin server → Call service: dispatches call events
main.go - Gin server → Database: opens database
main.go - Gin server → Schema migrations: runs migrations
main.go - Gin server → Event repository: creates repository
main.go - Gin server → Kafka producer: creates producer
main.go - Gin server → Configuration: loads settings
main.go - Gin server → JWT security: creates token manager
main.go - Gin server → Auth middleware: configures authorization
main.go