A full-stack web application that visualizes and analyzes your Spotify music library with interactive D3.js charts. Discover insights about your listening habits through artist distribution, genre breakdowns, and audio feature analysis.
- Artist Distribution - Circle packing visualization showing which artists dominate your library
- Genre Breakdown - Stacked bar charts displaying genre distribution with nested artist composition
- Audio Feature Analysis - Scatter plots for track characteristics (danceability, energy, acousticness, valence)
- Listening History Tracking - Persistent record of recently played tracks with CSV import/export
- OAuth2 Authentication - Secure Spotify login with automatic token refresh
| Layer | Technology |
|---|---|
| Backend | Python 3, Django 2.2, Django REST Framework 3.9 |
| Database | PostgreSQL with psycopg2 adapter |
| Frontend | D3.js, Bootstrap/Darkly theme, SASS/SCSS |
| API Integration | Spotify Web API with OAuth2 |
| Additional | django-tables2, django-filter, django-compressor |
- Python 3.x
- PostgreSQL
- Spotify Developer Account (Create one here)
-
Create and activate virtual environment:
python3 -m venv venv source venv/bin/activate -
Clone the repository:
git clone https://github.com/Kevin-Mok/spotify-lib-vis cd spotify-lib-vis -
Install dependencies:
pip install -r requirements.txt
-
Set environment variables:
export SPOTIFY_CLIENT_ID="your_client_id" export SPOTIFY_CLIENT_SECRET="your_client_secret"
-
Initialize database and start server:
cd src && ./reset_db.sh
-
Access the application: Open
http://localhost:8000in your browser
src/
├── login/ # OAuth2 authentication flow
├── api/ # Spotify API integration & data processing
├── graphs/ # D3.js visualization endpoints
└── templates/ # Django templates with embedded D3
-
Real-Time API Integration
- Implements OAuth2 authorization code flow with automatic token refresh
- Handles multiple concurrent Spotify API endpoints with rate limit awareness
- Intelligent batching (50 tracks/request, 100 features/batch) for efficiency
-
Interactive D3.js Visualizations
- Circle packing algorithm with dynamic space allocation
- Responsive SVG viewBox scaling for device compatibility
- Dynamic color palette generation based on data cardinality
-
Efficient Data Modeling
- Normalized database schema with Many-to-Many relationships
- Prevents data duplication across users while enabling per-user queries
- Query optimization using Django ORM annotations and aggregations
-
Queue-Based Batch Processing
- Configurable batch limits for tracks, features, and artists
- Processes queued items efficiently to maximize API throughput
- Full-Stack Development: Django backend with D3.js frontend
- API Integration: OAuth2 flows, rate limiting, batch processing
- Database Design: Normalized schema, efficient queries
- Data Visualization: Interactive charts with real-time updates
- DevOps: Environment configuration, database management
- Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
- Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
- Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
- Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
- Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.
- Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
- Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
- Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
- Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
- Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.
- Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
- Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
- Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
- Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
- Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.
- Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
- Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
- Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
- Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
- Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.
- Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
- Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
- Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
- Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
- Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.
- Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
- Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
- Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
- Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
- Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.
- Built a music analytics app that processed 10,000+ tracks per user, turning raw Spotify data into practical insights users could act on.
- Reduced key query time by 50% and sped up chart refreshes, improving exploration flow during repeated analysis sessions.
- Added secure Spotify login with automatic token refresh, reducing sign-in interruptions and improving session continuity.
- Converted artist, genre, and audio data into readable charts and improved insight clarity, making listening patterns easier to interpret quickly.
- Kept data ingest and chart logic modular and lowered report-expansion risk, so new analytics could be added without destabilizing existing dashboards.
- Built a music insights app that handles 10,000+ tracks per user library, presenting patterns in a way people can quickly understand.
- Improved core query speed by 50% and reduced waiting between insights, helping users stay engaged longer while exploring their data.
- Added secure login with token refresh and smoothed daily access, reducing account interruption issues.
- Presented artist, genre, and audio data in clear visuals and improved at-a-glance readability, making non-technical insights easier to consume.
- Structured the app in clean modules and reduced maintenance risk, so new reports could be added with fewer side effects.
- Built a music insights app that handles 10,000+ tracks per user library, presenting patterns in a way people can quickly understand.
- Improved core query speed by 50% and reduced waiting between insights, helping users stay engaged longer while exploring their data.
- Added secure login with token refresh and smoothed daily access, reducing account interruption issues.
- Presented artist, genre, and audio data in clear visuals and improved at-a-glance readability, making non-technical insights easier to consume.
- Structured the app in clean modules and reduced maintenance risk, so new reports could be added with fewer side effects.
- Built a music insights app that handles 10,000+ tracks per user library, presenting patterns in a way people can quickly understand.
- Improved core query speed by 50% and reduced waiting between insights, helping users stay engaged longer while exploring their data.
- Added secure login with token refresh and smoothed daily access, reducing account interruption issues.
- Presented artist, genre, and audio data in clear visuals and improved at-a-glance readability, making non-technical insights easier to consume.
- Structured the app in clean modules and reduced maintenance risk, so new reports could be added with fewer side effects.
- Built a music insights app that handles 10,000+ tracks per user library, presenting patterns in a way people can quickly understand.
- Improved core query speed by 50% and reduced waiting between insights, helping users stay engaged longer while exploring their data.
- Added secure login with token refresh and smoothed daily access, reducing account interruption issues.
- Presented artist, genre, and audio data in clear visuals and improved at-a-glance readability, making non-technical insights easier to consume.
- Structured the app in clean modules and reduced maintenance risk, so new reports could be added with fewer side effects.
This project is licensed under the GPL License - see the LICENSE.md file for details.