How chifendse/postly_server works
Postly is a Go backend composed of independently deployable services, with an HTTP gateway in front of gRPC domain services. The principal workflow is a client request entering the gateway and reaching a domain service; messaging can also update chat state and publish per-user realtime events. Separate capabilities include account and profile management, social relationships, file storage, and DTLS/SFU calling. The README describes realtime broadcasting, but the sampled sources do not show the WebSocket subscriber wiring; those connections are therefore left unasserted.
Main entry points: router HTTP routes · server/server.go Messages and history · server/server.go Chats and groups · main.go HTTP gateway
Components 26
API entry
- HTTP gateway
services/gateway-service/cmd/main.go - HTTP routes
services/gateway-service/internal/router - Service clients
services/gateway-service/internal/clients/clients.go
Domain services
- Authentication
services/auth-service/internal/server/server.go - User profiles
services/user-service/internal/server/server.go - Chats and groups
services/chat-service/internal/server/server.go - Friend relationships
services/friends-service/internal/server/server.go - Messages and history
services/messaging-service/internal/server/server.go - Auth contract
proto/auth/auth.proto - Chat contract
proto/chat/chat.proto - Friends contract
proto/friends/friends.proto - Messaging contract
proto/messaging/messaging.proto - User contract
proto/user/user.proto
Realtime and calls
- Realtime hub
services/gateway-service/internal/router/ws.go - DTLS call handling
services/call-service/cmd/main.go - Call rooms
services/call-service/internal/udp/rooms.go - SFU forwarding
services/call-service/internal/sfu/sfu.go - WebSocket SFU
services/call-service/internal/wsfu/wsfu.go
Persistence and files
- SQL database
- Redis Pub/Sub and cache
- File service
services/s3-service/internal/server.go - Object storage
services/s3-service/internal/s3.go - File contract
proto/s3/s3.proto
Legacy protocol
- Legacy protocol handlers
services/old/internal/protocol_stack/handlers.go - Legacy UDP rooms
services/old/internal/udp/rooms.go
Other components
- API client
Connections 28
- API client → HTTP gateway: sends requests
- HTTP gateway → HTTP routes: configures routes
services/gateway-service/cmd/main.go - HTTP gateway → Service clients: creates clients
services/gateway-service/cmd/main.go - HTTP gateway → Realtime hub: routes WebSocket
- HTTP routes → Authentication: dispatches requests
- HTTP routes → User profiles: dispatches requests
- HTTP routes → Chats and groups: dispatches requests
- HTTP routes → Friend relationships: dispatches requests
- HTTP routes → Messages and history: dispatches requests
- Authentication → Auth contract: implements contract
- User profiles → User contract: implements contract
- Chats and groups → Chat contract: implements contract
- Friend relationships → Friends contract: implements contract
- Messages and history → Messaging contract: implements contract
- File service → File contract: implements contract
- Messages and history → Chats and groups: updates last message
services/messaging-service/internal/server/server.go - Messages and history → SQL database: reads and writes
services/messaging-service/internal/server/server.go - Chats and groups → SQL database: reads and writes
services/chat-service/internal/server/server.go - Chats and groups → Redis Pub/Sub and cache: caches results
services/chat-service/internal/server/server.go - Messages and history → Redis Pub/Sub and cache: caches and publishes
services/messaging-service/internal/server/server.go - Friend relationships → Redis Pub/Sub and cache: publishes events
services/friends-service/internal/server/server.go - Realtime hub → Redis Pub/Sub and cache: subscribes events
- File service → Object storage: uploads and presigns
services/s3-service/internal/server.go - Messages and history → File service: uses file client
- DTLS call handling → Call rooms: manages participants
services/call-service/cmd/main.go - DTLS call handling → SFU forwarding: forwards packets
services/call-service/cmd/main.go - DTLS call handling → WebSocket SFU: starts hub
services/call-service/cmd/main.go - Legacy protocol handlers → Legacy UDP rooms: handles separately