Spotify Party is a web application to control the queue of my personal Spotify account. Initial motivation behind the project was to be able to share a queue of someone, so people at a party have the possibility to add a song to the queue on their device and not have to pass around the smartphone of the account owner. The application is fully deployed on AWS. The backend consists of an API Gateway and Lambda functions, which makes it fully serverless.
- Domain is registered with
Route53
and points toCloudFront
CloudFront
fetches and caches the static files in order for theReact App
to workReact App
makes requests to theAPI Gateway
to view and make changes to the Spotify queue
API Gateway
suppplies endpoints to invoke theLambda functions
get-queue
,search-tracks
andupdate-queue
use the access token stored in theSecretsManager
to access the Spotify APIapi-login
andapi-callback
use theclient_id
andclient_secret
to fetch a token from the Spotify API
- When request of the
React App
returns anUNAUTHORIZED
error user gets redirected to this endpoint - Builds request with URL encoded parameters and redirects to the Spotify login
- After successful Spotify login the user gets redirected to this endpoint
- Forms request with
code
provided from Spotify for an access token - Saves fresh token from response in the
SecreatsManager
and redirects user back to the base domain
- Create ECR repositories for the images of the Lambda functions, with name
spotify-party-{name of the Lambda}
- Build the image of each Lambda except
token-caller
- Push the images to it's corresponding repository in the registry
- Import required dependencies with
npm install
- Build the static
js
,css
andhtml
files withnpm run build
- Run
terraform init
to initialize required modules - Then run
terraform apply
and supply theclient_id
andclient_secret
given by Spotify for the API registration
The Lambda functions will then automatically draw their images from the created registries and the static files for the React App will be uploaded as S3 objects
.