A modern web application that allows users to search for songs using the Spotify API and create custom playlists that are saved directly to their Spotify account.
- π Search Spotify Catalog: Search for songs, albums, or artists using Spotify's extensive music library
- β Add Tracks: Build your playlist by adding tracks from search results
- β Remove Tracks: Remove tracks from your playlist before saving
- πΎ Save to Spotify: Save playlists directly to your Spotify account with custom names
- π OAuth Authentication: Secure authentication flow using Spotify's OAuth 2.0
- π± Responsive Design: Clean, modern UI that works across different screen sizes
Visit the live application: https://jammming.xosnos.com/
- React 19 - Modern UI library with class components
- TypeScript - Type-safe JavaScript for better code quality
- Vite - Fast build tool and development server
- Spotify Web API - Music search and playlist management
- OAuth 2.0 - Secure user authentication
- CSS3 - Custom styling for a polished user experience
Before you begin, ensure you have:
- Node.js (v18 or higher)
- npm or yarn package manager
- A Spotify account
- Spotify Developer account (for API credentials)
git clone https://github.com/yourusername/jammming.git
cd jammmingnpm install- Go to Spotify Developer Dashboard
- Create a new app
- Copy your Client ID
- Add your redirect URI(s) in the Spotify app settings:
- For local development:
http://localhost:5173/ - For production:
https://your-domain.com/(e.g.,https://jammming.xosnos.com/)
- For local development:
- Create a
.envfile in the root directory:
cp .env.example .env- Edit
.envand add your Spotify credentials:
VITE_SPOTIFY_CLIENT_ID=your-client-id-here
VITE_SPOTIFY_REDIRECT_URI=http://localhost:5173/Note:
- The
VITE_prefix is required for Vite to expose these variables to the client-side code - For production, update
VITE_SPOTIFY_REDIRECT_URIto your production URL - Never commit your
.envfile to version control (it's already in.gitignore)
npm run devThe application will open at http://localhost:5173
npm run buildjammming/
βββ src/
β βββ components/
β β βββ App/ # Main application component
β β βββ SearchBar/ # Search input component
β β βββ SearchResults/ # Display search results
β β βββ Playlist/ # Playlist builder component
β β βββ Tracklist/ # Reusable track list component
β β βββ Track/ # Individual track component
β βββ util/
β β βββ Spotify.ts # Spotify API integration
β βββ main.tsx # Application entry point
β βββ index.css # Global styles
βββ public/ # Static assets
βββ package.json # Dependencies and scripts
- Implements OAuth 2.0 implicit grant flow for authentication
- Uses Spotify Web API endpoints for:
- Track search (
/v1/search) - User profile (
/v1/me) - Playlist creation (
/v1/users/{user_id}/playlists) - Adding tracks to playlists (
/v1/users/{user_id}/playlists/{playlist_id}/tracks)
- Track search (
- Fully typed with TypeScript interfaces
- Strict TypeScript configuration enabled
- Type-safe API responses and component props
- Class-based React components
- Proper state management
- Reusable components (Tracklist, Track)
- Clean separation of concerns
- User clicks search or attempts to save a playlist
- Application checks for valid access token
- If no token exists, redirects to Spotify authorization page
- User authorizes the application
- Spotify redirects back with access token in URL
- Token is extracted and stored for API requests
The application is configured for deployment on Vercel:
- Push your code to GitHub
- Import the project in Vercel
- Configure Environment Variables in Vercel:
- Go to your project settings in Vercel
- Navigate to "Environment Variables"
- Add the following variables:
VITE_SPOTIFY_CLIENT_ID- Your Spotify Client IDVITE_SPOTIFY_REDIRECT_URI- Your Vercel deployment URL (e.g.,https://jammming.xosnos.com/)
- Update the redirect URI in Spotify Developer Dashboard to match your Vercel URL
- Redeploy your application (Vercel will automatically use the new environment variables)
Important: After adding environment variables, you must redeploy for them to take effect.
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run lint- Run ESLint
- Modify styles in component-specific CSS files
- Update colors and fonts in
src/index.css - Customize playlist default name in
src/components/App/App.tsx