A comprehensive RESTful API web application for music streaming and management, built with Laravel 8 and PHP 7.4+.
Melodyo API is a feature-rich backend service that provides endpoints for music streaming, user management, artist and album management, comments, categories, and more. The API supports both public and authenticated endpoints with rate limiting and JWT authentication.
- Authentication & Authorization: JWT-based authentication with login, logout, registration, and password management
- User Management: User profiles, avatars, and custom user information
- Music Content:
- Albums management with CRUD operations
- Artist profiles and album listings
- Music tracks with audio processing (FFmpeg integration)
- Categories and tags organization
- Social Features:
- Comments system with nested replies (children)
- Like/unlike functionality for artists, albums, and comments
- Reporting system for content moderation
- Media Management:
- Image processing with Intervention Image
- BlurHash support for image placeholders
- S3-compatible storage integration
- Audio processing with Laravel FFmpeg
- Additional Features:
- Version checking and update management
- Slides/banners management
- Pages content management
- Backup system (Spatie Laravel Backup)
- Activity auditing (Laravel Auditing)
- Error tracking (Sentry integration)
Separate admin routes with full CRUD operations for:
- Versions management
- Slides/banners management
- All content moderation
- Framework: Laravel 8.x
- PHP: 7.4+
- Authentication: JWT (tymon/jwt-auth)
- Database: MySQL
- Cache/Queue: Redis, Predis
- Media Processing:
- Intervention Image for image manipulation
- FFmpeg for audio processing
- BlurHash for image placeholders
- Storage: AWS S3 compatible (via Flysystem)
- Development Tools:
- Laravel Telescope (debugging)
- Laravel IDE Helper
- PHPUnit for testing
- PHP >= 7.4
- Composer
- MySQL
- Redis (optional, for caching)
- FFmpeg (for audio processing)
- Docker & Docker Compose (optional)
# Build and start containers
docker-compose up --build -d
# Install dependencies
docker-compose exec -T app composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
# Generate application key
docker-compose exec -T app php artisan key:generate
# Generate JWT secret
docker-compose exec -T app php artisan jwt:secret
# Run database migrations
docker-compose exec -T app php artisan migrate
# Start supervisor for queue workers
docker-compose exec -T app supervisord || true# Install dependencies
composer install
# Copy environment file
cp .env.example .env
# Generate application key
php artisan key:generate
# Generate JWT secret
php artisan jwt:secret
# Configure your database in .env file
# Then run migrations
php artisan migrate
# Start the development server
php artisan serveUpdate the .env file with your configuration:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=melodyo
DB_USERNAME=root
DB_PASSWORD=JWT_TTL=60
JWT_SECRET=your-secret-keySTORAGE_URL=https://your-storage-url.com
MEDIA_URL=https://your-media-url.com
MEDIA_DISK=s3
IMAGE_DRIVER=gdFFMPEG_THREADS=4IMAGES_DISK_ROOT=/path/to/images
MUSICS_DISK_ROOT=/path/to/music
VERSIONS_DISK_ROOT=/path/to/versionsBACKUP_ACCESS_KEY_ID=your-key
BACKUP_SECRET_ACCESS_KEY=your-secret
BACKUP_BUCKET=your-bucket
BACKUP_ENDPOINT=your-endpoint
BACKUP_DEFAULT_REGION=us-east-1Authentication (/v1/auth)
POST /auth- LoginPOST /logout- Logout (authenticated)PATCH /password- Update password (authenticated)
Version Check (/v1/version)
POST /version- Check app versionGET /version/last- Get latest version
Pages (/v1/pages)
- Public content pages
User (/v1/user)
GET /user- Get user profilePATCH /user- Update user profilePATCH /user/image- Update profile image
Categories (/v1/categories)
GET /categories- List categoriesGET /categories/{id}- Show categoryGET /categories/{id}/tags- List category tags
Albums (/v1/albums)
- Full CRUD operations
- Like/unlike functionality
- Report functionality
Artists (/v1/artists)
GET /artists- List artistsGET /artists/{id}- Show artistGET /artists/{id}/albums- List artist albumsPOST /artists/{id}/like- Like/unlike artistPOST /artists/{id}/report- Report artist
Comments (/v1/comments)
GET /comments/{id}- Show commentPATCH /comments/{id}- Update commentDELETE /comments/{id}- Delete commentPOST /comments/{id}/like- Like commentGET /comments/{id}/children- Get nested replies
Slides (/v1/slides)
GET /slides- List slidesGET /slides/{id}- Show slide
Admin routes are available under /admin prefix with full CRUD operations for content management.
- Public auth endpoints: 5 requests/minute
- Version check: 20 requests/minute
- Authenticated endpoints: 60 requests/minute
composer deployThis will:
- Install dependencies
- Generate application key
- Generate JWT secret
- Optimize the application
vendor/bin/phpunit# Generate IDE helper files
php artisan ide-helper:generate
php artisan ide-helper:models
php artisan ide-helper:meta- JWT-based authentication
- Rate limiting on all endpoints
- Request validation
- CORS support
- Sentry error tracking
- Activity auditing
MIT License
For issues and questions, please open an issue in the GitHub repository.