Sealearn is built to be learned together. Beyond individual progress, the platform offers a complete social layer: you can add friends, compare your XP on a friends-only leaderboard, chat in real time, challenge friends to duels from inside a conversation, and customise your public profile with uploaded avatars and banners. Every social interaction is designed to reinforce the learning habit by keeping the community visible and active.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/DerBasilisk/SEA-ServicioEvaluaconAsistida/llms.txt
Use this file to discover all available pages before exploring further.
Friend System
Send, accept, and reject friend requests. Friends appear in your leaderboard and are available to challenge to duels. The
Friendship model tracks the state of every pair.Friends Leaderboard
A ranked view of your friends’ total XP — the same
xp field from the User model, filtered to your accepted friendships. Motivates consistent practice through friendly rivalry.Real-Time Chat
A Socket.IO
/chat namespace powers one-on-one messaging. Conversations persist in MongoDB and duel results are posted automatically as special duel_result messages.Public Profiles
Every user has a shareable profile page showing their level, league, streak, achievements, active frame, and active background. Searchable by username.
Friend System
Friendships are modelled as a directedFriendship document:
{ requester, recipient } prevents duplicate requests. The full friendship flow:
- Send request —
POST /api/friends/requestcreates aFriendshipwithstatus: "pending". - Accept —
PUT /api/friends/:id/acceptsetsstatus: "accepted". Both users now appear in each other’s friends lists. - Reject —
PUT /api/friends/:id/rejectsetsstatus: "rejected". - Remove friend —
DELETE /api/friends/:iddeletes theFriendshipdocument entirely.
accepted friendships are counted for leaderboard ranking and duel invitations.
Friends Leaderboard
The friends leaderboard queries allaccepted Friendship documents where the current user is either requester or recipient, collects the friend user IDs, and returns those users sorted by xp descending. The current user is also included in the ranking so the student can see where they stand relative to their circle.
Public Profiles
Any authenticated user can view another user’s public profile:User model:
| Field | Source |
|---|---|
username / displayName | User model |
avatar / banner | Cloudinary URLs |
xp, level, xpProgress | User model + virtual |
league | User model |
streak.current, streak.longest | User model |
achievements | Populated Achievement refs |
activeFrame | Populated ShopItem ref |
activeBackground | Populated ShopItem ref |
duelsStats | User model |
User Search
username field. Returns a list of public user summaries (avatar, username, level, league) so that students can discover and add new friends.
Real-Time Chat
Chat is handled by a dedicated Socket.IO namespace (/chat). Like the duel socket, it authenticates via JWT on handshake. Each conversation corresponds to a Conversation document linking two user IDs; messages are stored in a Message collection.
REST endpoint for conversation list:
/chat namespace:
| Event | Direction | Description |
|---|---|---|
chat:message | Server → Client | New message delivered to the conversation room conv:<conversationId> |
chat:send | Client → Server | Send a new text message |
chat:read | Client → Server | Mark messages in a conversation as read |
Duel Invites via Chat
Players can initiate a duel directly from a chat conversation by sending aduel:invite event that includes the conversationId. When the duel concludes, a duel_result message is automatically posted to the conversation by the server:
duelData payload with winnerName, loserName, correct answer counts, total questions, and duration in seconds — allowing the frontend to render a rich result card inside the chat thread.
Avatar and Banner Customisation
Profile images are hosted on Cloudinary. Avatars and banners are updated through the general profile update endpoint:| Method | Endpoint | Description |
|---|---|---|
PUT | /api/profile/ | Update profile fields including avatar and banner (Cloudinary URLs). Also supports displayName, dailyGoal, and notification preferences. |
PUT | /api/profile/password | Change the authenticated user’s password. |
activeFrame and activeBackground fields reference ShopItem documents purchased with gems, letting students further personalise how their profile appears to the rest of the community.