Feature: Implement Group Chat Creation
Description
The application currently supports only one-to-one messaging. A group chat feature should be implemented to allow multiple users to communicate within a shared chat room.
Users should be able to create a group, add participants, and exchange messages in real time using the existing WebSocket infrastructure.
Expected Behavior
Users should be able to:
- Create a new group chat.
- Add members to the group during creation.
- View the group in their chat list.
- Send and receive messages within the group.
- Receive real-time updates through WebSocket events.
Group chats should behave similarly to direct chats but support multiple participants.
Current Behavior
- The application only supports direct one-to-one messaging.
- There is no concept of group conversations.
- No database schema or socket logic exists for multi-user chat rooms.
Proposed Solution
Database Design
Create a Group collection.
Example schema:
{
name: String,
admin: ObjectId,
members: [ObjectId],
createdAt: Date
}
Group messages can either:
- Use a separate
groupId field in the messages collection
- Or use a dedicated group message collection.
Backend (Node.js + Express)
Add endpoints such as:
POST /api/groups
GET /api/groups
GET /api/groups/:groupId
POST /api/groups/:groupId/add-member
POST /api/groups/:groupId/remove-member
Responsibilities:
- Create group
- Store group metadata
- Manage members
- Fetch group chats for a user
WebSocket / Socket.IO
Use socket rooms to manage group messaging.
Example flow:
- Join group room when user opens group chat
- Broadcast messages to all members
Example:
socket.join(groupId)
io.to(groupId).emit("group_message", message)
Acceptance Criteria
- Users can create a group chat.
- Multiple users can participate in the same conversation.
- Messages are delivered in real time using WebSocket.
- Groups appear in the chat list alongside direct chats.
Environment
Backend: Node.js
Framework: Express
Database: MongoDB
Realtime: Socket.IO
Frontend: React + Zustand + TailwindCSS
Feature: Implement Group Chat Creation
Description
The application currently supports only one-to-one messaging. A group chat feature should be implemented to allow multiple users to communicate within a shared chat room.
Users should be able to create a group, add participants, and exchange messages in real time using the existing WebSocket infrastructure.
Expected Behavior
Users should be able to:
Group chats should behave similarly to direct chats but support multiple participants.
Current Behavior
Proposed Solution
Database Design
Create a
Groupcollection.Example schema:
Group messages can either:
groupIdfield in the messages collectionBackend (Node.js + Express)
Add endpoints such as:
Responsibilities:
WebSocket / Socket.IO
Use socket rooms to manage group messaging.
Example flow:
Example:
Acceptance Criteria
Environment
Backend: Node.js
Framework: Express
Database: MongoDB
Realtime: Socket.IO
Frontend: React + Zustand + TailwindCSS