This project is a web application that converts a Discogs URL into a Spotify playlist. It leverages Go for the backend logic and server-side rendering, enhanced with HTMX for interactivity and styled using Tailwind CSS.
-
Login to Spotify. Your playlist will be created automatically in your account.
-
Introduce a Collection, Wantlist or List URL from Discogs.
Examples of valid URLs:
- Collection:
https://www.discogs.com/es/user/username/collection - Wantlist:
https://www.discogs.com/es/wantlist?user=username - List:
https://www.discogs.com/es/lists/SomeList/1545836
- Collection:
-
Enjoy the music.
- Backend: Go, gin, gorilla/sessions
- Frontend: HTMX, Tailwind CSS
- APIs: Discogs API, Spotify API
- Go 1.23
- Spotify Developer Account with a registered application.
-
Clone the repository:
git clone https://github.com/your-username/discogs-to-spotify.git cd discogs-to-spotify -
Set up environment variables:
Create a
.envfile with the following keys:SPOTIFY_CLIENT_ID=your_spotify_client_id SPOTIFY_CLIENT_SECRET=your_spotify_client_secret SPOTIFY_REDIRECT_URI=http://localhost:8080/auth/callback SPOTIFY_PROXY_URL=https://your-auth-proxy-url.com (optional, for local development) SESSION_KEY=random_secret_for_gorilla_session PORT=8080 ENV=development
Since Spotify deprecated localhost redirects, this app includes built-in auth proxy functionality for local development:
Setup Steps:
-
Deploy your app (if not already deployed):
# Deploy to your preferred platform (Koyeb, Heroku, Railway, etc.) # Example: Deploy to your preferred platform (Koyeb, Heroku, Railway, etc.) following their documentation.
-
Configure environment variables:
# In your local .env file: SPOTIFY_PROXY_URL=https://your-deployed-app-url.com ENV=development # In your production deployment: LOCAL_DEV_URL=http://localhost:8080 # Points to your local dev server
-
Update Spotify app settings:
- Redirect URI:
https://your-deployed-app-url.com/auth/proxy/callback/spotify
- Redirect URI:
How it works:
- User clicks login on
localhost:8080 - Spotify redirects to your production app at
/auth/proxy/callback/spotify - Your production app redirects the user back to
localhost:8080/auth/callback - Your local dev server handles the callback normally
Alternative: Use tunneling tools (ngrok, cloudflared, etc.)
-
Install and run a tunnel to your local server:
# Using ngrok ngrok http 8080 -
Use the provided HTTPS URL as your redirect URI in Spotify app settings.
⚠️ Important: TheSPOTIFY_REDIRECT_URIshould be set to your local callback URL (http://localhost:8080/auth/callback) only for local development. For production deployments, setSPOTIFY_REDIRECT_URIto your production callback URL (e.g.,https://your-deployed-app-url.com/auth/callback). In both cases, the Spotify app settings should use your production app's proxy URL. -
-
Install dependencies:
go mod tidy
-
Run the application:
go run main.go
-
Open your browser and navigate to
http://localhost:8080.
For production deployment, you don't need the auth proxy. Simply:
-
Set your environment to production:
ENV=production SPOTIFY_PROXY_URL= # Leave empty or remove
-
Configure your Spotify app redirect URI to your production callback URL:
https://your-production-domain.com/auth/callback
├── internal/
│ ├── adapters/ # External service adapters (Spotify, Discogs)
│ ├── core/ # Business logic and entities
│ ├── infrastructure/ # Configuration, server, session management
│ └── usecases/ # Application use cases
├── static/ # Static assets (CSS, images)
└── main.go # Application entry point
Contributions and feedback are welcome! Feel free to submit a pull request or open an issue for discussion. (🚧 CONTRIBUTE.md WIP 🚧)
This project is licensed under the MIT License. See the LICENSE file for details.
Happy playlisting! 🎵
