Skip to main content

Social Graph, Feed, Stories, And Mentions

Quick Answer

Social features live mainly in src/core/socialgraph, with related modules in src/core/mentions, src/core/media, and src/core/user-reporting.

This area powers social network, Instagram-style, TikTok-style, dating, chat, and community features: posts, comments, reactions, stories, friends, user search, profile feeds, hashtags, and mentions.

Source Map

src/core/socialgraph
|-- feed
| |-- api
| `-- redux
`-- friendships
|-- api
|-- helpers
`-- redux

src/core/mentions
|-- IMMentionList
|-- IMRichTextInput
`-- IMRichTextView

Important feed hooks:

HookPurpose
useHomeFeedPostsHome feed subscription/fetch.
useDiscoverPostsDiscover feed.
useProfileProfile feed and profile data.
usePostSingle post read.
usePostMutationsCreate, edit, delete, or update posts.
useCommentMutationsCreate or update comments.
useStoriesStory reads.
useStoryMutationsStory writes.
useHashtagPostsHashtag feed.

Important friendship hooks:

HookPurpose
useSocialGraphFriendsCurrent user's friends.
useSocialGraphFriendshipsFriend request state.
useSocialGraphMixedFriendshipsMixed friend/request views.
useSocialGraphMutationsSend, accept, reject, or remove relationships.
useSearchUsersFind friends/user search.

Backend Providers

The active social provider is selected inside:

src/core/socialgraph/feed/api/index.js
src/core/socialgraph/friendships/api/index.js

Firebase and AWS provider exports exist in the generator. Keep one provider active per generated app.

Media Upload In Feed

New posts and stories often use:

src/core/camera
src/core/media
src/core/socialgraph/feed

When debugging failed post creation, separate these stages:

  1. text validation;
  2. media selection;
  3. media validation;
  4. media upload;
  5. feed document creation;
  6. feed subscription refresh.

Security And Cost Controls

Social apps can become expensive or unsafe if reads and writes are unbounded. Review:

  • Firestore indexes for feed queries;
  • pagination or capped page sizes;
  • blocked-user filtering;
  • report/block flows;
  • upload limits for media posts and stories;
  • Function triggers that fan out feed or notification records;
  • rate limiting for comments, likes, follows, and search.

Verification Checklist

Test:

  • home feed empty state;
  • home feed with data;
  • create text-only post;
  • create image post;
  • create story if enabled;
  • comment creation;
  • reaction/like creation;
  • profile feed;
  • discover feed;
  • user search;
  • send/accept/remove friend;
  • blocked users are filtered from feeds and search.

Troubleshooting

ProblemFix
Feed loads foreverCheck hook error handling, Firestore rules, and required indexes.
Post succeeds but does not appearCheck feed query filters, created timestamps, and subscription refresh.
Image post failsDebug src/core/media before changing feed code.
User search is slow or expensiveAdd backend search strategy, indexing, pagination, and rate limits.
Blocked user content still appearsConfirm user-reporting data is included in feed filtering.