feat: add message reactions (backend model + route + frontend component) #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Description
What:
Adds message reactions (emoji + counts) to messages, with real-time updates via Socket.IO.
Why:
Reactions are a common UX pattern and increase engagement; small server changes and a lightweight frontend component add a lot of value.
Changes:
backend/models/Message.js — add reactions subdocument (emoji, count, optional users).
backend/routes/reactions.js — new endpoint POST /api/reactions/toggle.
frontend/src/components/MessageReactions.jsx — React component with optimistic updates + socket subscription.
Optional migration script and Jest test included.
Fixed file casing for model: Message.js → consistent with imports.
How to test:
Start backend + frontend.
Open two browser windows and join same conversation.
Click emoji on a message — reactions should update in both windows in real-time.
#open source connect india'25 contributor