A modular WebSocket-based music streaming server with authentication and song downloading capabilities.
- Modular Architecture: Clean separation of concerns with dedicated files for different functionalities
- WebSocket Communication: Real-time encrypted communication between client and server
- Authentication: User login system with database support (MySQL/SQLite)
- Admin Dashboard: Comprehensive admin panel with user management, system monitoring, and server controls
- Song Downloading: Automatic song downloading from YouTube using yt-dlp
- Streaming: Temporary URL generation for secure song streaming
- Deezer Integration: Proxy API for Deezer chart and search functionality
- Playlist Management: Create, manage, and play user playlists
- SSL Support: HTTPS/WSS support with SSL certificates
- Install dependencies:
npm install-
Configure your SSL certificates in the
cert/directory:cert1.pem- SSL certificateprivkey1.pem- Private key
-
Create the
songs/directory for downloaded songs:
mkdir songs- Start the server:
node index.jsexpress- Web frameworkws- WebSocket librarymysql2- MySQL database driversqlite3- SQLite database driverytdlp-nodejs- YouTube downloadingmusic-metadata- Audio metadata parsingget-audio-duration- Audio duration calculationsanitize-filename- Safe filename generationnode-fetch- HTTP clientcheerio- HTML parsinguuid- Unique ID generationcrypto- Encryption utilitiescors- Cross-origin resource sharing
The server includes a comprehensive admin dashboard with the following features:
- User Management: View, ban/unban, promote/demote users
- System Monitoring: Real-time server statistics and performance metrics
- Database Management: Backup and restore database functionality
- System Logs: View server logs and diagnostic information
- Server Controls: Restart server functionality
For detailed API documentation, see docs/ADMIN_HANDLERS.md.
The server includes a comprehensive playlist management system with the following features:
- Create Playlists: Users can create named playlists with optional descriptions
- Add/Remove Songs: Add songs to playlists and remove them as needed
- View Playlists: List all user playlists with song counts
- Playlist Details: View detailed information about specific playlists
- Play Playlists: Get all songs in a playlist for playback
- Delete Playlists: Remove entire playlists
For detailed API documentation, see docs/PLAYLIST_SYSTEM.md.
Run the admin handlers test:
node test/admin_handlers_test.jsRun the playlist system test:
node test_playlist.js- AES-256-CBC encryption for all WebSocket messages
- Session-based authentication
- Admin privilege validation for all admin operations
- Temporary URLs with expiration
- Input sanitization for filenames
- SQL injection prevention with parameterized queries