How johanngo06/chatapp works
This repository implements a browser-based chat product with a React client and Express/Socket.IO backend. Users sign up or sign in, establish a session and encryption keys, discover users and manage friend requests, then create or open direct/group conversations and exchange encrypted messages and files. The graph preserves those distinct stages plus real-time delivery and persistence. Evidence is limited to the README (empty) and the indexed excerpts; unsampled capabilities are included only where the tree and index support a node, with uncertain relationships omitted.
Main entry points: axios.js HTTP client · useAuthStore.js Auth state · App.jsx Route shell · messageController.js Message handlers
Components 29
Web client
- Route shell
frontend/src/App.jsx - Contacts home
frontend/src/pages/HomePage.jsx - Chat workspace
frontend/src/pages/ChatPage.jsx - HTTP client
frontend/src/lib/axios.js
Identity and contacts
- Sign up
frontend/src/pages/SignUpPage.jsx - Sign in
frontend/src/pages/SignInPage.jsx - Auth state
frontend/src/store/useAuthStore.js - Auth handlers
backend/controller/authController.js - Friend state
frontend/src/store/useFriendStore.js - Friend handlers
backend/controller/friendController.js
Conversations and messaging
- Chat state
frontend/src/store/useChatStore.js - Group creation
frontend/src/components/CreateGroupModal.jsx - Message handlers
backend/controller/messageController.js - Conversation handlers
backend/controller/conversationController.js - E2EE crypto
frontend/src/lib/E2EE.js
API and realtime
- Auth routes
backend/routes/authRoute.js - JWT guard
backend/middleware/authMiddleware.js - Friend routes
backend/routes/friendRoute.js - Message routes
backend/routes/messageRoute.js - Conversation routes
backend/routes/conversationRoute.js - Socket server
backend/lib/socket.js
Persistence and integrations
- User accounts
backend/model/userModel.js - Friend requests
backend/model/friendRequestModel.js - Conversations
backend/model/conversationModel.js - Messages
backend/model/messageModel.js
Other components
- User
- MongoDB
- Cloudinary files
- Email service
Connections 48
- User → Route shell: opens
frontend/src/App.jsx - Route shell → Sign up: routes to
frontend/src/App.jsx - Route shell → Sign in: routes to
frontend/src/App.jsx - Route shell → Contacts home: routes to
frontend/src/App.jsx - Route shell → Chat workspace: routes to
frontend/src/App.jsx - Route shell → Auth state: checks session
frontend/src/App.jsx - Sign up → Auth state: submits
frontend/src/pages/SignUpPage.jsx - Sign in → Auth state: submits
frontend/src/pages/SignInPage.jsx - Auth state → HTTP client: requests
frontend/src/store/useAuthStore.js - Auth state → E2EE crypto: manages keys
frontend/src/store/useAuthStore.js - Auth state → Socket server: connects
frontend/src/store/useAuthStore.js - HTTP client → Auth routes: HTTP API
- Auth routes → JWT guard: guards routes
backend/routes/authRoute.js - Auth routes → Auth handlers: dispatches
backend/routes/authRoute.js - Auth handlers → User accounts: reads writes
backend/controller/authController.js - Auth handlers → Email service: sends OTP
backend/controller/authController.js - Auth handlers → Cloudinary files: uploads avatar
backend/controller/authController.js - Contacts home → Friend state: loads contacts
frontend/src/pages/HomePage.jsx - Friend state → HTTP client: requests
frontend/src/store/useFriendStore.js - HTTP client → Friend routes: HTTP API
- Friend routes → JWT guard: guards routes
backend/routes/friendRoute.js - Friend routes → Friend handlers: dispatches
backend/routes/friendRoute.js - Friend handlers → Friend requests: reads writes
backend/controller/friendController.js - Friend handlers → User accounts: looks up
backend/controller/friendController.js - Friend handlers → Socket server: emits events
backend/controller/friendController.js - Chat workspace → Chat state: uses
frontend/src/pages/ChatPage.jsx - Chat workspace → Friend state: uses
frontend/src/pages/ChatPage.jsx - Chat workspace → Group creation: renders
frontend/src/pages/ChatPage.jsx - Group creation → Chat state: creates group
frontend/src/components/CreateGroupModal.jsx - Group creation → Friend state: selects members
frontend/src/components/CreateGroupModal.jsx - Chat state → HTTP client: requests
frontend/src/store/useChatStore.js - Chat state → E2EE crypto: encrypts decrypts
frontend/src/store/useChatStore.js - Chat state → Auth state: reads session
frontend/src/store/useChatStore.js - Chat state → Socket server: subscribes events
frontend/src/store/useChatStore.js - HTTP client → Message routes: HTTP API
- HTTP client → Conversation routes: HTTP API
- Message routes → JWT guard: guards routes
backend/routes/messageRoute.js - Message routes → Message handlers: dispatches
backend/routes/messageRoute.js - Conversation routes → JWT guard: guards routes
backend/routes/conversationRoute.js - Conversation routes → Conversation handlers: dispatches
backend/routes/conversationRoute.js - Message handlers → Messages: reads writes
backend/controller/messageController.js - Message handlers → Conversations: reads writes
backend/controller/messageController.js - Message handlers → User accounts: looks up
backend/controller/messageController.js - Message handlers → Socket server: emits messages
backend/controller/messageController.js - Message handlers → Cloudinary files: uploads files
backend/controller/messageController.js - Conversation handlers → Conversations: reads writes
backend/controller/conversationController.js - Socket server → Messages: updates read state
backend/lib/socket.js - Socket server → User: notifies online
backend/lib/socket.js