Overview
SkillRise’s community platform enables peer-to-peer learning through groups, posts, and replies. Students can ask questions, share knowledge, and build connections with fellow learners.Community Architecture
Data Models
Group Schema
server/models/Group.js
Groups use URL-friendly slugs generated from names, with automatic uniqueness checking.
Community Post Schema
server/models/CommunityPost.js
Reply Schema
server/models/Reply.js
Upvotes are stored as arrays of user IDs, allowing efficient membership checks and preventing duplicate votes.
Group Management
List All Groups
server/controllers/communityController.js
1
Fetch Groups
Retrieve all groups, sorting official groups first, then by member count.
2
Check Memberships
Query memberships for the authenticated user to determine joined status.
3
Enrich Response
Add
isMember flag to each group for UI rendering.Create Group
server/controllers/communityController.js
Toggle Membership
server/controllers/communityController.js
Post Management
Create Post
server/controllers/communityController.js
Posts can belong to a group or be posted globally (groupId: null). Tags are limited to 5 per post.
Get Posts with Filters
server/controllers/communityController.js
1
Build Query
Filter by group, my groups, or all posts based on tab selection.
2
Sort Strategy
Use aggregation for trending (upvote count) or simple sort for recent posts.
3
Pagination
Implement limit/skip pagination with hasMore flag for infinite scroll.
4
Enrich Data
Add user-specific flags (isAuthor, isUpvoted) and hide sensitive data.
Post Enrichment Helper
server/controllers/communityController.js
The enrichment helper strips the upvotes array and authorId for privacy while adding computed flags for UI rendering.
Reply System
Create Reply
server/controllers/communityController.js
Get Post with Replies
server/controllers/communityController.js
Accepted answers always appear first in the reply list, followed by chronological order.
Upvoting System
Toggle Post Upvote
server/controllers/communityController.js
Toggle Reply Upvote
server/controllers/communityController.js
Accepted Answers
Accept Answer (Post Author Only)
server/controllers/communityController.js
1
Authorization Check
Verify the requester is the post author.
2
Clear Previous Answers
Unaccept all other answers for the post.
3
Mark Answer
Set the selected reply as the accepted answer.
4
Resolve Post
Mark the post as resolved when an answer is accepted.
Community Features
Groups
Topic-based communities with membership tracking and post counts.
Posts
Questions and discussions with tags, upvotes, and resolved status.
Replies
Threaded responses with accepted answer functionality.
Upvoting
Community-driven content ranking for posts and replies.
Tags
Topic classification with up to 5 tags per post.
Resolution
Question resolution system with accepted answers.
Tabs and Filters
All Posts (Default)
All Posts (Default)
Shows all posts across all groups, sorted by most recent.
Trending
Trending
Posts sorted by upvote count, then by creation date.
My Groups
My Groups
Only shows posts from groups the user has joined.
Group Filter
Group Filter
Filter posts to a specific group using the groupId query parameter.
Pagination
The community uses limit/skip pagination with 15 posts per page:hasMore flag for infinite scroll:
Best Practices
Privacy Protection
Strip upvote arrays and author IDs from responses to protect user privacy.
Denormalized Counts
Store memberCount, postCount, and replyCount for efficient queries.
Composite Indexes
Use compound indexes on groupId + createdAt for optimal query performance.
Author-Only Actions
Verify ownership before allowing delete, edit, or accept answer operations.
Content Limits
- Group names: 60 characters
- Group descriptions: 200 characters
- Post titles: 200 characters
- Post content: 5,000 characters
- Reply content: 3,000 characters
- Tags per post: 5
Next Steps
Authentication
Understand user roles and access control
AI Features
Leverage AI for personalized learning assistance
Analytics
Track engagement and learning patterns