Overview β’ Architecture β’ Features Deep-Dive β’ Tech Stack β’ Installation β’ License
A premium, feature-rich music streaming web application built with Django, Django Channels, and Tailwind CSS.
SoulPlayer is a modern, high-performance web-based music streaming platform designed with a focus on premium aesthetics and intelligent features. Developed primarily with the Django framework and styled rapidly using Tailwind CSS, SoulPlayer brings desktop-class media streaming experiences to the browser.
Beyond standard playback functionality, the platform differentiates itself with advanced features like Natural Language Voice Search (NLP), Real-Time Listening Rooms (Live Jams), JioSaavn API Integration for unlimited music streaming, and Dynamic Background Play Tracking.
SoulPlayer follows a classic Model-View-Template (MVT) architecture utilized by Django, augmented with ASGI (Daphne) for asynchronous operations, Django Channels for real-time WebSocket communication, and vanilla JavaScript for asynchronous frontend operations (AJAX) to maintain a seamless, single-page-application feel during media playback.
Click to expand Architectural Flow
- Client Layer (The Browser): Renders the UI using HTML rendered by Django Templates and Tailwind CSS for styling. Global event listeners capture media playback actions.
- Asynchronous Handlers (Vanilla JS
fetchAPIs): When a user plays a song, the globalaudioelement begins streaming the buffer. Simultaneously, an invisible/record_play/<id>/POST request is fired to the backend, complete with explicit CSRF token verification, to track user listening history. - WebSocket Layer (Django Channels + Redis): Real-time features like Live Listening Rooms use WebSocket connections managed by Django Channels with a Redis channel layer. This enables synchronized audio playback, live chat, and song change notifications across all connected clients.
- Routing Layer (
music/urls.py): Django's URL dispatcher routes incoming REST-like endpoints and standard GET requests to the appropriate controller views. WebSocket routes are handled separately viamusic/routing.py. - Controller Layer (
music/views.py): Handles the core business logic.- Queries the database via the Django ORM.
- Processes Natural Language queries through the
spaCyNLP engine. - Interfaces with the JioSaavn API for external music streaming.
- Makes external calls to the Google/YouTube Data API for podcast ingestion.
- External API Layer (
music/jiosavan.py): A dedicated service module that wraps the unofficial JioSaavn API for song search, trending charts, song details, suggestions, and streaming URLs. Implements intelligent caching via Django's cache framework, quality selection for audio and images, and multi-tier fallback strategies for trending content. - Data Layer (
models.py& SQLite Database): Stores the relational mapping of Users, UserProfiles (1-to-1 User mapping), Artists, Songs, Playlists (Many-to-Many relationships), and ListeningRooms for collaborative sessions.
graph TB
subgraph Client["π₯οΈ Client Layer (Browser)"]
UI["Django Templates + Tailwind CSS"]
XR["3D XR Studio (Three.js + Canvas)"]
JS["Vanilla JS (ES6)"]
Audio["HTML5 Audio/Web Audio API"]
WSClient["WebSocket Client"]
SpeechAPI["Web Speech API"]
end
subgraph Server["βοΈ Django ASGI Server (Daphne)"]
subgraph HTTP["HTTP Layer"]
URLRouter["URL Router (urls.py)"]
Views["Views Controller (views.py)"]
NLP["spaCy NLP Engine"]
CtxProc["Context Processors"]
end
subgraph WS["WebSocket Layer"]
WSRouter["WebSocket Router (routing.py)"]
Consumer["ListeningRoomConsumer"]
end
subgraph Services["Service Layer"]
JioSaavn["JioSaavn API Module (jiosavan.py)"]
ML["Hybrid ML Recommender Engine"]
CacheLayer["Django Cache Framework"]
end
end
subgraph External["π External APIs"]
JioAPI["JioSaavn API (saavn.sumit.co)"]
YTApi["YouTube Data API v3"]
end
subgraph Data["πΎ Data Layer"]
SQLite["SQLite Database"]
Redis["Redis (Channels + Cache)"]
end
subgraph Models["π¦ Django Models"]
Song["Song"]
Artist["Artist"]
Playlist["Playlist"]
UserProfile["UserProfile"]
RecommendationModel["Recommendation"]
ListeningRoom["ListeningRoom"]
end
%% Client to Server
UI -->|"HTTP GET/POST"| URLRouter
JS -->|"fetch() AJAX"| URLRouter
WSClient -->|"ws:// connection"| WSRouter
SpeechAPI -->|"Voice transcript"| JS
%% HTTP Flow
URLRouter --> Views
Views --> NLP
Views --> JioSaavn
Views --> ML
Views --> Models
CtxProc -->|"Sidebar data"| UI
%% WebSocket Flow
WSRouter --> Consumer
Consumer -->|"Group broadcast"| Redis
Redis -->|"Real-time events"| Consumer
%% Service Layer
JioSaavn -->|"Search, Trending, Details"| JioAPI
JioSaavn -->|"Cache responses"| CacheLayer
CacheLayer --> Redis
Views -->|"Podcast fetch"| YTApi
%% Data Layer
Models --> SQLite
Consumer -->|"Room state"| SQLite
%% Audio Flow
Audio -->|"Stream from JioSaavn CDN"| JioAPI
JS -->|"Play/Pause/Seek events"| WSClient
%% Styling
classDef clientNode fill:#1e293b,stroke:#3be2c8,color:#fff
classDef serverNode fill:#0f172a,stroke:#818cf8,color:#fff
classDef externalNode fill:#1e1b4b,stroke:#f472b6,color:#fff
classDef dataNode fill:#0c0a09,stroke:#facc15,color:#fff
class UI,XR,JS,Audio,WSClient,SpeechAPI clientNode
class URLRouter,Views,NLP,CtxProc,WSRouter,Consumer,JioSaavn,ML,CacheLayer serverNode
class JioAPI,YTApi externalNode
class SQLite,Redis,Song,Artist,Playlist,UserProfile,RecommendationModel,ListeningRoom dataNode
Instead of forcing users to explicitly filter by artist or genre, SoulPlayer integrates spaCy, an industry-level Natural Language Processing library.
- How it works: When a user searches "play some romantic arijit singh songs", the NLP pipeline intercepts the query. It categorizes grammatical tokens, actively stripping out stop words ("some", "songs", "play") to isolate target keywords. It then routes the request intelligentlyβif it finds an exact song match, it auto-plays it. If it finds an artist match, it redirects to the Artist Portfolio.
- Voice Search UI: A dedicated full-screen voice search interface (
/voice_search/) uses the Web Speech API for browser-native speech recognition. It features animated ripple effects, real-time audio visualizer bars, and auto-submission to the NLP search pipeline upon voice capture.
SoulPlayer features collaborative listening rooms powered by Django Channels and Redis, enabling synchronized music experiences across multiple users.
- WebSocket Architecture: Uses
ListeningRoomConsumerfor real-time bidirectional communication. Events includeplay,pause,change_song, andchatactions, all broadcast to every connected client in the room group. - Host/Guest Model: The room creator (host) has full playback controlsβplay, pause, seek, and search for new tracks. Guests receive synchronized audio state updates with a 2-second tolerance threshold for seamless sync.
- Live In-Room Chat: Real-time text chat alongside synchronized music playback. System messages announce join/leave events. Chat UI features self/other message styling with avatar initials and timestamps.
- Room Management: Rooms are created with unique 6-character alphanumeric codes. Hosts can search and swap tracks mid-session using an in-room JioSaavn search interface that updates the backend and notifies all guests.
- Lobby Interface: A premium glass-morphism lobby (
/jam/lobby/) allows users to create new rooms or join existing ones via room codes.
SoulPlayer integrates with the unofficial JioSaavn API to provide access to millions of songs without requiring any API keys.
- Song Search & Streaming: Search across JioSaavn's entire catalog and stream songs directly at up to 320kbps quality. Results are normalized into a consistent format and seamlessly integrated into the SoulPlayer UI.
- Trending Charts: Fetches songs from official JioSaavn chart playlists (Top 50 Hindi, Trending Today, Bollywood Hits) with deduplication and intelligent fallback to curated search queries if playlist endpoints fail.
- Trending Today: A dedicated "Trending Today" section that dynamically discovers and fetches the official JioSaavn "Trending Today" playlist, cached for 30 minutes for optimal performance.
- Song Suggestions: "Up Next" recommendations powered by JioSaavn's suggestion engine, displayed on the full-screen player with smooth navigation between suggested tracks.
- Playlist Integration: JioSaavn songs can be added to user playlists directly from search results or trending sections via a context menu. Songs are synced to the local database on first interaction.
- Caching Layer: All trending data is cached using Django's cache framework (Redis in production, in-memory for development) with configurable TTLs (1 hour for trending, 30 minutes for Trending Today, 24 hours for playlist IDs).
The project features a sleek, global bottom-bar player and a dedicated Full-Screen View (/play_song/<id>).
- Design: Utilizes modern "Glassmorphism" paradigms (blur backdrops, semi-transparent gradients, glowing accents).
- DOM APIs: Interacts deeply with the HTML5
<audio>API to calculate track duration, current timestamp precision, and smooth slider tracking. - Dual Source Playback: Seamlessly handles both local library songs (uploaded files/external links) and JioSaavn streamed content with unified controls.
- Previous/Next Navigation: Intelligent navigation supporting both local song sequences and JioSaavn suggestion chains, with automatic song-end transition to the next track.
We utilize Django Signals (post_save) to automatically attach an extended UserProfile model to every new user registration.
- History Tracking: JavaScript asynchronous
fetchrequests bypass the need for full page reloads. As users listen to tracks (both local and JioSaavn), theirplayed_songsMany-To-Many relationship is updated silently in the background via dedicated/record_play/and/record_play_jiosaavn/endpoints. - JioSaavn Song Sync: When a JioSaavn song is played or added to a playlist for the first time, it is automatically synced to the local database with all metadata (title, artist, duration, image, stream URL, JioSaavn ID).
- Dashboard: Users have a dedicated customizable Profile page featuring listening history, favorite artist collections, tracks played stats, and profile editing capabilities.
- Favorite Artists: Users can toggle favorite/follow status on artist detail pages, which appears on their profile dashboard.
SoulPlayer isn't just limited to local database music. It uses the requests library to interface with the YouTube Data API v3. It dynamically queries YouTube for high-quality music podcasts, parses the incoming JSON, and renders fully playable media cards directly within the SoulPlayer UI.
- Hero Carousel: An auto-sliding 3-slide hero section with manual navigation arrows, dot indicators, and pause-on-hover functionality.
- Infinite Scroll Cards: Moods & Genres and Popular Artists sections feature CSS-animated auto-scrolling card strips with pause-on-hover.
- Global Sidebar: A shared sidebar across all pages via Django context processors, showing playlists, recent songs, and navigation links including the Live Jams feature with a pulsing broadcast icon.
- Responsive Layout: Full desktop layout with sidebar, top navigation, and bottom player bar. Mobile-optimized with responsive breakpoints.
- Add to Playlist: Context menu dropdown for adding JioSaavn songs to user playlists directly from any song card.
SoulPlayer features a hybrid, personalized recommendation pipeline designed to analyze listening habits and song features.
- Hybrid Recommender System: Blends Content-Based Filtering (using TF-IDF on genres, tags, and artists) and Collaborative Filtering (analyzing patterns from mathematically similar users).
- Prioritized Engine Logic: Implements a multi-tier fallback: Cache β Real-time Hybrid calculation β Trending/Popularity fallback (for cold-start new users).
- Asynchronous Training: Features a dedicated
train_recommendationsbackground command to pre-compute and store heavy vector math in the database. - Made For You Interface: A premium glassmorphism "Recommended" interface dynamically serving AI-curated feeds to listeners.
SoulPlayer escapes the flat 2D player limitation with a full 3D interactive WebGL environment using Three.js.
- True 3D Audio-Reactive World: 360Β° mouse look-around camera controls (OrbitControls) drops users onto a reflective grid floor with 64 dynamic frequency pillars, floating particles, and a central deforming orb. Web Audio API live-analyzes track frequencies to dynamically warp geometries and scale lights.
- Cinematic Genre Themes: 9 custom environmental themes (Cosmic, Romance, Pop, Rock, Hip-Hop, Indie, EDM, Classical, Lo-Fi) that alter sky gradients, lighting colors, fog densities, and waveform aesthetics.
- Auto Genre Detection: The engine parses metadata keywords ("metal", "dj", "acoustic", etc.) upon playing a track and automatically switches the 3D environment's theme to match the vibe.
- Live In-World JioSaavn Search: Fully functional in-world floating UI that lets users search the entire music catalog and enqueue tracks without terminating the 3D WebGL context.
- Framework: Django 4.x (Python)
- ASGI Server: Daphne (for WebSocket + HTTP support)
- WebSockets: Django Channels with Redis channel layer
- Database: SQLite (Development & Free Tier Production ready)
- Caching: Redis (Production) / In-memory LocMemCache (Development)
- NLP Engine: spaCy (
en_core_web_sm) - Machine Learning: Pandas, Scikit-Learn (TF-IDF Vectorization, Cosine Similarity)
- External APIs: JioSaavn API (unofficial, no key needed), YouTube Data API v3
- API Interactions: Python
requestsmodule
- Templating: Django Template Engine
- Styling: Tailwind CSS (via CDN)
- Interactivity: Vanilla JS (ES6) with WebSocket API for real-time features
- 3D / AR / VR: Three.js (WebGL rendering engine and audio analysis)
- Icons: FontAwesome 6
- Typography: Google Fonts (Outfit)
To run SoulPlayer locally on your machine, follow these steps:
git clone https://github.com/rudra00434/SoulPlayer.git
cd SoulPlayer
cd SPOTIFYpython -m venv venv
# For Windows:
venv\Scripts\activate
# For macOS/Linux:
source venv/bin/activatepip install -r requirements.txtpython -m spacy download en_core_web_smCreate a file named .env in the same directory as manage.py.
# Required for Podcast fetching module:
YOUTUBE_API_KEY=your_google_api_key_here
# Optional: For production Redis caching & Channels
REDIS_URL=redis://127.0.0.1:6379
# Optional: For production deployment (auto-disables DEBUG)
# RENDER=truepython manage.py makemigrations
python manage.py migratepython manage.py createsuperuserpython manage.py runserverOpen your browser and navigate to http://127.0.0.1:8000/. You can log into the admin panel at http://127.0.0.1:8000/admin/ to add Artists, Songs, and Categories manually.
π‘ Note: For Live Listening Rooms to work locally, you need Redis running on your machine. Install Redis and ensure it's running on
redis://127.0.0.1:6379. Without Redis, the app will still function but the Jam Rooms feature will not be available.
SoulPlayer utilizes a custom deployment flow designed specifically for PaaS providers like Render.com.
The application uses an automated build.sh script to handle production environments. Instead of manually SSHing into the server to install dependencies, the script:
- Installs Python packages via
pip. - Downloads the heavy
spaCyNLP model binaries to the production server. - Automatically maps static assets via
collectstaticfor theWhitenoisemiddleware to serve. - Executes zero-downtime Django database migrations via
migrate.
Infrastructure Details:
- ASGI Server: Daphne (supports both HTTP and WebSocket protocols)
- Static File Serving: Whitenoise (Configured in
settings.py) - Channel Layer: Redis (via
channels-redis) for WebSocket communication - Caching: Redis for JioSaavn API response caching
β οΈ Limitation Warning: If utilizing ephemeral free-tier instances (like Render Free Web Services), local media assets (User uploaded MP3s and JPGs located in/media/) will be purged upon container sleep. A permanent production scale-up requires migrating theDEFAULT_FILE_STORAGEto an AWS S3 bucket or Cloudinary.
SoulPlayer/
βββ SPOTIFY/
β βββ manage.py # Django management script
β βββ requirements.txt # Python dependencies
β βββ Procfile # Render deployment (Daphne ASGI)
β βββ build.sh # Build script for Render
β βββ db.sqlite3 # SQLite database
β βββ music/ # Main Django app
β β βββ ml_Pipeline/ # Machine learning engines (Hybrid, Content-Based, Collaborative)
β β βββ management/commands/ # Custom django-admin commands (train_recommendations)
β β βββ models.py # Song, Artist, Playlist, UserProfile, Recommendation, ListeningRoom
β β βββ views.py # All view controllers
β β βββ urls.py # URL routing
β β βββ forms.py # Django ModelForms with Tailwind styling
β β βββ jiosavan.py # JioSaavn API service module
β β βββ consumers.py # WebSocket consumer for Listening Rooms
β β βββ routing.py # WebSocket URL routing
β β βββ context_processors.py # Sidebar data for all templates
β β βββ admin.py # Django admin registration
β βββ mysite/ # Django project config
β β βββ settings.py # App settings (Redis, Cache, Channels)
β β βββ asgi.py # ASGI application (HTTP + WebSocket)
β β βββ urls.py # Root URL configuration
β βββ template/ # HTML templates
β β βββ index.html # Main discover page with hero carousel
β β βββ immersive_player.html # 3D XR Studio WebGL audio-reactive canvas
β β βββ recommendations.html # ML-powered "Made For You" interface
β β βββ play_song.html # Full-screen music player
β β βββ search.html # Search results with dual-source display
β β βββ voice_search.html # Voice search with Web Speech API
β β βββ jam_lobby.html # Live Jam lobby (create/join rooms)
β β βββ jam_room.html # Live Listening Room with chat
β β βββ profile.html # User dashboard
β β βββ ... # Additional templates
β βββ static/ # Static assets
β β βββ xr_backgrounds/ # Cinematic 3D environments for immersive player
β βββ media/ # User-uploaded media files
βββ README.md
Contributions, issues, and feature requests are highly encouraged! If you have suggestions for improving the UI, optimizing database queries, or adding new APIs, feel free to check the issues page or submit a Pull Request.
This project is open-source and available under the MIT License.
