Skip to content

Implement group chat creation and basic group messaging #16

@Ashmit-Aryan

Description

@Ashmit-Aryan

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:

  1. Create a new group chat.
  2. Add members to the group during creation.
  3. View the group in their chat list.
  4. Send and receive messages within the group.
  5. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions