Overview
Topics and posts are the core building blocks of the forum system. Topics represent discussion threads, while posts contain the actual content and replies.Creating Topics
Using the useForum Hook
Server Action
ThecreateForumTopic server action handles topic creation:
src/lib/actions/forum/topics.ts
Fetching Topics
Get Topics with Pagination
Get Single Topic
Creating Posts (Replies)
Reply to a Topic
Server Action for Posts
src/lib/actions/forum/posts.ts
Upvoting Topics
Users can upvote topics to show support and surface quality content.Upvote a Topic
Get Upvote Count
Voting Power Requirements
Content Moderation
Automatic NSFW Detection
All content is automatically moderated using the OpenAI moderation API:Soft Delete
Admins can soft delete content, which hides it but allows recovery:src/lib/actions/forum/topics.ts
Restore Deleted Content
src/lib/actions/forum/topics.ts
Archive Topics
Archiving removes topics from active view but preserves them:Data Structure
- Topic Object
- Post Object
Best Practices
Always verify signatures
Always verify signatures
Every write operation requires wallet signature verification to prevent unauthorized actions.
Check voting power
Check voting power
Verify users have sufficient voting power before allowing topic creation or posting.
Moderate content automatically
Moderate content automatically
Run content through moderation before saving to maintain community standards.
Index asynchronously
Index asynchronously
Don’t block user responses waiting for search indexing - run it asynchronously.
Handle NSFW gracefully
Handle NSFW gracefully
Filter NSFW content from public queries but preserve it for admin review.
Next Steps
Reactions
Add emoji reactions and engagement features
Attachments
Enable file uploads and IPFS storage
Moderation
Set up admin controls and content moderation
Search
Implement full-text search functionality