Skip to content

Latest commit

 

History

History
128 lines (82 loc) · 3.67 KB

README.md

File metadata and controls

128 lines (82 loc) · 3.67 KB

Taste Explorer

Compare your music preferences to your friends starting with the ability to create playlists that with just your music, just your friend's music, or music you've both loved.

You'll just need...

screenshot

Development

Requirements

1 | Install Dependencies

npm install

2 | Configure Environment Variables

Create a .env file in the root directory.

cp .env.example .env

Update...

  • Spotify Client Id
  • Spotify Client Password
  • Last.fm API Key
  • Last.fm Shared Secret
  • Session Secret
  • Admin API Secret

Update the DATABASE_URL if you want to connect to a remote database. The DATABASE_URL included in .env.example is configured to use the Dockerized database included in the docker-compose.yml file.

3 | Apply Database Schema

npx prisma migrate dev # This will apply to the database specified in the DATABASE_URL of your .env

4 | Optional | Seed Database

You can download a sample data set of 4 listeners here: music.adambechtold.xyz/api/setup/seed.zip

It contains a series of .dump files which you can load into your database using the method of your choice. If you're having trouble with this, comment on this issue.

5 | Run Web Server

# If you have your own database running and modified DATABASE_URL in step 2
npm run dev

# If you want to use the pre-configured Dockerized database for local development
npm run dev:local

6 | Optional | Run Cron Jobs to Start Collecting New Data

Start the cron jobs that track listening history and research additional information about tracks.

npx ts-node src/music/cron/scheduleJobs.cron.ts \
              updateListeningHistory \
              createListens \
              addTrackFeatures

Consider running these in separate screen instances.

7 | Optional | Check out the Admin API

Testing

Set Up Tests

  1. Create a .env.test.local file
cp .env.example .env.test.local
  1. Configure the DATABASE_URL to connect to the test database hosted by Docker
# Filename: .env.test.local
...
DATABASE_URL='mysql://root:test@localhost:3306/test'
...

Run Tests

npm run test

The Dockerized database for tests will start running and tests will be executed.

FAQ

Why aren't styles loading?

Sometimes, the browser doesn't allow non-SSL-protected resources to load, even from localhost.

The fastest way to get around this is to simply forward traffic through a service like VS Code port forwarding. ngrok is another common service for this.

(If you know a better way around this, let me know!)

load-stylesheets