Oouhammmourachid /
Public
ouhammmourachid / feedback-board
PublicPublic feedback board for your product: users post ideas and bugs, upvote once each, and comment. You set the status (planned, in progress, done) from the dashboard.
- SaaS starter
- 0 deploys
- 0 forks
Feedback Board: feature requests, votes and comments
Public feedback board for your product: users post ideas and bugs, upvote once each, and comment. You set the status (planned, in progress, done) from the dashboard.
What you get
- One vote per user per post, enforced by a unique index
- Vote counts kept on the post, so you can sort by
-vote_count - Statuses: open, planned, in progress, done, declined (admin only)
- Anyone can read; signed-in users post, vote and comment
- Authors can edit their post while you haven't changed its status
Collections
posts
| Field | Type | Notes |
|---|---|---|
title (required) | text | |
details | text | |
category (required) | select | feature, bug, improvement |
status | select | Set by an admin |
author (required) | relation → users | Set by a hook to the signed-in user |
vote_count | number | Kept by the server |
| Action | Who can do it |
|---|---|
| List / view | anyone |
| Create | signed-in users |
| Update | author = @request.auth.id && status = 'open' |
| Delete | author = @request.auth.id && status = 'open' |
votes
| Field | Type | Notes |
|---|---|---|
post (required) | relation → posts | |
user (required) | relation → users | Set by a hook to the signed-in user |
| Action | Who can do it |
|---|---|
| List / view | user = @request.auth.id |
| Create | signed-in users |
| Update | superusers only |
| Delete | user = @request.auth.id |
comments
| Field | Type | Notes |
|---|---|---|
post (required) | relation → posts | |
author (required) | relation → users | Set by a hook to the signed-in user |
body (required) | text |
| Action | Who can do it |
|---|---|
| List / view | anyone |
| Create | signed-in users |
| Update | author = @request.auth.id |
| Delete | author = @request.auth.id |
Hooks
All hooks are in pb_hooks/main.pb.js and commented.
Quick start
import PocketBase from "pocketbase"
const pb = new PocketBase("https://YOUR-INSTANCE.pocketshub.com")
const top = await pb.collection("posts").getList(1, 20, { sort: "-vote_count", filter: "status != 'declined'" })
const post = await pb.collection("posts").create({ title: "Dark mode", category: "feature" })
await pb.collection("votes").create({ post: post.id }) // vote
await pb.collection("comments").create({ post: post.id, body: "+1, please!" })
// Which posts has the signed-in user voted on?
const myVotes = await pb.collection("votes").getFullList()
Notes
- To remove a vote, delete the user's vote record. The count updates by itself.
License
MIT
3 collections, 2 relations. Hover a collection to trace its relations