https://github.com/kinchan-code/discussion-platform-api
https://github.com/kinchan-code/discussion-platform-api
laravel12 mysql typesense
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kinchan-code/discussion-platform-api
- Owner: Kinchan-code
- Created: 2025-07-31T17:27:52.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-12-10T21:35:15.000Z (7 months ago)
- Last Synced: 2025-12-11T08:51:15.804Z (7 months ago)
- Topics: laravel12, mysql, typesense
- Language: PHP
- Homepage:
- Size: 243 KB
- Stars: 0
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Community-Powered Protocol & Discussion Platform API
A robust Laravel REST API for a community-driven platform where users can share wellness protocols, create discussion threads, and engage through comments, reviews, and voting.
## π Features
- **Protocols**: Structured wellness instructions with tags, ratings, and author attribution
- **Threads & Comments**: Discussion topics with multi-level nested replies
- **Reviews & Voting**: Star ratings, feedback, and upvote/downvote system (one vote per user)
- **User Profiles**: Statistics and activity tracking
- **Search**: Full-text, faceted search with Typesense Cloud & Laravel Scout
- **Authentication**: Laravel Sanctum token-based authentication
- **Clean Architecture**: Service layer, DTOs, and standardized API responses
## ποΈ Tech Stack
- **Framework**: Laravel 12.x (PHP 8.2+)
- **Database**: MySQL 8.0+
- **Search**: Typesense Cloud via Laravel Scout
- **Auth**: Laravel Sanctum
- **Testing**: PHPUnit
## β‘ Quick Start
1. **Clone & Install**
```bash
git clone
cd discussion-platform-api
composer install
npm install
```
2. **Environment Setup**
```bash
cp .env.example .env
php artisan key:generate
# Edit .env for DB and Typesense credentials
```
3. **Database & Seed**
```bash
php artisan migrate
php artisan db:seed
```
4. **(Optional) Search Index**
```bash
php artisan scout:import "App\\Models\\Protocol"
php artisan scout:import "App\\Models\\Thread"
```
5. **Run Server**
```bash
php artisan serve
# API at http://localhost:8000
```
## π API Overview
**Authentication**
- `POST /api/register` β Register new user
- `POST /api/login` β Login user
- `POST /api/logout` β Logout user (auth required)
- `GET /api/me` β Get current user (auth required)
**Profile**
- `GET /api/profile` β Get current user profile (auth required)
- `PUT /api/profile` β Update profile (auth required)
- `GET /api/profile/statistics` β User activity stats (auth required)
- `GET /api/profile/replies` β Userβs replies (auth required)
- `GET /api/profile/comments` β Userβs comments (auth required)
- `GET /api/profile/reviews` β Userβs reviews (auth required)
**Protocols**
- `GET /api/protocols` β List protocols (filter/sort supported)
- `GET /api/protocols/featured` β Featured protocols
- `GET /api/protocols/filters` β Protocol filters
- `GET /api/protocols/{id}` β Get protocol
- `GET /api/protocols/{id}/stats` β Protocol stats
- `POST /api/protocols` β Create protocol (auth required)
- `PUT /api/protocols/{id}` β Update protocol (auth required)
- `DELETE /api/protocols/{id}` β Delete protocol (auth required)
**Threads**
- `GET /api/threads` β List threads (filter/sort supported)
- `GET /api/threads/trending` β Trending threads
- `GET /api/threads/{id}` β Get thread
- `GET /api/threads/{id}/stats` β Thread stats
- `GET /api/protocols/{protocol}/threads` β Threads by protocol
- `POST /api/threads` β Create thread (auth required)
- `PUT /api/threads/{id}` β Update thread (auth required)
- `DELETE /api/threads/{id}` β Delete thread (auth required)
**Comments**
- `GET /api/threads/{thread}/comments` β Get thread comments
- `GET /api/comments/{comment}/replies` β Get comment replies
- `GET /api/replies/{reply}/nested` β Get nested replies
- `POST /api/threads/{thread}/comments` β Create comment (auth required)
- `POST /api/comments/{comment}/reply` β Reply to comment (auth required)
- `POST /api/replies/{reply}/reply` β Reply to reply (auth required)
- `PUT /api/comments/{comment}` β Update comment (auth required)
- `DELETE /api/comments/{comment}` β Delete comment (auth required)
**Reviews**
- `GET /api/protocols/{protocol}/reviews` β Get protocol reviews
- `POST /api/protocols/{protocol}/reviews` β Create review (auth required)
- `DELETE /api/reviews/{id}` β Delete review (auth required)
**Voting**
- `POST /api/threads/{thread}/vote` β Vote on thread (auth required)
- `POST /api/comments/{comment}/vote` β Vote on comment (auth required)
- `POST /api/reviews/{review}/vote` β Vote on review (auth required)
**Tags & Analytics**
- `GET /api/tags/popular` β Popular tags
- `GET /api/stats/dashboard` β Platform statistics
---
All endpoints return standardized JSON. Most write actions require authentication (Bearer token).
## π§ͺ Testing
```bash
php artisan test
```
**For questions or feedback, feel free to reach out.**