---
# System prepended metadata

title: 'Fankee: Playlist Code Challenge'

---

<img src="https://fankee.co/icons/fankee-1024.png" width="200">

---

# Fankee: Playlist Code Challenge

## 🎯 Objective

This task involves using a Spotify account to programmatically create a playlist featuring a specified set of songs. 
Once the playlist is established, the aim is to **monitor and record the streams generated for each song** within the playlist over a given period.

## ⚙️ Project Constraints

We have set some constraints to align this challenge with Fankee's necessities.

### Timing Constraints 🕒

There is no fixed time frame for providing the requested functionalities. However, we expect the workload to cover a period of time no longer than **1 week**. If you plan to work on a broader time frame, please let us know about it in advance.

### Technology Stack 💻

Fankee's technology stack is briefly composed of the following:

* Development mainly in Node/TypeScript
* Use of React/Next.js with TailwindCSS for front-end
* Persistence backed by Supabase
* Deployment on Vercel

Use this information to reason how to structure and design your development strategy and the required artifacts as outputs discussed in the next part of this memo.

## 📋 The output, what we expect from you

In this challenge, your goal is to create a Spotify playlist containing the provided songs and track the streams generated for each song.

You should carefully define and describe (with clear justifications) these elements:

- **Define and describe**: an ER Schema to model the necessary entities and their relationships. Make sure this model aligns with the already existing Fankee schema we provide you.

- **Identify and provide an implementation for**: the Spotify APIs needed to create a playlist and to add songs to that playlist.

- **Define and describe**: one or more development solutions for measuring the tracks' impact within the playlist, to be discussed with the Fankee team and the CEO.

- **Provide**: a project Git repository with the implementation of the requested functionalities.

Even if not strictly required, you can also provide a series of sequence diagrams identifying and supporting the proposed solutions.

## 🖇 Provided Resources 

You will have access to a Spotify for Artists account, already including a single-track release. You will also be provided with the schemas of the entities already composing the Fankee architecture.

### Spotify Account 🎵

You can access the Spotify account through the following link: https://accounts.spotify.com/login

By using the following credentials:

**username**: lorenzogiani10@gmail.com
**password**: Fankeecodechallenge!

From this account, you will be able to access the track release **"Love Vibrations"**, along with its unique identifier and other metadata. Include this song in the newly created Spotify playlist and measure the streaming it generates.

From [this](https://artists.spotify.com/c/artist/40ZxZE6KxE27h50FXRYRPu/song/1YMpaRJkm3M2E1JYpxTJyU/playlists) page, you can have a look at the streams generated by the track for every playlist it is included in.

If "Love Vibrations" doesn't display streams generated from your newly created playlist, you can use the "Example Playlist", or other playlists already included in the account.

:::danger
Please **DO NOT** delete the "Example Playlist" or the "Love Vibrations" track, Spotify can take up to a few days to restore and display the streaming already generated.
:::

### Entities Schema 👥

We are also providing the entities currently composing the Fankee schema involved in this challenge.

:::info
Feel free to use different entities' names and remove unrelated fields when it comes to your ER schema implementation.
:::

**Profile**: Represents the account creating the playlist.

<img src="https://hackmd.io/_uploads/ByqMFnGJ1x.png" width="200">
<br><br>

**Competition_Entry**: Represents individual songs that will be added to the playlist.

<img src="https://hackmd.io/_uploads/BkQ5c3fk1x.png" width="200">
<br><br>

**Track_DSP_Stream**: Represents the stream data for each song in the playlist.

<img src="https://hackmd.io/_uploads/S1u5F3Mykl.png" width="200">
<br><br>

## 🏁 Challenge Brief

### Playlist Generation 🎧

The first part of this challenge invites participants to design and implement a feature allowing users, given a set of songs, to create a playlist in the Fankee Spotify account and programmatically include those songs.

:::warning
To avoid confusion with other participants, name the playlist in a way that can be uniquely associated with you.
:::

You can structure this functionality as a set of APIs or functions that can be called through a user action, a script, or a similar automation. Describe how you would integrate the solution you provided within the Fankee architecture, and the steps necessary to reproduce the expected results.

After creating the playlist, you should be able to see it [here](https://open.spotify.com/user/31x4rz2x7b6uwybybambc35y6ukm).

### Track Streaming Measurement 📈

The second part of the challenge consists of finding one or more integration methods (third-party tools, official or scraping APIs, etc.) that can help Fankee measure the streams generated by a certain song **within** a playlist.

:::warning
Please consider it will not be possible to adopt solutions involving partnerships with Spotify.
:::

Make sure to take into consideration costs, ease of integration, robustness, and legal limitations for each of the proposed solutions. We currently have ~50 artists and ~1500 users, so you can use these numbers to evaluate your proposal.

:::info
Keep in mind that costs should be able to scale well with a larger user base, but still be manageable for the current numbers of users and playlists.
:::

You can either provide the full implementation for each of the solutions proposed or a list of steps that can be followed to obtain the track streaming data.
Make sure the tools you consider can be fully integrated with the current Fankee architecture. We will also consider manual steps if easy enough to perform. If necessary, provide the expected user flow necessary to complete the task, exposing the effort needed to leverage tools manually.

### Bonus Track for 🥷

- Explore the idea of connecting users' Spotify accounts to ease or enhance the playlist creation functionality, listing the pros and cons of such an approach.
- Provide examples of how to automatically help the user generate a playlist name, description, and cover image.


## 📬 Submission

Please submit your artifact as HTTP sharable links or PDFs, and the code as a Git repository using a Git bundle with all commits preserved, or share it with us on GitHub or GitLab.

Don't hesitate to contact us if you have any doubts or questions.

## 📅 Review

The review process will consist of a two-hour session with the Fankee product and leadership team. The exact date of the review will be agreed with you after your submission.
