Skip to content

ufosc/Jukebox-Server

Repository files navigation

OSC Jukebox Server

Unit Testing Code Linting

Welcome to the Jukebox Server! To get the server running, you only need Node.js installed on your computer. If you want to contribute to the DevOps portion, you will also need docker and docker-compose installed.

Table of Contents

Description

The Jukebox Server is a Node.js-based server that connects with Spotify's API, allowing users to manage and potentially play music and function like a Jukebox. Required software includes Docker, Docker Compose, and Git. This project has two Github pages this is designated for the Backend Development. If you are interested in the Frontend Development please link here. https://github.com/ufosc/Jukebox-Frontend

Project Install One-Liner

Copy and paste the following command into your terminal to clone the repository and get the server up and running.

This assumes you have Docker, Docker Compose, and Git installed.

git clone [email protected]:ufosc/Jukebox-Server.git && cd Jukebox-Server && cp sample.env .env && docker-compose up --build

Getting started

Follow these steps to download the project locally and get it running with nodemon.

  1. Clone the repository:
git clone https://github.com/ufosc/Jukebox-Server.git
cd Jukebox-Server
  1. Set up the environment:
cp sample.env .env
  1. Build and run the Docker containers:
docker-compose build
docker-compose up

We use Docker Compose to manage the server and its dependencies, including databases and other containers. While you can run the server using npm run dev, Docker Compose provides more reliability.

Once the server is running, visit https://localhost:8000/login to authenticate with Spotify.

Technology Stack (with documentation link)

Use Tech
Language TypeScript
Backend Runtime Node.js
Backend Framework Express.js
SQL Database Postgres
Unit Tests Jest
Auto Documentation Swagger
Infrastructure as Code Terraform
Hosting AWS
Containerization Docker

Workflow

  1. Start by reviewing the issues list and pick a task or propose a new feature.

  2. Clone the main branch onto your local system:

git clone [email protected]:ufosc/Jukebox-Server.git && cd Jukebox-Server && cp sample.env .env && docker-compose up --build
  1. Create a feature branch:
git checkout -b feature/[insert name here]

Ensure your branch focuses on a specific, fully working feature e.g. documentation, implementing new authentication logic. Read more about feature branch workflow here.

Before submitting a pull request, write at least three unit tests. If possible, follow the Test-Driven Development (TDD) paradigm, which involves writing tests before coding the feature itself. Learn more about TDD here.

  1. Push your feature branch and submit a pull request (PR). Your PR will be reviewed and tested by a maintainer before merging.

Testing

We use Jest for unit testing. At least 3 unit tests must accompany any new feature.

Example of Jest Formatting:

const converter = require('../app/converter');

// Example test
test('Jukebox Unit Test', () => {
  expect(converter.convertPlaylist('playlist-id')).toBe('expected-output');
});

To run the tests, use the following command. This will execute Jest, which will look for test files inside the /test directory:

docker-compose run --rm api sh -c "npm test"

When writing new tests, write them inside this /test directory.