From 75d3e2edbd4d0a867faf66241649884fe04d75e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julian=20T=C3=B6lle?= Listory
A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.
-+ Login with Spotify and Listory will save all tracks you listen to.
- - -## Description - -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. ## Installation -```bash -$ npm install -``` +End-user Installation of Listory is not yet fully supported and the docs in this section are not complete. -## Running the app +### Configuration + +All configuration must be set as environment variables. Default values are added in **bold**, values that are required are marked with _Required_. + +#### Application + +- `PORT`: **3000**: Port the webserver will listen on. +- `APP_URL`: **http://localhost:3000**: Public URL of the Application, is used to generate Links. + +#### Authentication + +- `JWT_SECRET`: _Required_, used to sign the JWTs. +- `JWT_ALGORITHM`: **HS256**: Algorithm used to sign the JWTs. One of `HS256`, `HS384`, `HS512` +- `JWT_EXPIRATION_TIME`: **1d**: Lifetime of signed JWTs. Accepts strings like `1d`, `2h`, `15m`. + +#### Spotify + +- `SPOTIFY_CLIENT_ID`: _Required_, Spotify App Client ID +- `SPOTIFY_CLIENT_SECRET`: _Required_, Spotify App Client Secret +- `SPOTIFY_FETCH_INTERVAL_MIN`: **5**: Interval for fetching recently listened tracks from Spotify. +- `SPOTIFY_WEB_API_URL`: **https://api.spotify.com/**: Spotify WEB API Endpoint. +- `SPOTIFY_AUTH_API_URL`: **https://acounts.spotify.com/**: Spotify Authentication API Endpoint. +- `SPOTIFY_USER_FILTER`: **""**: If set, only allow Spotify users with these ids to access the app. If empty, allow all users to access the app. Seperate ids with `,` eg.: `231421323123,other_id`. + +#### Database + +- `DB_HOST`: _Required_, Database host +- `DB_USERNAME`: _Required_, Database username +- `DB_PASSWORD`: _Required_, Database password +- `DB_DATABASE`: _Required_, Database database + +## Development + +### Configure Spotify API Access + +Copy the file `.env.sample` to `.env` and add your Spotify API Key. + +### Starting the application + +We use `docker-compose` to provide a full local development environment. ```bash -# development -$ npm run start - -# watch mode -$ npm run start:dev - -# production mode -$ npm run start:prod +$ docker-compose up ``` +You can now access the frontend at `http://localhost:3000` and the API at `http://localhost:3000/api`. + +Frontend and API will automatically reload on any code changes. + ## Test ```bash @@ -60,16 +72,6 @@ $ npm run test:e2e $ npm run test:cov ``` -## Support - -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). - -## Stay in touch - -- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) -- Website - [https://nestjs.com](https://nestjs.com/) -- Twitter - [@nestframework](https://twitter.com/nestframework) - ## License - Nest is [MIT licensed](LICENSE). +Listory is [MIT licensed](LICENSE). diff --git a/docker-compose.yml b/docker-compose.yml index 2c76687..763e11c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,6 +20,7 @@ services: DB_USERNAME: listory DB_PASSWORD: listory DB_DATABASE: listory + JWT_SECRET: listory APP_URL: "http://localhost:3000" env_file: .env volumes: diff --git a/frontend/package.json b/frontend/package.json index 0cd6401..93bb3ed 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,12 @@ { - "name": "frontend", + "name": "@listory/frontend", "version": "0.1.0", "private": true, + "author": { + "name": "Julian Tölle", + "email": "julian.toelle97@gmail.com" + }, + "license": "MIT", "dependencies": { "@fullhuman/postcss-purgecss": "^2.1.2", "@testing-library/jest-dom": "^4.2.4", diff --git a/package-lock.json b/package-lock.json index 100dc22..c1e187f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "listory", + "name": "@listory/api", "version": "0.0.1", "lockfileVersion": 1, "requires": true, diff --git a/package.json b/package.json index c9a440c..df998d7 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,11 @@ { - "name": "listory", - "version": "0.0.1", + "name": "@listory/api", + "version": "0.1.0", "description": "Track your Spotify Listen History", - "author": "Julian Tölle