A terminal-based Spotify client built with Rust, featuring playback control, search, and playlist management through an intuitive keyboard-driven interface.
- 🎵 Real-time playback control (play, pause, skip, volume)
- 🔍 Search for tracks, artists, and albums
- 📋 Browse and manage playlists
- ⌨️ Fully keyboard-driven navigation
- 🎨 Clean, minimalist terminal UI
- 🔄 Async API requests for responsive performance
- Rust (1.70 or later)
- A Spotify Premium account (required for playback control)
- Spotify application running on at least one device
-
Clone the repository:
git clone https://github.com/yourusername/spotify-tui.git cd spotify-tui -
Set up Spotify API credentials:
a. Go to the Spotify Developer Dashboard
b. Log in and click "Create an App"
c. Fill in the app details:
- App name:
Spotify TUI(or your choice) - App description:
Terminal-based Spotify client - Redirect URI:
http://127.0.0.1:8888/callback
d. Save your Client ID and Client Secret
- App name:
-
Configure environment variables:
Create a
.envfile in the project root:cp .env.example .env
Edit
.envand add your credentials:RSPOTIFY_CLIENT_ID=your_client_id_here RSPOTIFY_CLIENT_SECRET=your_client_secret_here RSPOTIFY_REDIRECT_URI=http://127.0.0.1:8888/callback -
Build and run:
cargo run
On your first run, the application will:
- Display an authorization URL
- Open your browser to Spotify's login page
- Ask you to authorize the app
- Redirect to
http://127.0.0.1:8888/callback?code=... - Prompt you to paste the full redirect URL back into the terminal
After initial authentication, your token will be cached for future sessions.
Playback:
Space- Play/Pausen- Next trackp- Previous track+/-- Volume up/down
Navigation:
↑/↓- Navigate listsEnter- Select itemTab- Switch between panelsEsc- Go back
Search:
/- Open search- Type to search tracks/artists/albums
General:
q- Quit application?- Show help
spotify-tui/
├── src/
│ ├── main.rs # Application entry point
│ ├── spotify.rs # Spotify API client wrapper
│ ├── ui.rs # TUI rendering logic
│ └── app.rs # Application state and event handling
├── Cargo.toml # Dependencies
├── .env # Your API credentials (not committed)
├── .env.example # Template for environment variables
└── README.md
- rspotify - Spotify Web API wrapper
- ratatui - Terminal UI framework
- crossterm - Terminal manipulation
- tokio - Async runtime
- anyhow - Error handling
- dotenv - Environment variable management
- Verify your Client ID and Secret are correct in
.env - Ensure the Redirect URI matches exactly:
http://127.0.0.1:8888/callback - Check that the redirect URI is added in your Spotify App settings
- Make sure Spotify is open and playing on at least one device
- You need Spotify Premium for full playback control
- Try refreshing or restarting the application
- The Spotify API has rate limits
- Wait a few moments before retrying
- Consider implementing caching if making frequent requests
cargo runcargo build --release
./target/release/spotify-tuicargo testContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- rspotify - Spotify API wrapper
- ratatui - Terminal UI framework
- spotify-tui - Inspiration for this project
This project is not affiliated with Spotify AB. Spotify is a registered trademark of Spotify AB.