Bookmarks: let people save posts privately

Open
#120 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
express, mongodb, nodejs, react, typescript
Domain
api, full-stack

Research direction

Start with apps/api/src/models/Like.ts as the template for the new Bookmark model, then read apps/api/src/controllers/postController.ts to see how likedSet fills likedByMe. The web side is useToggleLike and patchPost in apps/web/src/hooks/usePosts.ts, with the button in PostCard.tsx. Done means the PUT/DELETE toggle is idempotent, the list hides deleted and banned-author posts, a test shows one user cannot read another's bookmarks, and typecheck and lint pass.

Written by the indexing model from the issue text.

Description

api enhancement help wanted web

Difficulty: Intermediate · Estimated size: 1 to 2 days

Context

People can like and comment on posts, but there is no private way to keep a post to read or use later.

Problem or goal

Add bookmarks. A bookmark is private: only the person who saved it can see it, and the post's author is never told.

Suggested approach

  • API: a Bookmark model (user, post, createdAt) with a unique index on user + post, and a TTL-free index on user + _id for paging.
  • API: PUT /api/posts/:id/bookmark and DELETE /api/posts/:id/bookmark (idempotent, so saving twice is not an error) and GET /api/bookmarks with the same cursor paging as the feeds.
  • Shared: add bookmarkedByMe: boolean to PostDTO and fill it the way likedByMe is filled.
  • Web: a bookmark icon button on the post card (with aria-pressed), a /bookmarks page linked from the left menu, and an empty state.
  • Docs: add a row to docs/LIMITS.md if you add a rate limit.

Where to look

  • apps/api/src/models/Like.ts (a good template)
  • apps/api/src/controllers/postController.ts (likes and likedSet)
  • apps/web/src/hooks/usePosts.ts (useToggleLike and patchPost)
  • apps/web/src/components/PostCard.tsx

Acceptance criteria

  • Saving and unsaving works, survives a refresh and updates every list that shows the post.
  • Deleted posts and posts by banned authors do not appear in the list.
  • Another person can never read your bookmarks (add a test).
  • Paid posts stay locked in the list until bought.
  • New API tests and no typecheck or lint errors.

Out of scope

Folders or collections of bookmarks.

How to work on it

  1. Comment here to claim it, so two people do not do the same work.
  2. Fork the repo and branch from main (feat/short-name or fix/short-name). Setup steps are in docs/DEVELOPMENT.md.
  3. Keep the change focused and add tests for backend logic.
  4. Run npm run typecheck, npm test and npm run lint and npm run format before opening the pull request.
  5. Use a Conventional Commits title (for example feat(web): add bookmarks). More in CONTRIBUTING.md.

Stuck? Ask in this issue. Questions are welcome.


Generated by Claude Code

Dominant language
TypeScript
Stars
6
Forks
6
Avg merge
1h 59m
Merged PRs (30d)
59

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Haseeb-MernStack/commune

All issues in Haseeb-MernStack/commune

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.