I made a web app that creates Spotify playlists for you
Tags: showdev, webdev, spotify, music
Published: 2024-01-24 12:07:33

---
title: I made a web app that creates Spotify playlists for you
published: true
description: A webapp that recommends you new songs on Spotify, similar to what you wish for
tags: showdev, webdev, spotify, music
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z68os9cc2877x9k5vhlq.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-01-24 17:37 +0530
---
## What did I build?

This is [Kipify](https://kipify.vercel.app/), a web app that helps you find new music on Spotify. Kipify analyses your Spotify data from the past to determine what you enjoy and what you don't, and then accurately (it tries its best) generate recommendations.

What makes it different from Spotify recommendations is that you can also get tracks, similar to specific tracks. To use the app all you have to do is login with your Spotify account, and hit create on one of the two methods provided. Kipify will then automatically make a playlist of 50 tracks.

## Why did I build it?

It originally started as a final project for [Harvard CS50](https://cs50.harvard.edu/x/) Final Project, but then I decided to take it much further considering I myself need something like this. Kipify isn't a paid service, it's actually open sourced. Here's the GitHub repository with all the source code: [https://github.com/kipifyapp/webapp](https://github.com/kipifyapp/webapp)

Although the project was completed in October 2023 itself, I'm only posting about it now because I had school and couldn't really find the time and I forgot.

## How did I built it?

No I did not design the logo, Microsoft Bing AI did it for me. Yes I came up with the name.

Now here is the technological part you have been waiting for...
Kipify was built using Node.js, Tailwind CSS, Express.js, and the Spotify Web Api. It is hosted with the help of Vercel.

I was initially going to use Next.js, but then it turned out to be a little too complicated for me given how much time I had. So I chose to use plain HTML with Tailwind css.

A little command helped me make sure the site looked pretty:
```
"scripts": {
    "tailwind": "npx tailwindcss -o public/styles/build.css --minify"
}
```
Yes I used `npm run tailwind` every time I made a change to the styling. Not at all the best way to develop, but fair enough...

Although I had to little extra bits to add to the backend, I still chose Vercel because it has much better features, it's free while still being performant (serverless functions).

### The "Algorithm"

- The user is provided with two ways to create a playlist `Create from profile` or `Create from tracks`.

- In case the user selects the first option, the top 5 tracks they have listened to the most in the past month are selected. We get this data from [Get User's Top Items API](https://developer.spotify.com/documentation/web-api/reference/get-users-top-artists-and-tracks).

- In case the user selects the second option, they have to provide URLs for 1-5 Spotify tracks.

- After that we get the audio features of all the tracks using [Get Several Tracks' Audio Features API](https://developer.spotify.com/documentation/web-api/reference/get-several-audio-features).

- Then one by one we get the recommendations for each track using [Get Recommendations API](https://developer.spotify.com/documentation/web-api/reference/get-recommendations).

- All the **recommended** tracks are ranked according to how many recommendations they appear in. And then the top 50 tracks are chosen from that. Let me give you an example:

```
Track 1 Suggestions: A, B, C, G
Track 2 Suggestions: B, D, F, H
Track 3 Suggestions: A, B, E, I

Suggested tracks list:
- 3 (appeared 3 times): B
- 2 (appeared 2 times): A
- 1 (appeared once): C, E, F, G, H, I

If only top 5 tracks are to be selected,
the final generated tracks list would be:
B, A, and 3 more random tracks from `1`
```

- The 50 generated tracks are then put into a playlist using [Add Items to Playlist API](https://developer.spotify.com/documentation/web-api/reference/add-tracks-to-playlist).

- The playlist name is put as `Kipify Mix`, the reason is that Spotify creates personalized playlists a lot of times, like `Rock Mix`, `Pop Mix`, etc. Therefore the playlist name containing `Mix` gives the impression that it is a playlist created by Spotify itself, which would attract anyone stalking our user's profile. The playlist description is put as `Playlist created by kipify.vercel.app for <username>`. Yet another little trick to get more people to know that Kipify exists.

***

A lot of people I have told about this app have had good experience so far. The generated playlist is fairly accurate and definitely helps in finding new music.

I do aspire to build this app bigger and better in the near future (probably not in the next 2 years), going beyond recommendations. Maybe a way to automate the whole process of migrating all your playlists to YouTube Music.....

Here's the link to the web app incase you missed it above: [https://kipify.vercel.app/](https://kipify.vercel.app/)

Looking forward to the feedback in the comments below :D

*p.s ive been using spotify since 4 years and i still have not paid for premium*