athifongoqa / ambient-BE

The backend component of an audio-first mobile and/or web application focused on artists and curators that allows them to engage with listeners and promote their (Spotify-hosted) work directly to them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ambient NodeJS-Fastify

alt text


๐Ÿš€ Deployment:

https://ambient-niqfhm2phq-ey.a.run.app

Project Status ๐Ÿšง

The development of the project is still in progress. Currently we are working on controlling music playback and playlists for upcoming shows directly from Spotify.

Installation ๐Ÿ“ฆ

Prerequisites: nodejs v16.13.0 or newer and npm 8.3.1 or newer.

To install this project and run it locally, please follow the following steps:

  1. Open the terminal and run git clone https://github.com/athifongoqa/ambient-BE.git;
  2. Navigate to the repository (cd ambient-BE) and create a .env file as specified below;
  3. Navigate to the branch you are interested in (git checkout BRANCH_NAME);
  4. Install the npm packages by running npm install ;
  5. Either run the development server with npm run dev or run the app for better performances by running npm run start;
  6. Visit http://0.0.0.0:3000.
  7. To login, visit http://0.0.0.0:3000/login/spotify

.env

CLIENT_ID= # Spotify client id - visit: https://developer.spotify.com/dashboard and create a new application & register http://0.0.0.0:3000/spotify/login/spotify/callback as the redirect URI 
CLIENT_SECRET= # Spotify client secret - visit: https://developer.spotify.com/dashboard and create a new application & register http://0.0.0.0:3000/spotify/login/spotify/callback as the redirect URI 
MONGODB= # MongoDB URI
FASTIFY_ADDRESS=0.0.0.0
JWT_SECRET= # your secret

Testing ๐Ÿงช

This app uses Jest, and Mocha for Unit & Integration tests.

You can run the Unit and Integration tests by simply running npm run test.

Project Structure ๐Ÿ—

Here is a description of the content of each folder in the directory:

.                           # Root directory.
โ”œโ”€โ”€ .github                 # Convention folder used to place Github related folders and files
โ”‚   โ””โ”€โ”€ workflows           # Configuration folder containing yml files for GitHub Actions
โ”‚       โ””โ”€โ”€ gcp             # yml file for handling deployment jobs
โ”œโ”€โ”€ controllers             # Handler functions
โ”‚   โ”œโ”€โ”€ admin                
โ”‚   โ”œโ”€โ”€ shows                
โ”‚   โ”œโ”€โ”€ sockets                
โ”‚   โ””โ”€โ”€ users                         
โ”œโ”€โ”€ models                  # Show & User models & schemas
โ”‚   โ”œโ”€โ”€ shows.model             
โ”‚   โ””โ”€โ”€ users.model           
โ”œโ”€โ”€ plugins 
โ”‚   โ”œโ”€โ”€ jwt                 # JWT-related decorators
โ”‚   โ”œโ”€โ”€ sockets             # Fastify-socket.io events and connection 
โ”‚   โ”œโ”€โ”€ spotify             # Spotify OAuth support 
โ”‚   โ””โ”€โ”€ swagger             # Documentation support using Swagger          
โ”œโ”€โ”€ routes                    
โ”‚   โ”œโ”€โ”€ api                 
โ”‚   โ”‚   โ”œโ”€โ”€ shows           
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ index       # Show endpoints
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ schema      # Show schema definitions
โ”‚   โ”‚   โ””โ”€โ”€ users           
โ”‚   โ”‚       โ”œโ”€โ”€ index       # User endpoints
โ”‚   โ”‚       โ””โ”€โ”€ schema      # User schema definitions
โ”‚   โ”œโ”€โ”€ spotify              
โ”‚   โ”‚   โ””โ”€โ”€ index           # Spotify callback and user sign-in
โ”‚   โ””โ”€โ”€ root                # Health-check
โ”œโ”€โ”€ tests                   # Unit & integration tests
โ”‚   โ””โ”€โ”€ routes              
โ”‚       โ”œโ”€โ”€ routes                           
โ”‚       โ”‚   โ”œโ”€โ”€ admin.integration                   
โ”‚       โ”‚   โ”œโ”€โ”€ shows.integration                   
โ”‚       โ”‚   โ”œโ”€โ”€ shows.test                   
โ”‚       โ”‚   โ”œโ”€โ”€ users.integration                   
โ”‚       โ”œโ”€โ”€ dummyShows      # Mock shows                     
โ”‚       โ”œโ”€โ”€ helper          # Builds server for tests               
โ”‚       โ””โ”€โ”€ testdb          # Mock database               
โ””โ”€โ”€ app                     # Main server file

Current Features ๐Ÿ”ฅ

The features currently available in this app include:

  • Secure OAuth integration with Spotify
  • Secure authentication and authorisation with JSON Web Tokens
  • API for users and shows endpoints
  • Websockets for audio streaming and chat functionality
  • Unit & Integration tests
  • API documnetation using Swagger
  • Deployed using Google Cloud Platform's Cloud Run

Upcoming Features ๐Ÿ”ฎ

The features that will be implemented soon in the future include:

  • Spotify music playback streaming through websocket server
  • Storing playlists for upcoming shows
  • The social functionalities that will allow the users to follow each other and see each other's acitity are also under development.

About

The backend component of an audio-first mobile and/or web application focused on artists and curators that allows them to engage with listeners and promote their (Spotify-hosted) work directly to them.


Languages

Language:JavaScript 99.2%Language:Dockerfile 0.8%