A full-fledged Blog CMS Backend Service with authors, posts, categories, comments, drafts, and publishing workflows.
- 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
| Technology |
Purpose |
| Node.js |
Runtime |
| Express.js |
Web Framework |
| PostgreSQL |
Database |
| Prisma |
ORM |
| JWT |
Authentication |
| Joi |
Validation |
| Helmet |
Security |
- Node.js 18+
- PostgreSQL 14+
# 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
# 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
| 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 |
| 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 |
| 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 |
| Method |
Endpoint |
Description |
| GET |
/api/v1/authors/:id |
Get author profile |
| GET |
/api/v1/authors/:id/posts |
Get author's 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
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
βββββββββββ βββββββββββββββββββ βββββββββββββ
β 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 |
| 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) |
curl -X POST http://localhost:3003/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"author@scribeboard.com","password":"Admin@123"}'
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"]
}'
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!"}'
MIT
Made with β€οΈ for content creators