Feedback API
Endpoints for submitting and managing user feedback with support for categories, screenshots, and admin management.
📡 Endpoints
Submit Feedback (Public)
Submit new feedback without authentication.
Endpoint: POST /api/feedback
Request Body:
{
"name": "John Doe",
"email": "john@example.com",
"comment": "Great portfolio! Love the design and animations.",
"rating": 5,
"location": "https://mohamedlakssirt.tech/#projects",
"category": "General Feedback",
"screenshot": "data:image/png;base64,iVBORw0KGgoAAAANS..."
}Validation:
name: Min 2 characters (required)email: Valid email (required)comment: Min 10 characters (required)rating: Integer 1-5 (required)location: URL string (optional)category: "Bug Report" | "Feature Request" | "General Feedback" (optional)screenshot: Base64 encoded image (optional)
Response: 201 Created
{
"success": true,
"message": "Feedback submitted successfully",
"data": {
"id": "fb_abc123",
"status": "pending"
}
}Rate Limiting: 5 requests per 15 minutes per IP
Example:
curl -X POST http://localhost:3001/api/feedback \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"email": "john@example.com",
"comment": "This is fantastic work!",
"rating": 5,
"category": "General Feedback"
}'Get All Feedback (Admin)
Retrieve all feedback entries. Requires authentication.
Endpoint: GET /api/feedback/get-feedback
Headers:
Authorization: Bearer <access_token>Query Parameters:
?status=pending&limit=50&offset=0Response: 200 OK
{
"success": true,
"data": [
{
"id": "fb_abc123",
"name": "John Doe",
"email": "john@example.com",
"comment": "Great portfolio!",
"rating": 5,
"status": "pending",
"location": "https://mohamedlakssirt.tech/#projects",
"category": "General Feedback",
"screenshot": "data:image/png;base64...",
"adminNotes": null,
"resolvedBy": null,
"resolvedAt": null,
"createdAt": "2025-12-18T10:00:00.000Z",
"updatedAt": "2025-12-18T10:00:00.000Z"
}
],
"pagination": {
"total": 150,
"limit": 50,
"offset": 0
}
}Example:
curl http://localhost:3001/api/feedback/get-feedback \
-H "Authorization: Bearer YOUR_TOKEN" \
-G -d "status=pending" -d "limit=20"Update Feedback Status (Admin)
Update feedback status and add admin notes.
Endpoint: PUT /api/feedback/:id
Headers:
Authorization: Bearer <access_token>Request Body:
{
"status": "resolved",
"adminNotes": "Issue fixed in latest deployment",
"resolvedBy": "admin@example.com"
}Response: 200 OK
{
"success": true,
"message": "Feedback updated successfully",
"data": {
"id": "fb_abc123",
"status": "resolved",
"resolvedAt": "2025-12-18T11:00:00.000Z"
}
}📊 Feedback Schema
interface Feedback {
id: string;
name: string;
email: string;
comment: string;
rating: number; // 1-5
status: 'pending' | 'resolved' | 'archived';
location?: string;
category?: 'Bug Report' | 'Feature Request' | 'General Feedback';
screenshot?: string; // Base64 encoded
adminNotes?: string;
resolvedBy?: string;
resolvedAt?: Date;
websiteId?: string;
createdAt: Date;
updatedAt: Date;
}🔔 Email Notifications
Admins receive email notifications for new feedback:
Subject: New Feedback Submission
Content:
- Submitter name and email
- Rating
- Comment
- Category
- Location
- Direct link to feedback
🛡️ Security Features
- Bot Protection: reCAPTCHA integration (optional)
- Rate Limiting: Prevents spam submissions
- Input Sanitization: HTML escaping for all text inputs
- Email Validation: RFC 5322 compliant
- File Size Limits: Screenshots limited to 5MB