All Projects → JL978 → Spotify Clone Client

JL978 / Spotify Clone Client

Licence: mit
A ReactJS clone application of the popular Spotify music streaming service. This application utilizes the Spotify API and the Spotify Web Playback SDK

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Spotify Clone Client

Spring Security React Ant Design Polls App
Full Stack Polls App built using Spring Boot, Spring Security, JWT, React, and Ant Design
Stars: ✭ 1,336 (+724.69%)
Mutual labels:  authentication, authorization, react-router
React Firestore Authentication
🔥Boilerplate Project for Authentication with Firestore in React.
Stars: ✭ 165 (+1.85%)
Mutual labels:  authentication, authorization, react-router
Xxl Sso
A distributed single-sign-on framework.(分布式单点登录框架XXL-SSO)
Stars: ✭ 1,635 (+909.26%)
Mutual labels:  authentication, authorization
Go Postgres Jwt React Starter
A go, gin, and postgres API with jwt auth, complete with a react frontend
Stars: ✭ 115 (-29.01%)
Mutual labels:  authentication, react-router
Serverless Architectures Aws
The code repository for the Serverless Architectures on AWS book
Stars: ✭ 120 (-25.93%)
Mutual labels:  authentication, authorization
React Mobx Firebase Authentication
🔥Boilerplate Project for Authentication with Firebase in React and MobX
Stars: ✭ 111 (-31.48%)
Mutual labels:  authentication, authorization
Mern Boilerplate
Fullstack boilerplate with React, Redux, Express, Mongoose, Passport Local, JWT, Facebook and Google OAuth out of the box.
Stars: ✭ 112 (-30.86%)
Mutual labels:  authentication, authorization
Graphql Directive Auth
GraphQL directive for handling auth
Stars: ✭ 120 (-25.93%)
Mutual labels:  authentication, authorization
Warden Github Rails
Use GitHub as authorization and more. Use organizations and teams as means of authorization by simply wrapping your rails routes in a block. Also useful to get a user's details through OAuth.
Stars: ✭ 100 (-38.27%)
Mutual labels:  authentication, authorization
Registration Login Spring Xml Maven Jsp Mysql
Registration and Login Example with Spring MVC, Spring Security, Spring Data JPA, XML Configuration, Maven, JSP, and MySQL.
Stars: ✭ 134 (-17.28%)
Mutual labels:  authentication, authorization
Laravel Auth
A powerful authentication, authorization and verification package built on top of Laravel. It provides developers with Role Based Access Control, Two-Factor Authentication, Social Authentication, and much more, compatible Laravel’s standard API and fully featured out of the box.
Stars: ✭ 128 (-20.99%)
Mutual labels:  authentication, authorization
Fullstack Apollo React Boilerplate
💥A sophisticated Apollo in React boilerplate project.
Stars: ✭ 136 (-16.05%)
Mutual labels:  authentication, authorization
Spring Webmvc Pac4j
Security library for Spring Web MVC: OAuth, CAS, SAML, OpenID Connect, LDAP, JWT...
Stars: ✭ 110 (-32.1%)
Mutual labels:  authentication, authorization
Express Jwt
An example API for creating/verifying json web tokens
Stars: ✭ 105 (-35.19%)
Mutual labels:  authentication, authorization
Cakephp Tinyauth
CakePHP TinyAuth plugin for an easy and fast user authentication and authorization. Single or multi role. DB or config file based.
Stars: ✭ 114 (-29.63%)
Mutual labels:  authentication, authorization
React Bootstrap Webpack Starter
ReactJS 16.4 + new React Context API +react Router 4 + webpack 4 + babel 7+ hot Reload + Bootstrap 4 + styled-components
Stars: ✭ 103 (-36.42%)
Mutual labels:  axios, react-router
Reeakt
A modern React boilerplate to awesome web applications
Stars: ✭ 116 (-28.4%)
Mutual labels:  axios, react-router
Express Mongodb Rest Api Boilerplate
A boilerplate for Node.js apps / Rest API / Authentication from scratch - express, mongodb (mongoose).
Stars: ✭ 153 (-5.56%)
Mutual labels:  authentication, authorization
Appy Backend
A user system to bootstrap your app.
Stars: ✭ 96 (-40.74%)
Mutual labels:  authentication, authorization
Sentinel
A framework agnostic authentication & authorization system.
Stars: ✭ 1,354 (+735.8%)
Mutual labels:  authentication, authorization

Spotify Clone Front-End

A front-end clone project of the Spotify web player. The project was created using the create-react-app CLI. The app is meant to work in conjunction with an authorization/authenication server found at this repo.

Table of Contents

Description

A clone web application using the create-react-app. The app comsumes data from the Spotify API and tries to mimic the UI and front-end behaviours of the official Spotify web player as much as possible.

App Screen Shot The main screen (non-authenicated) of the app

Like the official app, if a user is not authenticated, they can still browse and look up different playlists, albums, artists and users. Non authenticated users cannot control the player and go to certain protected routes - if they tried to navigate to these routes, a tooltip pops up prompting login.

Non-authenticated app demonstration Non-authenticated app demonstration

If a user login to a premium account (due to the limitation of the available API, free accounts cannot do much), user can access certain routes to their own playlists, saved items, etc. and use the app as a remote control player to any playing official (no direct streaming is available through the API)

Authenticated app demonstration Authenticated app demonstration

Remote player demonstration Remote player demonstration

Motivation

This project was created by me mainly to teach myself React development. Since the point of this project was not to make great UI/UX design choices, I chose to create a clone of a well established product as to shorten my learning time and not to focus on the wrong thing. Since I am already a heavy Spotify user and therefore I thought it would be an interesting challenge to tackle.

The majority of the react components and logic was written from scratch by myself. I chose not to use existing component libraries because that forces me to both get a really deep understanding of React and get as much practice as I could with React.

Tech/Framework Used

  • React (create-react-app CLI)
  • react-router-dom
  • axios

Installation

This project requires node and npm installed globally.

Clone the repository to a directory of your choosing

$ git clone https://github.com/JL978/spotify-clone-client.git

Navigate into spotify-clone-client and install the necessary packages

$ npm install 

To start up the app locally

$ npm start

Additionally, this project also requires you to clone and run the server code from this repo to work properly.

Architecture

Authentication and Authorization

As mentioned from before this app needs to be used with a authentication server with the code provided on another repo, you can navigate there to learn more about how the server works. On this end, in order to be logged in, the app must have 2 things: a refresh_key stored in cookie and an access_key stored in memory. When there these values are present, the user is effectively "logged in" and therefore the app will render the "logged in" version with the user's personal info. The benefit of doing authorization this way is that we are not exposed to XSRF by avoiding having the access_key stored in cookie while also keeping the user logged in if they refresh the app through the following flow.

Authorization flow

As far as I know, this is the safest way to handle keys in OAuth flow.

Custom hooks and utilities

One of the more interesting functionality from this project is the infinite scroll on playlists and search results. This feature was made using custom hooks and integration with the Spotify API pagination system.

The hooks was named useInfiScroll and useTokenScroll, they are both effectively the same with the useTokenScroll requesting for private information with the access token. The hook make use of useState, useRef, useCallback and the IntersectionObserver API. It takes in a setList (from a useState hook) function from the parent component (which is use internally to set the paginated list) and return a useCallback ref to be passed to the last element of the list and a setNext to store the next paginated uri during initial setup. The challenge of using ref here is the use of functional component in this project which one cannot simply pass a ref parameter to. The solution to this is using React.forwardRef on the child component. One thing I would do different next time is to use Composition as much as possible instead of Inheritance so that I don't have to pass refs through multiple component levels.

Another interesting feature of this app is the live search feature where search results are updated as the user type into the search box. In doing this, the app is making a new request to the API everytime a new letter is entered. However, sometimes typing can be a faster than the request is able to finish and the request may become stale as the user type. Therefore, being able to cancel the request on the fly is needed.

[More coming soon...]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].