Skip to main content

Posts Feature

The Posts feature is the core of Bellamy Book, allowing users to create, share, and interact with content in their social network.

Overview

Posts enable users to:

  • Share text, images, and videos
  • Control who can see their content (privacy settings)
  • Engage with content through reactions and comments
  • Share posts with their network
  • View personalized feed based on relevance algorithm

Creating Posts

The backend uses api/Post (ASP.NET controller-based routing). Create post is multipart/form-data with caption, visibility, and optional mediaFiles; optional mentions (JSON string).

Text Posts

Create a simple text post:

POST /api/Post/users/{userId}
Authorization: Bearer {token}
Content-Type: multipart/form-data

FormData:
- caption: "Hello, world!"
- visibility: "Public"

Response:

{
"success": true,
"data": {
"id": "post-123",
"content": "Hello, world!",
"author": {
"id": "user-456",
"fullName": "John Doe",
"username": "johndoe",
"avatar": "https://..."
},
"privacy": "public",
"createdAt": "2024-01-01T12:00:00Z",
"updatedAt": "2024-01-01T12:00:00Z",
"reactionCount": 0,
"commentCount": 0,
"shareCount": 0,
"media": []
}
}

Posts with Images

Upload one or multiple images:

POST /api/Post/users/{userId}
Authorization: Bearer {token}
Content-Type: multipart/form-data

FormData:
- caption: "Check out this photo!"
- visibility: "Friends"
- mediaFiles: [file1.jpg, file2.jpg]

Supported Image Formats:

  • JPEG/JPG
  • PNG
  • GIF
  • WebP

Image Requirements:

  • Maximum file size: 10MB per image
  • Maximum images per post: 10
  • Automatic image optimization and resizing

Posts with Videos

Upload video content:

POST /api/Post/users/{userId}
Authorization: Bearer {token}
Content-Type: multipart/form-data

FormData:
- caption: "Watch this video!"
- visibility: "Public"
- mediaFiles: [video.mp4]

Supported Video Formats:

  • MP4
  • WebM
  • MOV

Video Requirements:

  • Maximum file size: 100MB per video
  • Maximum videos per post: 1
  • Automatic video processing and thumbnail generation
  • Video encoding for web playback

Rich Text Formatting

Posts support basic formatting:

  • Bold text: **bold** or *bold*
  • Italic text: *italic* or _italic_
  • Links: [text](url)
  • Mentions: @username
  • Hashtags: #hashtag

Privacy Settings

Control who can see your posts:

Privacy Levels

LevelDescriptionVisibility
PublicVisible to everyoneAll users, including non-friends
FriendsVisible to friends onlyOnly confirmed friends
Only MePrivate postOnly the author
CustomSpecific friend listsSelected friend lists only

Setting Privacy

{
"content": "My post content",
"privacy": "friends", // or "public", "only_me", "custom"
"friendListIds": [] // Required if privacy is "custom"
}

Privacy Best Practices

  • Use "Public" for general announcements
  • Use "Friends" for personal updates
  • Use "Only Me" for drafts or private notes
  • Use "Custom" for specific groups or lists

Post Interactions

Viewing Posts

Get Your Feed (personalized):

GET /api/Post/feed/home?userId={userId}&limit=20&offset=0

Get User's Posts:

GET /api/Post/users/{userId}/posts?page=1&limit=20

Get Single Post:

GET /api/Post/{postId}

Response includes:

  • Post content and metadata
  • Author information
  • Reaction counts and user reactions
  • Comment count
  • Share count
  • Media attachments

Reacting to Posts

Add a reaction to express your feelings (reactions use api/Reaction or post-specific endpoints):

POST /api/Post/{postId}/reactions // or api/Reaction endpoint
Authorization: Bearer {token}
Content-Type: application/json

{
"type": "like" // "like", "love", "haha", "dislike", "share"
}

Reaction Types: Like, Love, Haha, Dislike, Share. The View type is used internally for tracking views.

Remove Reaction: DELETE /api/Post/{postId}/reactions (or equivalent Reaction endpoint)

Commenting

Add comments (Comments use api/Comment):

POST /api/Comment // or POST /api/Comment/{postId}
Authorization: Bearer {token}
Content-Type: application/json

{
"content": "Great post!",
"parentCommentId": null // For nested/reply comments
}

Get Comments: GET /api/Comment/{postId}/comments?page=1&limit=20 (or equivalent)

Sharing Posts

Share posts with your network:

POST /api/Post/{postId}/share
Authorization: Bearer {token}
Content-Type: application/json

{
"content": "Check this out!",
"visibility": "Friends"
}

Post Management

Editing Posts

Edit your own posts:

PUT /api/Post/{postId}
Authorization: Bearer {token}
Content-Type: application/json or multipart/form-data

{
"caption": "Updated content",
"visibility": "Public"
}

Limitations:

  • Can only edit your own posts
  • Cannot edit after 24 hours (configurable)
  • Media cannot be changed after posting

Deleting Posts

Delete your posts:

DELETE /api/Post/{postId}
Authorization: Bearer {token}

What happens:

  • Post is removed from all feeds
  • Comments and reactions are also deleted
  • Media files are deleted from storage
  • Action is permanent and cannot be undone

Post Visibility

Who can see your post:

  • Depends on privacy setting
  • Friends can see "Friends" posts
  • Public posts appear in search results
  • Custom privacy respects friend list settings

Feed Algorithm

The feed uses a sophisticated relevance scoring system to show you the most interesting content.

Scoring Factors

  1. User Interactions (40%)

    • Posts from users you frequently interact with
    • Content you've previously liked or commented on
  2. Post Recency (25%)

    • Newer posts ranked higher
    • Time decay factor applied
  3. Friend Relationships (20%)

    • Posts from close friends
    • Mutual friends' posts
  4. Content Quality (10%)

    • Engagement metrics (reactions, comments)
    • Content length and media presence
  5. User Preferences (5%)

    • Followed topics and hashtags
    • Content type preferences

Feed Customization

Sort Options:

  • relevance - Algorithm-based (default)
  • recent - Most recent first
  • popular - Most engagement first
  • following - Only followed users

Filter Options:

  • Filter by post type (text, image, video)
  • Filter by date range
  • Filter by author

Post Types

Standard Post

Regular text, image, or video post.

Shared Post

When you share someone else's post:

  • Original post is embedded
  • You can add your own comment
  • Maintains original privacy settings

Story Post

Temporary posts that expire after 24 hours:

  • Appears at top of feed
  • Cannot be edited after posting
  • Automatically deleted after expiration

Media Handling

Image Processing

  • Automatic resizing for thumbnails
  • Multiple size variants (thumbnail, medium, large)
  • Lazy loading for performance
  • Progressive image loading

Video Processing

  • Automatic encoding for web playback
  • Thumbnail generation
  • Multiple quality levels
  • Streaming support for large videos

Storage

  • Local storage or cloud storage (S3)
  • CDN integration for fast delivery
  • Automatic cleanup of orphaned media

Best Practices

Creating Engaging Posts

  • Use clear, concise language
  • Include relevant images or videos
  • Use appropriate hashtags
  • Engage with comments

Privacy Considerations

  • Review privacy settings before posting
  • Be mindful of sensitive information
  • Use "Friends" for personal content
  • Use "Public" for general announcements

Performance Tips

  • Optimize images before uploading
  • Use appropriate file sizes
  • Avoid posting too frequently (rate limiting)
  • Use pagination when loading feeds

API Reference

For complete API documentation: