A full-stack web application that predicts Big Five personality traits from Spotify and YouTube Music listening patterns using advanced machine learning and music psychology research.
What if your playlist could reveal your personality?
Music & You was born from a simple observation: as a Computer Engineering student who listens to everything from Tina Turner to André Rieu’s classical performances, from Ghanaian Hilife to Lewis Capaldi, I noticed that my musical diversity was unusual among my Gen Z peers. This led to a fascinating question: Is there a connection between the songs we choose and who we are?
Unlike static reports like Spotify Wrapped, Music & You provides real-time personality analysis that explores the deeper psychological patterns in your listening habits. The platform combines music psychology research with modern machine learning to offer educational insights into how your musical choices reflect your Big Five personality traits.
The application analyzes users’ music listening patterns to predict personality traits (Openness, Conscientiousness, Extraversion, Agreeableness, and Neuroticism) while being transparent about limitations and respectful of cultural musical diversity.
Conversational AI explaining personality insights after Authentication
Musical personality overview
Musical personality traits and analysis results
music-and-you/
├── src/music_and_you/ # Python backend
│ ├── api/ # FastAPI application
│ │ └── main.py # API server with endpoints
│ ├── data/ # Data collection modules
│ │ └── spotify_client.py # Spotify API integration
│ ├── features/ # Feature engineering
│ │ ├── feature_pipeline.py # Main feature extraction
│ │ ├── temporal_features.py# Time-based analysis
│ │ └── lyrical_features.py # Lyrical content analysis
│ ├── models/ # ML models
│ │ └── personality_predictor.py # Prediction algorithms
│ └── utils/ # Utility functions
├── frontend/ # Next.js frontend
│ ├── src/
│ │ ├── app/ # App router pages
│ │ │ ├── page.tsx # Landing page
│ │ │ ├── analyze/ # Analysis results
│ │ │ ├── data/ # Music data visualization
│ │ │ └── auth/ # Authentication
│ │ ├── components/ # React components
│ │ │ ├── ChatWidget.tsx # Conversational interface
│ │ │ ├── PersonalityRadarChart.tsx
│ │ │ └── AudioDNAChart.tsx
│ │ └── lib/ # Utilities and hooks
├── tests/ # Test suites
├── docs/ # Documentation
└── docker/ # Docker configuration
Try the live demo: https://tmarhguy.github.io/music-and-you
The GitHub Pages version runs in demo mode with sample data to showcase the full functionality without requiring Spotify authentication.
http://localhost:3000/auth/callbackClone the repository:
git clone https://github.com/tmarhguy/music-and-you.git
cd music-and-you
Install and run frontend:
cd frontend
npm install
npm run dev
Build for GitHub Pages:
npm run build
The frontend will be available at http://localhost:3000
For the full application with real Spotify integration, you’ll need the backend API:
Clone the backend repository:
git clone https://github.com/tmarhguy/music-and-you-backend.git
cd music-and-you-backend
Follow the backend setup instructions in the backend repository
Configure environment variables:
cp env.example .env
# Edit .env with your Spotify credentials
Start the backend server:
uvicorn src.music_and_you.api.main:app --reload --port 8000
The application will be available at:
http://localhost:3000 (GitHub Pages compatible)http://localhost:8000 (when running locally)http://localhost:8000/docsGET /auth/login # Initiate Spotify OAuth
GET /auth/callback # Handle OAuth callback
POST /analyze # Start personality analysis
GET /analysis/{id} # Get analysis results
POST /chat # Send message to AI assistant
import requests
# Start analysis
response = requests.post('http://localhost:8003/analyze',
headers={'Authorization': 'Bearer YOUR_TOKEN'})
# Get results
analysis_id = response.json()['analysis_id']
results = requests.get(f'http://localhost:8003/analysis/{analysis_id}')
Comprehensive API documentation is available at /docs when running the backend server. The documentation includes:
We welcome contributions! Please see our Contributing Guidelines for details.
For detailed documentation, please visit the docs/ directory:
git checkout -b feature-namenpm test and pytestblack for formattingmusic-and-you/
├── src/music_and_you/ # Python backend
│ ├── api/ # FastAPI application
│ │ └── simple_main.py # Main API server with all endpoints
│ ├── data/ # Data collection
│ │ └── spotify_client.py # Spotify API integration
│ ├── features/ # Feature engineering
│ │ ├── feature_pipeline.py # Main feature extraction pipeline
│ │ ├── temporal_features.py # Time-based analysis
│ │ └── lyrical_features.py # Lyrical content analysis
│ └── models/ # ML models and analysis
│ └── personality_predictor.py # Personality prediction algorithms
├── frontend/ # Next.js frontend
│ ├── src/app/ # App router pages
│ │ ├── page.tsx # Main dashboard
│ │ ├── analyze/ # Personality analysis page
│ │ ├── data/ # Music data visualization
│ │ └── auth/ # Authentication handling
│ └── [configuration files]
└── [project configuration]
This project emerged from personal curiosity about musical diversity and psychological patterns, built on validated research in music psychology:
Foundation Research:
Personal Motivation: As someone who rotates between Tina Turner, André Rieu, Afrobeats, and Hilife in a single listening session, I wanted to understand whether musical diversity itself might be a personality indicator. This project explores both established research and new questions about cultural musical preferences.
Technical Implementation: The personality prediction models use 35+ engineered features across multiple dimensions:
This project is licensed under the MIT License - see the LICENSE file for details.
Music & You - Transforming self-discovery through music psychology and AI.
git clone https://github.com/tmarhguy/music-and-you.git
cd music-and-you
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cd frontend
npm install
# Copy example environment file
cp .env.example .env
# Add your Spotify credentials to .env
# Terminal 1: Start backend
source venv/bin/activate
uvicorn src.music_and_you.api.simple_main:app --reload --port 8000
# Terminal 2: Start frontend
cd frontend
npm run dev -- --port 3001
GET /api/auth/spotify/login - Initiate Spotify OAuthGET /api/auth/spotify/callback - Handle OAuth callbackGET /api/user/profile - Get user profile informationGET /api/user/liked-songs - Fetch unlimited liked songsGET /api/user/top-tracks - Get top tracks with time rangesGET /api/user/top-artists - Get top artists with time rangesGET /api/user/recent-tracks - Get recently played tracksPOST /api/analysis/personality - Comprehensive personality analysisThis project represents a complete implementation of music-based personality analysis. The codebase is well-structured and documented for future enhancements and research applications.
This project is for research and educational purposes. Please respect Spotify’s API terms of service and user privacy.
🎵 Discover your musical personality today! Connect your Spotify account and unlock insights about yourself through the music you love.
See RESEARCH_FOUNDATION.md for the complete research background and theoretical framework.
[Development in progress]
[To be determined]
[Research paper in preparation]
Note: This is an active research project exploring the intersection of musical diversity and personality psychology. The codebase and methodological approaches continue to evolve as we validate findings about cross-cultural musical preferences and psychological patterns.