Listory/README.md

85 lines
2.6 KiB
Markdown
Raw Normal View History

2020-01-25 22:19:14 +01:00
<p align="center">
2020-05-03 20:57:03 +02:00
<h2 href="http://nestjs.com/" target="blank" align="center">Listory</h2>
2020-01-25 22:19:14 +01:00
</p>
2020-05-03 20:57:03 +02:00
<p align="center">
Login with Spotify and Listory will save all tracks you listen to.
2020-01-25 22:19:14 +01:00
</p>
2020-05-03 20:57:03 +02:00
## Installation
2020-01-25 22:19:14 +01:00
2020-05-03 20:57:03 +02:00
End-user Installation of Listory is not yet fully supported and the docs in this section are not complete.
2020-01-25 22:19:14 +01:00
2020-05-03 20:57:03 +02:00
### Configuration
2020-01-25 22:19:14 +01:00
2020-05-03 20:57:03 +02:00
All configuration must be set as environment variables. Default values are added in **bold**, values that are required are marked with _Required_.
2020-01-25 22:19:14 +01:00
2020-05-03 20:57:03 +02:00
#### Application
2020-01-25 22:19:14 +01:00
2020-05-03 20:57:03 +02:00
- `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://accounts.spotify.com/**: Spotify Authentication API Endpoint.
2020-05-03 20:57:03 +02:00
- `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
2020-01-25 22:19:14 +01:00
2020-05-03 20:57:03 +02:00
- `DB_HOST`: _Required_, Database host
- `DB_USERNAME`: _Required_, Database username
- `DB_PASSWORD`: _Required_, Database password
- `DB_DATABASE`: _Required_, Database database
2020-01-25 22:19:14 +01:00
2020-11-21 15:37:56 +01:00
#### Sentry
You can use Sentry to automatically detect and report any exceptions thrown.
- `SENTRY_ENABLED`: **false**, Set to `true` to enable Sentry.
- `SENTRY_DSN`: _Required_, but only if `SENTRY_ENABLED` is `true`. The [DSN](https://docs.sentry.io/product/sentry-basics/dsn-explainer/) for your Sentry project.
2020-05-03 20:57:03 +02:00
## 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
$ docker-compose up
2020-01-25 22:19:14 +01:00
```
2020-05-03 20:57:03 +02:00
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.
2020-01-25 22:19:14 +01:00
## Test
```bash
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
```
## License
2020-05-03 20:57:03 +02:00
Listory is [MIT licensed](LICENSE).