How arpitve560/chatflow works
iychat is a real-time chat and social application. Users register or log in, find people, open conversations, and exchange messages; they can also manage profiles, follow requests, and notifications. The client communicates with an Express API and a Socket.io channel; server controllers handle authenticated requests and persist domain state in MongoDB. The sampled source supports the message, follow, and user flows directly. Other client and notification wiring is represented only where paths and documented capabilities support it.
Main entry points: app.js Express app · api.js HTTP client · followController.js Follow requests · User.js User records
Components 27
Web client
- Login and register
client/src/app/login/page.js - Chat screen
client/src/app/chat/page.js - Auth state
client/src/context/AuthContext.js - Conversation list
client/src/components/ChatList.js - Message view
client/src/components/ChatWindow.js - Profile panel
client/src/components/ProfilePanel.js - Notifications panel
client/src/components/NotificationPanel.js - HTTP client
client/src/lib/api.js - Socket client
client/src/lib/socket.js
HTTP API
- Express app
server/src/app.js - Auth routes
server/src/routes/authRoutes.js - User routes
server/src/routes/userRoutes.js - Message routes
server/src/routes/messageRoutes.js - Authentication
server/src/controllers/authController.js - User and profile
server/src/controllers/userController.js
Social features
- Follow routes
server/src/routes/followRoutes.js - Notification routes
server/src/routes/notificationRoutes.js - Follow requests
server/src/controllers/followController.js - Notification handling
server/src/controllers/notificationController.js
Realtime messaging
- Conversation handling
server/src/controllers/messageController.js - Socket events
server/src/socket/socketHandler.js
Persistent data
- User records
server/src/models/User.js - Message records
server/src/models/Message.js - Follow requests
server/src/models/FollowRequest.js - Notifications
server/src/models/Notification.js
Other components
- User
- MongoDB
Connections 39
- User → Login and register: registers or logs in
- User → Chat screen: uses
- Chat screen → Conversation list: shows
- Chat screen → Message view: opens
- User → Profile panel: manages profile
- User → Notifications panel: views alerts
- Login and register → Auth state: updates auth state
- Auth state → HTTP client: uses
- Conversation list → HTTP client: requests conversations
- Message view → HTTP client: loads and sends messages
- Profile panel → HTTP client: requests profile
- Notifications panel → HTTP client: requests notifications
- Message view → Socket client: exchanges events
- HTTP client → Express app: sends HTTP requests
- Express app → Auth routes: mounts
- Express app → User routes: mounts
- Express app → Message routes: mounts
- Express app → Follow routes: mounts
- Express app → Notification routes: mounts
- Auth routes → Authentication: dispatches
- User routes → User and profile: dispatches
- Message routes → Conversation handling: dispatches
- Follow routes → Follow requests: dispatches
- Notification routes → Notification handling: dispatches
- Authentication → User records: reads and writes
- User and profile → User records: reads and writes
- User and profile → Follow requests: reads
- Conversation handling → Message records: reads and writes
- Follow requests → Follow requests: reads and writes
- Follow requests → User records: looks up users
- Follow requests → Notifications: creates notifications
- Notification handling → Notifications: handles notifications
- Socket events → Socket client: dispatches events
- Conversation handling → Socket events: looks up online users
- Socket events → Follow requests: provides online map
- User records → MongoDB: persists
- Message records → MongoDB: persists
- Follow requests → MongoDB: persists
- Notifications → MongoDB: persists