How arunkumar09-06/chat_application works
This is a full-stack, one-to-one real-time chat application. Users register or log in, restore a cookie-backed session, discover contacts, start or reopen a conversation, then load chat history and exchange messages over Socket.IO (with an HTTP send fallback). The backend also supports profile-picture uploads. The graph preserves the documented features while limiting relationships to those visible in excerpts or the README; unsampled modules are represented only where their paths are supported.
Main entry points: AuthContext.jsx Session state · ChatWindow.jsx Chat and history · Chat.jsx Chat workspace · axios.js Axios API client
Components 28
React client
- Routes and guards
frontend/src/App.jsx - Login and register
frontend/src/pages - Session state
frontend/src/context/AuthContext.jsx - Chat workspace
frontend/src/pages/Chat.jsx - Contact discovery
frontend/src/components/Sidebar.jsx - Profile customization
frontend/src/components/ProfileModal.jsx - User avatar
frontend/src/components/UserAvatar.jsx - Chat and history
frontend/src/components/ChatWindow.jsx - Message display
frontend/src/components/MessageBubble.jsx - Emoji input
frontend/src/components/EmojiPicker.jsx
HTTP API
- Axios API client
frontend/src/api/axios.js - HTTP app and mounts
backend/src/app.js - Authentication routes
backend/src/routes/auth.routes.js - Conversation route
backend/src/routes/conversation.route.js - Message routes
backend/src/routes/message.route.js - Account and profile
backend/src/controllers/auth.controller.js - Conversation setup
backend/src/controllers/conversation.controller.js - History and HTTP send
backend/src/controllers/message.controller.js - Cookie JWT guard
backend/src/middlewares/auth.js - Avatar upload handling
backend/src/middlewares/multer.js
Real-time messaging
- Socket client
frontend/src/hooks/useSocket.js - Socket rooms and delivery
backend/src/server.js
Persistence and uploads
- User records
backend/src/models/User.js - Conversation records
backend/src/models/Conversation.js - Message records
backend/src/models/Message.js - MongoDB
- Avatar files
backend/public/uploads/profilePictures
Other components
- Chat user
Connections 46
- Chat user → Routes and guards: uses
README.md - Routes and guards → Session state: provides session
frontend/src/App.jsx - Routes and guards → Login and register: routes to
frontend/src/App.jsx - Routes and guards → Chat workspace: protects route
frontend/src/App.jsx - Login and register → Session state: authenticates through
frontend/src/pages/Login.jsx - Login and register → Session state: registers through
frontend/src/pages/Register.jsx - Session state → Axios API client: calls API
frontend/src/context/AuthContext.jsx - Chat workspace → Session state: reads session
frontend/src/pages/Chat.jsx - Chat workspace → Socket client: creates socket
frontend/src/pages/Chat.jsx - Chat workspace → Contact discovery: renders
frontend/src/pages/Chat.jsx - Chat workspace → Chat and history: renders
frontend/src/pages/Chat.jsx - Contact discovery → Axios API client: loads contacts
frontend/src/components/Sidebar.jsx - Contact discovery → Profile customization: opens
frontend/src/components/Sidebar.jsx - Contact discovery → User avatar: renders
frontend/src/components/Sidebar.jsx - Profile customization → Axios API client: uploads picture
frontend/src/components/ProfileModal.jsx - Profile customization → Session state: updates user
frontend/src/components/ProfileModal.jsx - Profile customization → User avatar: renders
frontend/src/components/ProfileModal.jsx - Chat and history → Axios API client: loads history or sends
frontend/src/components/ChatWindow.jsx - Chat and history → Socket client: joins and sends
frontend/src/components/ChatWindow.jsx - Chat and history → Message display: renders
frontend/src/components/ChatWindow.jsx - Chat and history → User avatar: renders
frontend/src/components/ChatWindow.jsx - Chat and history → Emoji input: opens
frontend/src/components/ChatWindow.jsx - Message display → Session state: reads current user
frontend/src/components/MessageBubble.jsx - Axios API client → HTTP app and mounts: HTTP requests
README.md - HTTP app and mounts → Authentication routes: mounts
backend/src/app.js - HTTP app and mounts → Conversation route: mounts
backend/src/app.js - HTTP app and mounts → Message routes: mounts
backend/src/app.js - Authentication routes → Account and profile: dispatches
backend/src/routes/auth.routes.js - Authentication routes → Cookie JWT guard: guards
backend/src/routes/auth.routes.js - Authentication routes → Avatar upload handling: uploads through
backend/src/routes/auth.routes.js - Conversation route → Conversation setup: dispatches
backend/src/routes/conversation.route.js - Conversation route → Cookie JWT guard: guards
backend/src/routes/conversation.route.js - Message routes → History and HTTP send: dispatches
backend/src/routes/message.route.js - Message routes → Cookie JWT guard: guards
backend/src/routes/message.route.js - Account and profile → User records: reads and writes
backend/src/controllers/auth.controller.js - Account and profile → Avatar files: stores uploaded image
README.md - Conversation setup → User records: checks participant
backend/src/controllers/conversation.controller.js - Conversation setup → Conversation records: finds or creates
backend/src/controllers/conversation.controller.js - History and HTTP send → Conversation records: checks access
backend/src/controllers/message.controller.js - History and HTTP send → Message records: reads and writes
backend/src/controllers/message.controller.js - Socket client → Socket rooms and delivery: Socket.IO events
README.md - Socket rooms and delivery → Conversation records: validates room access
backend/src/server.js - Socket rooms and delivery → Message records: creates messages
backend/src/server.js - User records → MongoDB: persists
- Conversation records → MongoDB: persists
- Message records → MongoDB: persists