Skip to content

Connect (Messaging)

RoutePurpose
/connectChat inbox with sidebar
/connect/[id]Individual chat thread

TypeDescription
DIRECTOne-on-one conversation
GROUPMulti-user chat
ONE_TO_ONEAlternative direct chat
ORDEROrder-related communication
SYSTEMSystem-generated messages

  • Sorted by updatedAt (newest first)
  • Max height 420px with scroll
  • Tabs: All, Requests, Archive, Spammed, Blocked
  • Unread count badges on tabs

  • Multi-line textarea (40-200px auto-height)
  • Enter to submit, Alt+Enter for newline
  • File attachment (drag-drop or click)
  • Emoji picker
  • Voice recording (browser microphone API, stored as MP3)

text, image, file, voice, video, mix, link-dispute, system

  • Type @ to trigger autocomplete dropdown
  • Searches chat members by displayName and email (case-insensitive)
  • Stored as @{userId} in message, displayed as @{displayName}
  • Creates notification in users/{uid}/mentions/{messageId}
  • Full emoji picker on hover
  • Stored as reactions: { emoji: [userId1, userId2, ...] }
  • Show count per emoji, highlight user’s own reactions
  • Single check (gray): sent
  • Double check (purple): read
  • Auto-marked read when chat is viewed (readBy array)
  • Available for sender only
  • Sets isEdited: true flag
  • Updates updatedAt timestamp
  • Delete for me: Adds userId to deletedFor array (others still see it)
  • Delete for all: Removes message entirely (sender only)
  • Confirmation dialog required
  • Replies stored in subcollection: chats/{chatId}/messages/{messageId}/replies
  • Original message shows reply count
  • Thread panel opens on right side
  • Same features: reactions, edits, mentions, quotes
File TypeIconColor
ImagesFile_3dGreen
VideosVideoPrimary
AudioMusicOrange
PDFsFileTextRed
Word docsFileTextBlue
ExcelFileSpreadsheetDark Green
ArchivesArchiveYellow

Storage paths:

  • Files: files/{chatId}/{fileId}
  • Voice: audios/{chatId}/{fileId}
  • Group avatars: groups/{chatId}/avatar

All files tracked in StorageUserService with metadata.


  1. User sends connection request → chat created with status: Requested
  2. Recipient sees in “Requests” tab
  3. Accept: Sets status: Accepted, moves to main tab, adds system message
  4. Decline: Sets status: Declined, stays in requests tab, adds system message

ActionDirectGroup
Archive/UnarchiveYesYes
DeleteYesNo
Leave GroupNoYes
Block UserYesNo
Unblock UserYesNo
Mark as SpamYesNo
Unmark as SpamYesNo
  • Stored at: users/{uid}/blockedUsers/{userId}
  • Data: { isBlocked: true, timestamp, userId }
  • Hides chat from main list
  • Shown in “Blocked” tab with unblock option
  • Stored at: users/{uid}/spammedChats/{userId}
  • User selects criteria: Repetitive Content, Unsolicited Links, High Volume, Suspicious Keywords, Sender Reputation, Inconsistent Metadata, Other
  • Custom reason text field
  • Moves chat to “Spammed” tab

  • Create with name + select multiple members
  • Optional group avatar (5MB max, JPEG/PNG/GIF)
  • Avatar stored at: groups/{chatId}/avatar
  • admins array for admin privileges
  • Leave group removes member + adds system message

  • Real-time via Firebase Realtime Database at presence/{userId}
  • Session objects with status (‘online’|‘away’|‘offline’) and lastSeen
  • Displayed in chat header

DataDescription
Message textExact content
Sender UID, name, photoSender identification
TimestampSeconds + nanoseconds precision
Read receiptsList of UIDs who read
ReactionsEmoji to user mapping
MentionsReferenced user UIDs
Quoted messageReference to replied message
FilesName, size, type, URL, storage path
Edit/delete statusTracked with timestamps
Deleted-for listPer-user deletion tracking