- To Do List
- Websockets
- Rooms
- QueryClient
- Context
How does our Chat works
All chat related information are stored into database in different tables:
- chat: stores all chats (private and group)
- privateChat: stores all private chat (created at friendship creation) to ensure only 1 conversation is created per friendship
- chatMessage: stores all messages, the chat they have been posted to, and their author
- chatInvitation: stores all invitations send to user to join a chat, and their status
- chatMember: stores all members of each chat, meaning there are as many rows per user in this table as there are conversations of which they are a member
- chatRole: stores user role for every conversation they are part of
- chatBan: stores a list of ban users per chat
The backend runs the Socket.IO server, enforces auth and permissions, persists messages and emits events.
The frontend runs the Socket.IO client, manages room membership and local UI updates.
We’ve created a ChatContext for chat-level UI and logic state:
- store the current chat metadata (Id, chatName, chatType….)
- store user role (owner, admin, moderator, writer, member)
- store permissions (canModerate, canInvite, canKick, canWrite, canRename….)
- store typing users
- join/leave chat rooms
- handle chat‑level socket events (typing, invitations, role changes…)