A web application that visualizes your Spotify listening habits by displaying your top artists and tracks with dynamic image sizing based on ranking.
This application requires a Spotify Premium account and uses the Spotify Web Playback SDK. To ensure secure usage:
- Never commit your
.envfile to version control - Keep your Spotify Client ID private
- Set up proper redirect URIs in your Spotify Dashboard
- Use HTTPS in production
- View your top artists and tracks from Spotify
- Choose between different time ranges (4 weeks, 6 months, all time)
- Dynamic visualization with image sizes based on ranking
- Beautiful, responsive UI with hover effects
-
Create a Spotify Application:
- Go to Spotify Developer Dashboard
- Create a new application
- Note down your Client ID
- Add your redirect URIs in the app settings
-
Environment Setup:
# Copy the example environment file cp .env.example .env # Edit .env with your values VITE_SPOTIFY_CLIENT_ID=your_client_id_here VITE_SPOTIFY_REDIRECT_URI=http://your-domain.com/
-
Install Dependencies:
npm install
-
Run Development Server:
npm run dev
When deploying to production:
- Use environment variables appropriate for your hosting platform
- Enable HTTPS
- Update the redirect URI in your Spotify Dashboard
- Ensure all sensitive data is properly secured
- Set up proper CORS headers if needed
This app requires the following Spotify permissions:
- streaming
- user-read-email
- user-read-private
- user-read-playback-state
- user-modify-playback-state
- user-read-currently-playing
- user-read-recently-played
- user-top-read
-
Token Handling:
- Never store refresh tokens in localStorage
- Use secure session storage for temporary tokens
- Implement proper token refresh mechanisms
-
API Access:
- Use appropriate CORS settings
- Implement rate limiting
- Monitor for suspicious activity
-
User Data:
- Only request necessary Spotify permissions
- Handle user data according to GDPR and privacy laws
- Provide clear privacy policy and terms of service
[Add your license here]
- Start the development server:
npm run dev
- Open your browser and navigate to
http://localhost:5173 - Log in with your Spotify account when prompted
- Use the controls to select between artists/tracks and time ranges
- Click "Load Data" to fetch and visualize your top items
- React
- TypeScript
- Vite
- Spotify Web API
- Styled Components
-
Create a Vercel Account:
- Go to Vercel and sign up/login
- Connect your GitHub repository
-
Configure Environment Variables:
- In your Vercel project settings, go to "Environment Variables"
- Add the following variables:
VITE_SPOTIFY_CLIENT_ID=your_spotify_client_id VITE_SPOTIFY_REDIRECT_URI=https://your-vercel-domain.vercel.app/
-
Update Spotify Dashboard:
- Go to your Spotify Developer Dashboard
- Select your app
- Click "Edit Settings"
- Add your Vercel domain to the Redirect URIs:
https://your-vercel-domain.vercel.app/ - Save the changes
-
Deploy:
- Push your changes to GitHub
- Vercel will automatically deploy your app
- Your app will be available at
https://your-vercel-domain.vercel.app
-
Verify:
- Test the authentication flow
- Ensure playback works correctly
- Check that all features are working as expected