A blazing-fast, beautiful open-source music player and web-based Spotify alternative. Stream ad-free music instantly with our premium Spotify clone UI, Next-Gen AI DJ, and zero-lag YouTube audio streaming engine.
If you like this project, please give it a βοΈ to show your support!
- π± Premium "Spotify-Like" UI: Gorgeous dark mode, glassmorphism UI, fluid animations, and fully responsive for mobile and desktop (PWA ready).
- π Advanced Chunk Streaming Engine: Streams audio from YouTube dynamically in 10-second chunks β saving bandwidth and loading instantly (exactly like adaptive bitrate streaming).
- π§ AI DJ (Groq + Llama 3): Tell the AI your mood, and it instantly generates a custom 10-track playlist of real, trend-matching songs using ultra-fast LLM generation.
- β‘ Zero-Lag Seeking: Keeps the previous chunk in cache and pre-fetches 10 seconds ahead. Seek backwards instantly without buffering!
- π₯ Trending Dashboard: Live integration with YouTube's trending music feed.
- π Global Search: Lightning-fast YouTube search with local caching.
- πΎ Auto-Cleanup: Smart disk management automatically clears old audio chunks to prevent disk bloat.
Unlike standard YouTube downloaders that fetch the entire 100MB video before playing, Melodify acts as a smart proxy:
Browser (Vanilla JS + HTML5 Audio)
β REST API (Chunk requests)
Node.js Server (Express)
β yt-dlp (URL resolver) + ffmpeg (Audio slicer)
YouTube Servers
- You request a song.
- Server rapidly resolves the audio URL and uses
ffmpegto slice exactly00:00 - 00:10. - As you listen, it pre-generates
00:10 - 00:20in the background. - Old chunks are deleted, but the immediately preceding chunk is kept for instant seek-back.
To run Melodify, you need Node.js and these two system dependencies installed and available in your system's PATH:
macOS (via Homebrew):
brew install yt-dlp ffmpegUbuntu/Debian:
sudo apt install ffmpeg
pip install yt-dlpWindows (via Chocolatey):
choco install yt-dlp ffmpeg-
Clone the repository:
git clone https://github.com/yourusername/melodify-app.git cd melodify-app -
Install dependencies:
npm install
-
Set up Environment Variables: Create a
.envfile in the root directory and add your Groq API key for the AI DJ feature:GROQ_API_KEY=your_groq_api_key_here PORT=3000
(Get your free API key at console.groq.com)
-
Start the server:
npm run dev # For development (nodemon) # or npm start # For production
-
Open in Browser: Navigate to http://localhost:3000 and enjoy! π§
| Method | Endpoint | Description |
|---|---|---|
GET |
/search?q=query |
Searches YouTube and caches results. |
GET |
/trending |
Fetches live trending songs. |
GET |
/chunk/:videoId?start=0&duration=10 |
Streams a specific 10s audio chunk. |
POST |
/api/ai-dj |
AI suggests songs based on mood. |
DELETE |
/chunk/:videoId |
Cleans up old cached chunks. |
Contributions, issues, and feature requests are welcome! Feel free to check issues page.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Don't forget to leave a star βοΈ if you found this repository useful!