Spotify Stats for Github Pofile generates a beautiful Spotify status (including current playing song, recently played songs, and favourite artist) for github profiles.
Technically, it's a serverless function that generates a SVG image based on your Spotify state. It can be deployed on every faas providors (specially Vercel). Also It is using EJS out of the box to inject data into SVG image.
- Spotify App
- Vercel account
Before deploying this app on vercel, you need to create a Spotify app in Spotify developer dashboard. Using this app, you can access users' information (actually your information).
- Login to Spotify developer dashboard.
- Click on Create an app button and chose a name and description for your app (e.g
name: github-profile
,description: for github profile status
) - Store the
Client ID
andClient Secret
in a safe place because we have to use them in the deployment process.
Deploy on Vercel
Using this button, you can start the deployment on vercel.
On the deployment process, after setting a git repository,
On the Configure Project
set these environment variables:
SPOTIFY_CLIENT_ID
: Use your Spotify app client idSPOTIFY_CLIENT_SECRET
: Use your Spotify app client secretSPOTIFY_REFRESH_TOKEN
: Use a random value here, it will change after deployment process
- open the deployed app and go to
/init
endpoint - Complete information about how to set refresh token is mentioned on the
/init
endpoint. Follow the instructions to generate Refresh token.
After setting the refresh token, go to the root path /
and see the result :)