How ashutosh-6603/real-time-chat-app-backend works
This repository implements a chat application split into user, chat, and mail services. The main workflow is OTP login and verification, followed by authenticated chat creation and message exchange over HTTP and Socket.IO; image uploads use Cloudinary. User lookup crosses from chat to the user service, while OTP delivery crosses RabbitMQ to the mail consumer and SMTP. The graph reflects the shown routes and calls; unsampled runtime details and README-documented capabilities cannot be assessed because no README content was provided.
Main entry points: controllers/chat.ts Chat workflows · controllers/user.ts User workflows · routes/chat.ts Chat API · routes/user.ts User API
Components 20
User and identity
- User API
user/src/routes/user.ts - User workflows
user/src/controllers/user.ts - JWT authentication
user/src/middlewares/isAuth.ts - User model
user/src/model/User.ts - User service runtime
user/src/index.ts
Chat and messaging
- Chat API
chat/src/routes/chat.ts - Chat workflows
chat/src/controllers/chat.ts - JWT authentication
chat/src/middlewares/isAuth.ts - Chat model
chat/src/models/Chat.ts - Message model
chat/src/models/Messages.ts - Realtime sockets
chat/src/config/socket.ts - Image upload
chat/src/middlewares/multer.ts - Chat service runtime
chat/src/index.ts
OTP delivery
- RabbitMQ
- Mail consumer
mail/src/consumer.ts - Mail runtime
mail/src/index.ts
Runtime integrations
- SMTP mail
- Redis OTP store
- Cloudinary
Other components
- Client
Connections 24
- Client → User API: requests
- User service runtime → User API: mounts routes
user/src/index.ts - User API → User workflows: dispatches
user/src/routes/user.ts - User API → JWT authentication: guards routes
user/src/routes/user.ts - User workflows → User model: reads and writes
user/src/controllers/user.ts - User workflows → Redis OTP store: stores OTPs
user/src/controllers/user.ts - User workflows → RabbitMQ: publishes OTP
user/src/controllers/user.ts - User service runtime → RabbitMQ: connects
user/src/index.ts - User workflows → Client: returns token
- Client → Chat API: requests
- Chat service runtime → Chat API: mounts routes
chat/src/index.ts - Chat API → Chat workflows: dispatches
chat/src/routes/chat.ts - Chat API → JWT authentication: guards routes
chat/src/routes/chat.ts - Chat API → Image upload: processes images
chat/src/routes/chat.ts - Chat workflows → Chat model: reads and writes
chat/src/controllers/chat.ts - Chat workflows → Message model: reads and writes
chat/src/controllers/chat.ts - Chat workflows → Realtime sockets: emits events
chat/src/controllers/chat.ts - Chat service runtime → Realtime sockets: serves sockets
chat/src/index.ts - Chat workflows → User API: looks up users
chat/src/controllers/chat.ts - Chat workflows → Client: returns chat results
- Image upload → Cloudinary: uploads media
chat/src/middlewares/multer.ts - Mail runtime → Mail consumer: starts consumer
mail/src/index.ts - Mail consumer → RabbitMQ: consumes OTP queue
mail/src/consumer.ts - Mail consumer → SMTP mail: sends email
mail/src/consumer.ts