diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..ff4111b --- /dev/null +++ b/.env.sample @@ -0,0 +1,2 @@ +SPOTIFY_CLIENT_ID= +SPOTIFY_CLIENT_SECRET= \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2755671 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Julian Tölle + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index a59ef92..2b9cd21 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,64 @@
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