A client-side web application that generates beautiful Spotify-style poster images from track links. Built with React, Vite, and Tailwind CSS using Spotify's PKCE authentication flow.
- 🎵 Track Input: Accept Spotify URLs, URIs, or raw track IDs
- 🎨 Pixel-Perfect Design: Recreates Spotify's mobile player interface
- 🖼️ Multiple Templates: Choose between mobile player, polaroid-style, or Spotify code designs
- 🎭 Dynamic Theming: Auto-extracts colors from album art for personalized gradients
- ⏱️ Customizable Time: Adjust the "paused at" moment with a slider
- 📱 Responsive Design: Works on desktop and mobile devices
- 🖼️ High-Quality Export: Download posters as PNG images with dom-to-image
- 🔐 Secure Authentication: Uses Spotify's PKCE flow (no backend required)
- 📊 Spotify Codes: Generate authentic-looking Spotify codes for your tracks
Choose between three stylish templates for your Spotify track images:
-
Clone the repository
git clone https://github.com/SinaKarimi7/spotify-polaroid.git cd spotify-polaroid -
Install dependencies
npm install
The project uses these key dependencies:
reactandreact-dom- UI componentsdom-to-image- For high-quality image generationprop-types- For component prop validation
-
Create Spotify App
- Go to Spotify Developer Dashboard
- Create a new app
- Add
http://localhost:5173/as a redirect URI - Copy your Client ID
-
Environment Configuration
cp .env.example .env
Edit
.envand add your Spotify credentials:VITE_SPOTIFY_CLIENT_ID=your_spotify_client_id_here VITE_SPOTIFY_REDIRECT_URI=http://localhost:5173/ -
Start the development server
npm run dev
-
Open your browser Navigate to
http://localhost:5173
- Connect with Spotify: Click the login button to authenticate
- Enter Track Info: Paste any Spotify track URL, URI, or ID
- Fetch Track Data: Click "Fetch Track" to load the song information
- Choose Template: Select either "Mobile" (default) or "Polaroid" style
- Customize Time: Use the slider to set the playback position
- Download: Click "Download PNG" (or "Save Polaroid") to save your image
- URL:
https://open.spotify.com/track/18lR4BzEs7e3qzc0KVkTpU - URI:
spotify:track:18lR4BzEs7e3qzc0KVkTpU - Track ID:
18lR4BzEs7e3qzc0KVkTpU
- React 18 - UI framework
- Vite - Build tool and development server
- Tailwind CSS - Styling framework
- dom-to-image - High-quality image generation
- Spotify Web API - Track data and authentication
- Color Analysis - Dynamic extraction of album art colors
src/
├── auth.js # Spotify PKCE authentication
├── utils.js # Utility functions (parsing, formatting, API calls)
├── SpotifyCanvas.jsx # Rendering component with mobile and polaroid templates
├── SpotifyFonts.css # Custom fonts for Spotify-accurate typography
├── App.jsx # Main application component
├── main.jsx # React entry point
└── index.css # Global styles
- Uses Spotify's PKCE (Proof Key for Code Exchange) flow
- No backend required - fully client-side
- Automatic token refresh
- Persistent login state
- High-quality image generation using dom-to-image
- Multiple template options (Mobile or Polaroid style)
- 2x scale factor for crisp, high-resolution output
- Clean, modern polaroid style with Spotify's color scheme
- Exact recreation of Spotify's mobile player UI
- Dynamic album artwork loading with fallbacks
- Intelligent color extraction from album art for personalized gradients
- Two-column layout on desktop
- Stacked layout on mobile
- Optimized for various screen sizes
npm run buildThe build output will be in the dist/ directory.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Spotify for providing the Web API
- The iconic Spotify design that inspired this project
- The React and Vite communities for excellent tooling


