Skip to content

Creates a Spotify playlist with all the tracks for a given artist

Notifications You must be signed in to change notification settings

write-the-codes/all-tracks

Repository files navigation

all-tracks

all-tracks generates a complete playlist of every track by any Spotify artist—no hunting for user-made playlists required.

Demo

all-tracks-demo.mp4

Users visit the site here. Once authorised, they enter an artist's Spotify URL and click 'Create Playlist'. After a short delay, a playlist with all the artist's tracks is created in the user's Spotify account.

Unfortunately Spotify does not allow apps developed by individuals to leave 'development mode' (see here for more details). This means to use the app your account must be allow-listed, so please contact me if you wish to use the app!

Installation of dependencies

Clone repo and run yarn.

Tests

Run yarn test to run the Jest tests. However, only the small tests will work as the medium and large tests require secrets on your machine. Contact me to obtain them.

Run yarn test:cypress to run the Cypress tests. Secrets are not required for these tests. Run yarn cypress:open to open cypress. The tests can also be run from here.

API endpoints

The API can be accessed at https://d1e7htx1c4j3w0.cloudfront.net/api. See API.md for detailed endpoint documentation.

Architecture

Back-end architecture

Back-end Architecture

The back-end consists of an API Gateway, a Lambda to serve the gateway and a downstream Lambda to create playlists. The Lambda to create playlists is invoked asynchronously by the API Lambda. Playlist creation is handled in this way because creation can take a long time for artists that have a lot of tracks.

Front-end architecture

The front-end is simple HTML and JavaScript. It is served from an S3 bucket behind a CloudFront Distribution. Authorization is handled through Spotify's OAuth 2.0 flow. Once authenticated, the browser can make requests to the API.

Technical decisions and process

  • All infrastructure is managed by Terraform.
  • TDD is used throughout development.
  • CI/CD is handled by GitHub actions.
  • No external libraries are mocked out. A wrapper is created around functions that use external libraries. Small tests are used to test the functions that use the wrapper, and medium or large tests are used to test the wrapper itself. For example, a wrapper is used to make requests to Spotify. Functions that use this wrapper have small tests that mock the wrapper out. The wrapper itself is tested with medium tests that make actual calls to the Spotify API.
  • As this is a POC the front end is kept purposely simple. Ideally a framework would be used to allow easier development and testing.
  • Cypress is used to test E2E to closely simulate user interactions.

About

Creates a Spotify playlist with all the tracks for a given artist

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published