Music Recommender - Medium Story Example
This is a simple music recommender system example that I've created for my Medium story. You can find the story here.
Running the project
Run the following command to start the project:
make dev
and then you can access the GraphQL playground from http://localhost:4000.
Mutations
Make sure to replace <user-id>
, <genre-id>
and <song-id>
with the actual ids.
Create a user
mutation Mutation {
createUser(input: {userName: "9ssi7", email: "info@ssibrahimbas.com", favoriteGenres: []}) {
id
userName
}
}
Create a genre
mutation Mutation {
createGenre(input: {name: "rap"}) {
id
name
}
}
Create a song
mutation Mutation {
createSong(input: {
title:"Sarı Saçlım Mavi Gözlüm",
artist:"Barış Manço",
genreId:"<genre-id>"
}) {
id
title
artist
}
}
Mark Song as Listened
mutation Mutation {
markSongAsListened(userId: "<user-id>", songId: "<song-id>")
}
Queries
Get User
query Query {
user(email: "info@ssibrahimbas.com") {
id
email
userName
}
}
Get Songs
query Query {
songs{
id
title
artist
}
}
Get Genres
query Query {
genres {
id
name
}
}
Get Recommendations
query Query {
songsRecommendation(userId: "<user-id>"){
id
title
artist
}
}