How bikhizlit/travel-app-socket works
This is a Socket.IO backend for a travel app, centered on authenticated real-time conversation, messaging, and presence. Clients connect through the socket server; conversation actions check participant records, messages are persisted and broadcast to conversation rooms, and presence changes are shared across those rooms. A separate authenticated internal endpoint emits events to user rooms. The README documents no further product capabilities; Match and User-related entity files indicate domain state, but matching behavior is not present in the sampled handlers.
Main entry points: index.ts Socket server · message.handlers.ts Message handlers · presence.handlers.ts Presence handlers · rooms.ts Room addressing
Components 22
Service runtime
- HTTP bootstrap
src/server.ts - Express app
src/app.ts - Health endpoint
src/health/health.routes.ts
Realtime features
- Socket server
src/socket/index.ts - Socket authentication
src/socket/middleware/socket-auth.middleware.ts - JWT verification
src/auth/jwt.ts - Conversation handlers
src/socket/handlers/conversation.handlers.ts - Message handlers
src/socket/handlers/message.handlers.ts - Presence handlers
src/socket/handlers/presence.handlers.ts - Connection presence
src/socket/presence.ts - Room addressing
src/socket/rooms.ts
Internal events
- Internal emit API
src/internal/router.ts - Event allowlist
src/internal/events.ts
Domain state
- Database connection
src/db/data-source.ts - MySQL database
- User records
src/entities/User.entity.ts - Conversation records
src/entities/Conversation.entity.ts - Participant records
src/entities/ConversationParticipant.entity.ts - Message records
src/entities/Message.entity.ts - Match records
src/entities/Match.entity.ts
Other components
- Realtime client
- Internal caller
Connections 32
- Realtime client → Socket server: connects
- HTTP bootstrap → Express app: creates
- HTTP bootstrap → Database connection: initializes
- HTTP bootstrap → Socket server: starts
- Socket server → Socket authentication: registers
- Socket authentication → JWT verification: verifies token
- Socket server → Conversation handlers: registers
- Socket server → Message handlers: registers
- Socket server → Presence handlers: registers
- Socket server → Connection presence: tracks connections
- Socket server → Room addressing: addresses rooms
- Conversation handlers → Participant records: checks membership
- Conversation handlers → Presence handlers: requests snapshot
- Conversation handlers → Room addressing: joins room
- Message handlers → Participant records: checks membership
- Message handlers → Message records: persists message
- Message handlers → Conversation records: updates timestamp
- Message handlers → Room addressing: broadcasts message
- Presence handlers → Participant records: reads participants
- Presence handlers → Connection presence: reads status
- Presence handlers → Room addressing: broadcasts status
- Express app → Internal emit API: mounts route
- Internal caller → Internal emit API: requests emission
- Internal emit API → Event allowlist: validates event
- Internal emit API → Room addressing: targets user room
- Express app → Database connection: checks database
- Database connection → MySQL database: connects
- Message records → MySQL database: stored in
- Conversation records → MySQL database: stored in
- Participant records → MySQL database: stored in
- User records → MySQL database: stored in
- Match records → MySQL database: stored in