Skip to content

q225/scribeboard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ ScribeBoard API

A full-fledged Blog CMS Backend Service with authors, posts, categories, comments, drafts, and publishing workflows.

✨ Features

  • User Roles: Admin, Editor, Author, Reader
  • Blog Posts: Full CRUD with rich content support
  • Publishing Workflow: Draft β†’ Review β†’ Publish β†’ Unpublish
  • Categories & Tags: Organize content effectively
  • Comment System: Nested comments with moderation
  • Search & Filter: Find posts by category, tag, author, or keyword
  • Pagination: Efficient data loading
  • Revision History: Track post changes

πŸ› οΈ Tech Stack

Technology Purpose
Node.js Runtime
Express.js Web Framework
PostgreSQL Database
Prisma ORM
JWT Authentication
Joi Validation
Helmet Security

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • PostgreSQL 14+

Setup

# Clone repository
git clone https://github.com/q225/scribeboard.git
cd scribeboard

# Run setup script
chmod +x setup.sh
./setup.sh

# Or on Windows PowerShell
.\setup.ps1

# Start development server
npm run dev

Manual Setup

# Install dependencies
npm install

# Create .env file
cp env.example .env
# Edit .env with your database credentials

# Generate Prisma client
npx prisma generate

# Push database schema
npx prisma db push

# Seed database
npm run db:seed

# Start server
npm run dev

πŸ” Test Accounts

Role Email Password
Admin admin@scribeboard.com Admin@123
Editor editor@scribeboard.com Admin@123
Author author@scribeboard.com Admin@123

πŸ“‘ API Endpoints

Authentication

Method Endpoint Description
POST /api/v1/auth/register Register new user
POST /api/v1/auth/login Login
POST /api/v1/auth/refresh-tokens Refresh tokens
POST /api/v1/auth/logout Logout
GET /api/v1/auth/profile Get profile
PATCH /api/v1/auth/profile Update profile
POST /api/v1/auth/change-password Change password

Posts

Method Endpoint Description
GET /api/v1/posts List posts (with filters)
GET /api/v1/posts/:id Get single post
POST /api/v1/posts Create post (draft)
PATCH /api/v1/posts/:id Update post
DELETE /api/v1/posts/:id Delete post
POST /api/v1/posts/:id/publish Publish post
POST /api/v1/posts/:id/unpublish Unpublish post
POST /api/v1/posts/:id/submit-review Submit for review
GET /api/v1/posts/:id/revisions Get revision history

Categories

Method Endpoint Description
GET /api/v1/categories List categories
GET /api/v1/categories/:id Get category
POST /api/v1/categories Create category
PATCH /api/v1/categories/:id Update category
DELETE /api/v1/categories/:id Delete category

Comments

Method Endpoint Description
GET /api/v1/posts/:postId/comments Get post comments
POST /api/v1/posts/:postId/comments Add comment
GET /api/v1/comments List all comments (admin)
POST /api/v1/comments/:id/approve Approve comment
POST /api/v1/comments/:id/reject Reject comment
POST /api/v1/comments/:id/spam Mark as spam
DELETE /api/v1/comments/:id Delete comment

Authors

Method Endpoint Description
GET /api/v1/authors/:id Get author profile
GET /api/v1/authors/:id/posts Get author's posts

πŸ” Query Parameters

Posts

# Filter by status
GET /api/v1/posts?status=PUBLISHED

# Filter by category
GET /api/v1/posts?category=technology

# Filter by tag
GET /api/v1/posts?tag=nodejs

# Search
GET /api/v1/posts?search=javascript

# Featured posts
GET /api/v1/posts?featured=true

# Pagination
GET /api/v1/posts?page=1&limit=10

# Sort
GET /api/v1/posts?sort=-publishedAt  # Newest first
GET /api/v1/posts?sort=title          # A-Z

πŸ“‚ Project Structure

scribeboard/
β”œβ”€β”€ prisma/
β”‚   β”œβ”€β”€ schema.prisma      # Database schema
β”‚   └── seed.js            # Seed data
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ config/            # Configuration
β”‚   β”œβ”€β”€ controllers/       # Route handlers
β”‚   β”œβ”€β”€ middleware/        # Express middleware
β”‚   β”œβ”€β”€ routes/            # API routes
β”‚   β”œβ”€β”€ services/          # Business logic
β”‚   β”œβ”€β”€ utils/             # Helpers
β”‚   β”œβ”€β”€ validators/        # Joi schemas
β”‚   β”œβ”€β”€ app.js             # Express app
β”‚   └── server.js          # Entry point
β”œβ”€β”€ .env.example
β”œβ”€β”€ package.json
└── README.md

πŸ”„ Publishing Workflow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  DRAFT  │────▢│ PENDING_REVIEW  │────▢│ PUBLISHED β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
     β”‚                                        β”‚
     β”‚                                        β–Ό
     β”‚                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     └──────────────────────────────▢│ UNPUBLISHED β”‚
                                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Status Description
DRAFT Work in progress, not visible to public
PENDING_REVIEW Submitted for editor review
PUBLISHED Live and visible to public
UNPUBLISHED Removed from public but not deleted
ARCHIVED Long-term storage

πŸ›‘οΈ User Roles

Role Permissions
ADMIN Full access, manage users
EDITOR Manage all posts, moderate comments, manage categories
AUTHOR Create/edit own posts, comment
READER View posts, comment (when logged in)

πŸ“ Example Requests

Login

curl -X POST http://localhost:3003/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"author@scribeboard.com","password":"Admin@123"}'

Create Post

curl -X POST http://localhost:3003/api/v1/posts \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My First Blog Post",
    "content": "This is the content of my blog post...",
    "categoryId": "CATEGORY_ID",
    "tags": ["tutorial", "beginner"]
  }'

Publish Post

curl -X POST http://localhost:3003/api/v1/posts/POST_ID/publish \
  -H "Authorization: Bearer YOUR_TOKEN"

Add Comment

curl -X POST http://localhost:3003/api/v1/posts/POST_ID/comments \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"content": "Great article!"}'

πŸ“„ License

MIT


Made with ❀️ for content creators

About

ScribeBoard API - Complete Blog CMS Backend with publishing workflows, comment moderation, and role-based access

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors