# How to build a forum in Bubble.io: Step-by-Step Guide

- Tool: Bubble
- Difficulty: Beginner
- Time required: 30-35 min
- Compatibility: All Bubble plans
- Last updated: March 2026

## TL;DR

Build a forum in Bubble by creating Data Types for Category, Thread, and Post with proper relationships. Users browse categories, create threads, and post replies in a nested structure. A Repeating Group displays threads sorted by last activity, and conditional formatting highlights unread posts. Add moderation tools for admins to pin, lock, and delete threads.

## Build a Discussion Forum in Bubble

This tutorial walks you through creating a full-featured forum with categories, threads, posts, and moderation. Forums are ideal for community platforms, customer support, and knowledge sharing.

## Before you start

- A Bubble account with user authentication
- Basic understanding of Data Types and relationships
- Familiarity with Repeating Groups and workflows

## Step-by-step guide

### 1. Create Forum Data Types

Go to Data tab and create three types. 'ForumCategory': name (text), description (text), sort_order (number), thread_count (number). 'ForumThread': category (ForumCategory), title (text), author (User), created_date (date), last_activity (date), reply_count (number), is_pinned (yes/no), is_locked (yes/no). 'ForumPost': thread (ForumThread), author (User), content (text), created_date (date), is_first_post (yes/no). The first post in a thread contains the opening message.

**Expected result:** Three interconnected Data Types form the forum structure.

### 2. Build the Category and Thread Listing Pages

Create a 'forum' page with a Repeating Group showing ForumCategories sorted by sort_order. Each cell shows category name, description, and thread_count. Clicking a category navigates to a 'category' page. On the category page, add a Repeating Group of ForumThreads filtered by the current category, sorted by is_pinned descending then last_activity descending. Each row shows title, author, reply_count, and last_activity timestamp.

> Pro tip: Pinned threads always appear at the top by sorting is_pinned descending first.

**Expected result:** Users can browse categories and see threads sorted by activity with pinned threads at top.

### 3. Build the Thread View with Posts

Create a 'thread' page with Type = ForumThread. Display the thread title and a Repeating Group of ForumPosts sorted by created_date ascending. Each post cell shows author name, avatar, post date, and content. The first post (is_first_post = yes) is the opening message. Below the posts RG, add a Multiline Input and 'Reply' button for new posts.

**Expected result:** Users can read all posts in a thread chronologically and submit replies.

### 4. Create the Reply and New Thread Workflows

Reply workflow: When Reply clicked → Create ForumPost (thread = Current Page Thread, author = Current User, content = input value, is_first_post = no) → Make changes to Thread (reply_count +1, last_activity = Current date/time) → Reset input. New thread workflow: on the category page, add a 'New Thread' button that opens a popup with title input and content input. Create ForumThread, then create ForumPost with is_first_post = yes. Update category's thread_count.

**Expected result:** Users can create new threads and reply to existing ones.

### 5. Add Moderation Tools

For users with admin role, add moderation buttons on threads: Pin/Unpin (toggles is_pinned), Lock/Unlock (toggles is_locked — when locked, hide the reply input), Delete (deletes thread and all its posts). On individual posts, add a Delete button for admins. Add a 'Report' button for regular users that creates a Report record for admin review. Use conditional visibility to show mod tools only to admins.

**Expected result:** Admins can pin, lock, and delete threads, and users can report inappropriate content.

### 6. Add User Profiles and Activity Tracking

Display post count next to each author's name in thread view by showing 'Do a Search for ForumPosts (author = post's author):count'. Add a user profile link that shows their forum activity. Optionally track a 'reputation' or 'karma' number on User, incrementing when their posts receive likes.

**Expected result:** Users see post counts and can view other members' forum activity.

## Complete code example

File: `Workflow summary`

```text
DATA TYPES:
- ForumCategory: name, description, sort_order, thread_count
- ForumThread: category, title, author, created_date, last_activity, reply_count, is_pinned, is_locked, views (number)
- ForumPost: thread, author, content, created_date, is_first_post

PAGES:
1. forum — list categories
2. category — list threads in category
3. thread — view posts, reply

KEY WORKFLOWS:
1. New Thread → Create Thread → Create first Post → Update category thread_count
2. Reply → Create Post → Update thread reply_count & last_activity
3. Pin/Unpin → Toggle thread is_pinned
4. Lock/Unlock → Toggle thread is_locked
5. Delete Thread → Delete all Posts in thread → Delete Thread → Update category thread_count
6. Report Post → Create Report record → Notify admin
```

## Common mistakes

- **Not updating last_activity when a reply is posted** — Threads with new replies stay buried at the bottom instead of rising to the top. Fix: Always update the thread's last_activity field to Current date/time in the reply workflow.
- **Counting replies with a search instead of a stored field** — Running a search count for every thread in the listing RG multiplies queries and slows the page. Fix: Store reply_count as a field on ForumThread and increment it in the reply workflow.
- **Not preventing replies on locked threads** — Users can submit replies even after a moderator locks a thread. Fix: Add 'Only when Current Page Thread's is_locked is no' to the reply workflow and hide the reply input on locked threads.

## Best practices

- Store reply_count and thread_count as fields rather than computing with searches for performance.
- Sort threads by is_pinned (desc) then last_activity (desc) for proper forum behavior.
- Use Multiline Input with rich text support for post content.
- Add pagination to thread listings (15-20 per page) and post listings (20-25 per page).
- Implement soft-delete (is_deleted flag) instead of hard-delete for moderation audit trails.
- Send email notifications to thread authors when someone replies to their thread.

## Frequently asked questions

### How do I handle nested/threaded replies?

Add a 'parent_post' field (ForumPost type) on ForumPost. Replies to a specific post reference the parent. Display nested replies with indentation using conditional margins based on nesting depth. Limit nesting to 2-3 levels.

### Can I add rich text formatting to posts?

Yes. Use a rich text editor plugin (like the Rich Text Editor from Bubble or TinyMCE) instead of a plain Multiline Input. Display content using Bubble's rich text display element.

### How do I handle spam and abuse?

Add reporting functionality, auto-moderate new users (require admin approval for first posts), implement word filters, and add rate limiting to prevent rapid posting.

### Should I use real-time updates for forum threads?

Bubble automatically updates Repeating Groups in real-time via WebSocket. New replies appear automatically without refresh. For high-traffic forums, this may increase WU consumption.

### How do I scale a forum with thousands of posts?

Paginate aggressively (20 posts per page), use database constraints instead of :filtered, store counts as fields, and consider caching popular threads. For large-scale communities, RapidDev can architect optimized forum systems.

### Can I add user avatars and badges?

Yes. Add an avatar image field and a badges list field on User. Display the avatar in each post cell. Award badges based on post count, account age, or admin assignment.

---

Source: https://www.rapidevelopers.com/bubble-tutorial/build-a-forum-in-bubble
© RapidDev — https://www.rapidevelopers.com/bubble-tutorial/build-a-forum-in-bubble
