How baashaa001/chat-app works
This is a browser-based messaging application with an Express/MongoDB backend. Users sign up or log in, select another user, load conversation history, and exchange text or image messages; the server persists messages and can deliver them live over Socket.IO. The graph preserves the documented-by-code profile, online-presence, and seen/unseen-message capabilities. Some client views and storage helpers were not excerpted, so their connections are included only where the source index or shown code supports them.
Main entry points: server.js HTTP and Socket.IO · messageController.js Message controller · ChatContext.jsx Conversation state · App.jsx Route shell
Components 22
Client interface
- Route shell
client/src/App.jsx - Chat home
client/src/pages/Home.jsx - Login page
client/src/pages/Login.jsx - Profile page
client/src/pages/Profile.jsx - User sidebar
client/src/components/Sidebar.jsx - Conversation view
client/src/components/Chatbar.jsx - Contact details
client/src/components/RightSidebar.jsx
Client state
- Auth and presence
client/context/AuthContext.jsx - Conversation state
client/context/ChatContext.jsx
Server API
- User routes
server/Routes/userRoutes.js - Account controller
server/controller/userController.js - JWT guard
server/middleware/auth.js - Message routes
server/Routes/messageRoutes.js - Message controller
server/controller/messageController.js
Server data
- User model
server/model/User.js - Message model
server/model/Message.js - DB connection
server/lib/db.js
Realtime and media
- HTTP and Socket.IO
server/server.js - Image upload client
server/lib/cloudinary.js
Other components
- User
- MongoDB
- Cloudinary
Connections 32
- User → Route shell: uses
client/src/App.jsx - Route shell → Chat home: routes to
client/src/App.jsx - Route shell → Login page: routes to
client/src/App.jsx - Route shell → Profile page: routes to
client/src/App.jsx - Chat home → User sidebar: renders
client/src/pages/Home.jsx - Chat home → Conversation view: renders
client/src/pages/Home.jsx - Chat home → Contact details: renders
client/src/pages/Home.jsx - Login page → Auth and presence: uses
client/src/pages/Login.jsx - Profile page → Auth and presence: uses
client/src/pages/Profile.jsx - User sidebar → Conversation state: uses
client/src/components/Sidebar.jsx - Contact details → Conversation state: uses
client/src/components/RightSidebar.jsx - Conversation view → Conversation state: loads and sends
client/src/components/Chatbar.jsx - Auth and presence → User routes: requests auth
client/context/AuthContext.jsx - Auth and presence → HTTP and Socket.IO: opens socket
client/context/AuthContext.jsx - Conversation state → Message routes: requests messages
client/context/ChatContext.jsx - Conversation state → HTTP and Socket.IO: receives events
client/context/ChatContext.jsx - HTTP and Socket.IO → User routes: mounts
server/server.js - HTTP and Socket.IO → Message routes: mounts
server/server.js - User routes → Account controller: dispatches
server/Routes/userRoutes.js - User routes → JWT guard: guards routes
server/Routes/userRoutes.js - Message routes → Message controller: dispatches
server/Routes/messageRoutes.js - Message routes → JWT guard: guards routes
server/Routes/messageRoutes.js - JWT guard → User model: loads user
server/middleware/auth.js - Account controller → User model: reads and writes
server/controller/userController.js - Message controller → User model: reads users
server/controller/messageController.js - Message controller → Message model: reads and writes
server/controller/messageController.js - Message controller → Image upload client: uploads image
server/controller/messageController.js - Account controller → Image upload client: uploads profile image
server/controller/userController.js - HTTP and Socket.IO → DB connection: connects database
server/server.js - DB connection → MongoDB: connects
- Image upload client → Cloudinary: uploads
- Message controller → HTTP and Socket.IO: emits message
server/controller/messageController.js