PlaylistSmith is a web-based Spotify playlist manager powered by FastAPI and a lightweight browser UI. Authenticate with Spotify, browse your playlists, reorder songs by metadata, and remove duplicate tracks without deleting any content.
🎧 Smart playlist sorting from your browser.
🚀 Reorder tracks, remove duplicates, and keep your playlist clean.
- 🔐 Spotify OAuth authentication
- 🌐 Browser-based UI served from
/static - 📄 Browse your Spotify playlists
- 🔀 Reorder playlist tracks by:
- Artist
- Release date
- Duration
- Popularity
- 🧹 Remove duplicate tracks while keeping the first occurrence
- 🧩 Lightweight FastAPI backend with static frontend support
- 🐳 Docker Compose deployment ready
- A Spotify account (free or premium)
- Internet connection
-
Clone the repository
git clone https://github.com/jabelzzz/playlistsmith.git cd playlistsmith -
Install dependencies
Using Pipenv:
pip install --user pipenv pipenv install --dev pipenv shell
Or with pip directly if you prefer:
python3 -m pip install --upgrade pip python3 -m pip install fastapi uvicorn spotipy python-dotenv
-
Configure Spotify credentials
Pass the required Spotify environment variables to Docker Compose from your shell.
Example:
export SPOTIPY_CLIENT_ID=12345 export SPOTIPY_CLIENT_SECRET=123144 export SPOTIPY_REDIRECT_URI=http://localhost:8000/callback export COOKIE_SECURE=false docker compose up -d --build
- Register an app at the Spotify Developer Dashboard.
- Add
http://localhost:8000/callbackas a Redirect URI.
Start the application with:
python3 main.pyThen open your browser at http://127.0.0.1:8000.
- Click Login with Spotify.
- Authorize the app with Spotify.
- The OAuth callback stores the access token in a server-side session and sets an HTTP-only session cookie.
- Browse playlists and select one.
- Sort tracks or remove duplicate songs.
GET /login— redirect to Spotify authorizationGET /callback— OAuth callback handlerGET /playlists— list current user playlistsPOST /sort— reorder playlist tracksPOST /remove_duplicates— remove duplicate tracks from a playlistGET /health— health check endpoint
Build and run with Docker Compose:
docker compose build --pull
docker compose up -dThe service listens on port 8000 by default.
Verify the service:
curl -f http://127.0.0.1:8000/healthplaylistsmith/
├── Dockerfile
├── Pipfile
├── Pipfile.lock
├── README.md
├── docker-compose.yml
├── main.py
├── playlistsmith/
│ ├── api.py
│ ├── web_app.py
│ ├── static/
│ │ ├── app.js
│ │ ├── index.html
│ │ └── styles.css
│ ├── services/
│ │ ├── sort_playlist.py
│ │ └── spotify_auth.py
│ └── __init__.py
└── tests/
└── test_playlist_sorter.py
- All Spotify credentials and session options must be configured through
docker-compose.yml. - The application stores the Spotify access token server-side and does not expose it to browser storage.
Contributions are welcome.
- Fork the project
- Create a new branch
- Commit your changes
- Push to your branch
- Open a Pull Request
No license file is included in the repository at this time.
Made with ❤️ by Jabel Álvarez