A Next.js web application that helps visualize your spotify profile and behaviour using:
- Spotify Web Api for spotify data
- Mantine for components and UI
- NextAuth for authentication
Create a spotify account if you don't have one then access the developer dashboard. Register a new application and the following redirect url: http://localhost:3000/api/auth/callback/spotify
. If you are using a different port from 3000
then update the redirect url accordingly. You will need the Client ID
and Client Secret
for the next step.
yarn install
Create a .env.local
file in the root of the project and add the environment variables:
SPOTIFY_CLIENT_ID=<your-spotify-client-id>
SPOTIFY_CLIENT_SECRET=<your-spotify-client-secret>
NEXTAUTH_SECRET=<your-nextauth-secret>
# The NEXTAUTH_URL environment variable is only needed for deployment, it may be useful to set it locally for previewing git branches on Vercel.
# https://next-auth.js.org/getting-started/example#deploying-to-production
NEXTAUTH_URL=http://localhost:3000
Refer to the .env.sample
file as a reference.
yarn dev
Upon running the development server with yarn dev
you will be able to access the application on localhost:3000
. Click on the Login with Spotify
button to authenticate with your spotify account. The spotify web api authorizes using OAuth which NextAuth handles for you with a Spotify provider.
This application is gated behind authentication. Upon your first time logging in (or when authorization scopes change) you will be requested to give permission to authorize the application to access your spotify data. Once authenticated/authorized you will be able to use the application.
More details will be added to the docs when required, but these links should be helpful for now to understand how authentication/authorization works in this application:
The practices and guidelines for this repository are inspired by Bulletproof React with some minor adjustments due to the project being a Next.js application instead of a React application.
The docs folder contains some useful information and tutorials/explanations on how some things work in this application/codebase. The following links are a good place to start:
Deployment is handled by Vercel. The master
branch is the production branch and staging
branch is to mimic production. Branches should be merged into staging to see if it works in a production-like environment before merging into master
.