Blog Platform

The LoopingBinary blog platform allows administrators and superadmins to create, publish, and manage blog posts. Users can engage with posts through likes, comments, and sharing, with real-time notifications for new content.

What is the Blog Platform?

A comprehensive content management system for admins to publish articles, announcements, and updates. Users can discover, read, like, comment, and share blog posts. All users receive notifications when new posts are published.

How the Blog Platform Works

1

Create & Publish Posts

Admins and Superadmins can create blog posts with titles, content, excerpts, and featured images. Posts can be saved as drafts or published immediately.

2

Automatic Notifications

When a post is published, all active users automatically receive both in-app and email notifications about the new content.

3

User Engagement

Users can like posts, add comments with nested replies, and share posts via direct links. All engagement is tracked and displayed in real-time.

4

Content Management

Admins can manage all posts through a dedicated management interface, including editing, publishing, archiving, and deleting posts. View statistics like views, likes, and comments.

Key Features

Rich Content Editor

Create posts with rich text content, markdown support, and featured images uploaded to Cloudinary.

View Tracking

Posts automatically track view counts, incrementing each time a user views the full post content.

Like System

Users can like posts and comments. Like counts are calculated in real-time from the database to ensure accuracy.

Nested Comments

Users can comment on posts and reply to comments, creating threaded discussions. Comments can also be liked.

Share Functionality

Users can copy and share direct links to blog posts. Share counts are tracked for analytics.

Real-time Notifications

All users receive push and email notifications when new posts are published, ensuring maximum reach.

Post Statuses

Posts can be saved as DRAFT, published as PUBLIC, or archived. Only published posts are visible to regular users.

Analytics & Statistics

Track views, likes, comments, and shares for each post. Admins can see comprehensive statistics in the management dashboard.

Post Statuses

DRAFT

Post is saved but not published. Only visible to admins in the management dashboard. Can be edited and published later.

PUBLISHED

Post is live and visible to all users. Automatically triggers notifications to all users when first published. Can be viewed, liked, commented on, and shared.

ARCHIVED

Post is archived and hidden from public view but preserved for record-keeping. Only visible to admins in the management dashboard.

Admin Features

Blog Management Dashboard

Admins and Superadmins have access to a comprehensive blog management interface at /dashboard/admin/blog.

  • View all posts (draft, published, archived)
  • Create, edit, and delete posts
  • Publish or unpublish posts
  • Archive posts
  • View statistics (views, likes, comments)
  • Search and filter posts

Content Creation

  • Rich text editor for content
  • Featured image upload via Cloudinary
  • Excerpt generation
  • Save as draft or publish immediately
  • Edit published posts

User Features

Like Posts

Click the like button on any published post to show appreciation. Like counts are displayed in real-time.

Comment & Reply

Add comments on posts and reply to other comments. Create threaded discussions. Like comments to show support.

Share Posts

Copy and share direct links to blog posts. Share counts are tracked for analytics.

Get Notified

Receive in-app and email notifications when new posts are published. Stay updated with platform announcements and updates.

Featured Images

Featured images are uploaded to Cloudinary and stored in the loopingbinary/blog folder. Images are optimized and served via CDN for fast loading. Supported formats: JPG, PNG, WebP. Max size: 10MB.

API Reference

The blog platform provides RESTful APIs for managing posts, likes, comments, and shares. All endpoints require authentication via Bearer token, except public GET requests for published posts.

Blog Posts Endpoints

GET/api/blog/posts- List published posts (all statuses for admins)
POST/api/blog/posts- Create post (ADMIN/SUPERADMIN)
GET/api/blog/posts/[id]- Get post details
PATCH/api/blog/posts/[id]- Update post (ADMIN/SUPERADMIN)
DELETE/api/blog/posts/[id]- Delete post (ADMIN/SUPERADMIN)

Likes & Comments Endpoints

POST/api/blog/posts/[id]/like- Like a post
DELETE/api/blog/posts/[id]/like- Unlike a post
GET/api/blog/posts/[id]/comments- Get post comments
POST/api/blog/posts/[id]/comments- Add comment
POST/api/blog/comments/[id]/like- Like a comment

Image Upload Endpoint

POST/api/blog/images/upload- Upload featured image (ADMIN/SUPERADMIN)

Example Usage

Fetching Published Posts

const response = await fetch('/api/blog/posts?limit=10&offset=0', {
  headers: {
    'Authorization': `Bearer ${token}`
  }
});

const data = await response.json();
console.log(data.posts); // Array of published posts

Creating a Blog Post

const response = await fetch('/api/blog/posts', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    title: 'My New Post',
    content: 'Post content here...',
    excerpt: 'Brief description',
    featuredImageUrl: 'https://cloudinary.com/image.jpg',
    status: 'PUBLISHED' // or 'DRAFT'
  })
});

const post = await response.json();

Liking a Post

const response = await fetch('/api/blog/posts/[postId]/like', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`
  }
});

const data = await response.json();
console.log(data.likes_count); // Updated like count