Skip to content
API for retrieving currently playing track in Spotify
JavaScript HTML CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.dependabot
app update node runtime to 10.x Oct 23, 2019
auth Bump aws-sdk from 2.559.0 to 2.564.0 in /auth Nov 6, 2019
playback-state Bump aws-sdk from 2.559.0 to 2.564.0 in /playback-state Nov 6, 2019
.eslintignore
.eslintrc
.gitignore added handling for custom endpoint URL, prepared for production deplo… Apr 1, 2019
LICENSE Resolves #20 added LICENSE file Mar 16, 2019
README.md changed `npm install` to `npm ci` in README May 23, 2019
package-lock.json Bump eslint from 6.5.1 to 6.6.0 Oct 28, 2019
package.json

README.md

Spotify Now Playing

Dependabot Status

This application is running and publicly available at https://nowplaying.tinyrobot.co/.

This is an API wrapper for Spotify that allows users to get their currently playing track with an API call.

This application uses Bootstrap for the front end, and NodeJS running on AWS Lambda on the back end. Deployment is done using Serverless.

ESLint Configuration

This step is only needed if you're doing dev work on the project and want to use ESLint (recommended). From the project's root:

npm ci

Deploying the Back End

  1. Clone this repo.

  2. Create an AWS IAM user with programmatic access. Add the keys to your local AWS credential files using the name spotify-now-playing-[dev|staging|prod].

  3. Create a Spotify integration in the Spotify Developers dashboard at https://developer.spotify.com/dashboard/. After you create the app, Spotify will provide a Client ID and Client Secret. Save these for the next step.

  4. The application expects the following environment variables:

Variable name Description
SPOTIFY_NOW_PLAYING_CLIENT_ID_[dev/staging/prod] Spotify Client ID provided in the Spotify Developer Dashboard
SPOTIFY_NOW_PLAYING_CLIENT_SECRET_[dev/staging/prod] Spotify Client Secret provided in the Spotify Developer Dashboard
SPOTIFY_NOW_PLAYING_SUCCESS_URL_[dev/staging/prod] The absolute URL of the page to redirect the user to on successful login
SPOTIFY_NOW_PLAYING_ERROR_URL_[dev/staging/prod] The absolute URL of the page to redirect the user to on unsuccessful login
SPOTIFY_NOW_PLAYING_CUSTOM_ENDPOINT_URL The absolute URL of a custom endpoint URL, if desired. If this is left blank, the API endpoint URL will be generated automatically by AWS
  1. Deploy the auth service. From the project's root:
cd auth
npm ci
serverless deploy [--stage dev|staging|prod]
  1. Once deployment is complete, Serverless will provide a URL for the newly created redirect API endpoint. Copy this URL.

  2. In the Spotify Developer Dashboard, edit the settings for your integration. In the section titled Redirect URIs, add the URL you copied in the previous step.

  3. Deploy the playback-state service. From the project's root:

cd playback-state
npm ci
serverless deploy [--stage dev|staging|prod]

Building the Front End

Build the application front end. Go back to the project's root and do the following for a development environment:

cd app
npm ci
npm run start

This will run the application in a local development server at localhost:3000. To create an optimized production build, run npm run build. The compiled assets will be created in the build folder.

You can’t perform that action at this time.