@xcelsior/comment-api
v1.0.27
Published
A serverless comment-as-a-service built with SST, supporting rich text comments, threaded replies, and API key authentication.
Keywords
Readme
Comment Service - Disqus-like Comment System
A serverless comment-as-a-service built with SST, supporting rich text comments, threaded replies, and API key authentication.
Architecture Overview
Technology Stack
- Backend: SST (Serverless Stack) with AWS Lambda
- Database: DynamoDB for comments and metadata
- Authentication: API Key-based authentication
- Frontend: React with TypeScript
- Rich Text: Support for markdown and HTML content
- Deployment: AWS (Lambda, DynamoDB, S3, CloudFront)
Core Features
- ✅ API key authentication
- ✅ Rich text comments (markdown/HTML)
- ✅ Threaded replies
Database Design
Tables
Comments Table
interface Comment {
id: string; // UUID
threadId: string; // Thread identifier (e.g., article URL)
parentId?: string; // For replies (null for top-level)
content: string; // Rich text content
author: {
name: string;
email: string;
};
createdAt: string; // ISO timestamp
}Threads Table
interface Thread {
id: string; // Thread identifier
title: string; // Page/article title
url: string; // Page URL
lastCommentAt?: string;
settings: {
allowReplies: boolean;
maxDepth: number; // Max reply depth
};
}API Design
Authentication
All API requests require an X-API-Key header with a valid API key.
Endpoints
Comments
GET /api/comments/{threadId}- Get comments for a threadPOST /api/comments- Create a new commentPUT /api/comments/{commentId}- Update a commentDELETE /api/comments/{commentId}- Delete a comment
Threads
GET /api/threads/{threadId}- Get thread informationPOST /api/threads- Create a new threadPUT /api/threads/{threadId}- Update thread settings
Response Format
interface ApiResponse<T> {
data?: T;
error?: {
code: string;
message: string;
};
pagination?: {
nextPageToken?: string;
};
}Deployment
The application will be deployed using SST to AWS with:
- Lambda functions for API endpoints
- DynamoDB for data storage
- S3 + CloudFront for static assets
- API Gateway for HTTP routing
