← Back to projects

Spotify Web Clone

Spotify Web Clone is a project I put together to learn TypeScript and Redux. It has most features of the original web player such as: search functionality, playing songs, creating playlists and more.

Type

Personal project

Stack

React

TypeScript

Styled-Components

Redux Toolkit

Express.js

Vercel

Spotify API

Source code
Github
Desktop version of Spotify clone

Purpose / Goals

Before I started on this project the main purpose of it was just to learn TypeScript and Redux. However, the purpose has slowly changed. After spending hundreds of hours implementing the core features and finishing the application. I realized that I have written a decently large code base. That's why I will keep using this project as my personal sandbox to practice web development. It can be all kinds of things: spicing things up in the user interfaces, practice writing more consistent and maintainable code or just trying new technologies out.

Tech Stack

For this project I used React and Styled-Components as the frontend. I chose React because it's the library that I'm most familiar with for building user interfaces. As for Styled-Components, I chose this one because I like the way how you write the styling. It is similar to traditional CSS, but customizing styles depending on the state has never been easier. For the backend I used Express to handle the communication between the client and Spotify authentication. New technologies that I used in this project were TypeScript and Redux.

TypeScript is something I always wanted to try during my studies but never took the time to do it. Silly me was afraid that it would add an extra layer of difficulty to the assignments. Now that I have used it, I can say that I regret not trying it earlier. While the first few days were rough, it was definitely worthwhile getting through it. With the static typing I can solve any potential errors before I even run the code. It has also helped me code faster with the code completion that TypeScript provides.

As for Redux, I have seen many people recommend and use it in tutorials before. However I never had the feeling that I must include it in my projects too as it was too excessive for how small my applications were. Especially when you can use useContext from React instead. After using it on (in my opinion) a large project like this, I did notice some advantages. The most noticeable one for me was enforcing more structure in how you write code. It is easier to predict the code flow as most actions follow the same steps. Another advantage that is specific to this project is the convenience of having global state. Fetching data from the global state instead of making a new call has saved me from making so many redundant fetch requests.

React
TypeScript
styled-components
Redux
Vercel
Spotify

Problems I've faced

Learning new technologies does not come without problems. One of the biggest struggles I've had to face was creating reusable components that supports multiple variants. I needed to figure a way out to only accept a set of data that is associated with the specific variant and exclude everything else. I managed to solve this problem by predefining typings for all variants and place them in an union type. Now the component knows what properties to expect by only filling in the variant. I could have disregarded the variants aspect and splitted it into several components to save me some time. However, I would lose the ability to quickly see which variants already exists.

Another problem that I've faced was figuring out how to make the application responsive for both smaller and larger viewports. For some reason I was hard stuck on the idea that all components should fit on all viewports. I realized that thinking this way was wrong and that certain components only works for certain viewports. Instead what I should and eventually have done is creating extra components. These components has the same functionality as the other viewport version, but fits the experience of that viewport better.

Mobile version of Spotify clone

Future plans

I will keep working on this project to clean up the code and use it as my personal playground to test any technology that I'm curious about.

As for the features, I have already implemented most of the endpoints that Spotify API has to offer. I do have plans to add custom features. Just to name a few. Show genre tags next to the track info. Export or share your monthly top artists and track. Discover new songs based on the audio features of a track such as acousticness, danceability and more.