This project is a basic server-client application that allows users to view what is currently playing on their Spotify account through a website. The backend server is written in Go and uses the Spotify API to get information about the user's spotify account. The server will log songs that the user listens to in a SQLite database, the logic for when the server logs a song is explained in the docs here WIP. The frontend is written in Vue 3. The frontend will display the currently playing song (e.g. album art, artist name and song name), how far into the song the user is, as well as a small history of the last songs played and the future queue of songs to be played.
We use sqlc to generate the database code, you can install it by running
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latestTo run the backend first configure the config variables by copying config-example.yaml to config.yaml and filling in the values.
To get the clientId and clientSecret first follow the instructions here to create an app, and then get the values from the Spotfy App dashboard.
Then you have to generate the GraphQL schema and database types by running
make generateEvery time you change something in ent/schema you have to run this command again.
Then run the backend with the following command:
make startcd web
npm i
npm run generate
npm run dev
cd web
npm i
npm run build
This project primarily uses Dagger for CI. To run the CI locally you can use the following command:
dagger call publish --source=.And then run the resulting container with:
mkdir dockerdata
cp config.yaml dockerdata/config.yaml
cp token.json dockerdata/token.json
docker run -v $(pwd)/dockerdata:/app/config -p 8080:8080 <container url> Most configuration is done through a yaml file called config.yaml, an example file is provided in config-example.yaml. All variables can be overridden by environment variables, but due to a limitation in the config library, they must still be present in the config file. When overriding nested variables, use a _ to separate the levels. For example, to override the clientId variable in the spotify section, you would set the environment variable SPOTIFY_CLIENTID.
