mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 13:11:02 +00:00
feat: add docs and polish
This commit is contained in:
parent
a27fcce03b
commit
75d3e2edbd
9 changed files with 94 additions and 55 deletions
2
.env.sample
Normal file
2
.env.sample
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
SPOTIFY_CLIENT_ID=
|
||||||
|
SPOTIFY_CLIENT_SECRET=
|
||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
|
|
@ -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.
|
||||||
96
README.md
96
README.md
|
|
@ -1,52 +1,64 @@
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
|
<h2 href="http://nestjs.com/" target="blank" align="center">Listory</h2>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
|
|
||||||
[travis-url]: https://travis-ci.org/nestjs/nest
|
|
||||||
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
|
|
||||||
[linux-url]: https://travis-ci.org/nestjs/nest
|
|
||||||
|
|
||||||
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
Login with Spotify and Listory will save all tracks you listen to.
|
||||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
|
||||||
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
|
|
||||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
|
|
||||||
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
|
|
||||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
|
|
||||||
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a>
|
|
||||||
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
|
||||||
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
|
||||||
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a>
|
|
||||||
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
|
||||||
</p>
|
</p>
|
||||||
<!--[](https://opencollective.com/nest#backer)
|
|
||||||
[](https://opencollective.com/nest#sponsor)-->
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
End-user Installation of Listory is not yet fully supported and the docs in this section are not complete.
|
||||||
$ npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
## 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
|
```bash
|
||||||
# development
|
$ docker-compose up
|
||||||
$ npm run start
|
|
||||||
|
|
||||||
# watch mode
|
|
||||||
$ npm run start:dev
|
|
||||||
|
|
||||||
# production mode
|
|
||||||
$ npm run start:prod
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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
|
## Test
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
@ -60,16 +72,6 @@ $ npm run test:e2e
|
||||||
$ npm run test:cov
|
$ 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
|
## License
|
||||||
|
|
||||||
Nest is [MIT licensed](LICENSE).
|
Listory is [MIT licensed](LICENSE).
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ services:
|
||||||
DB_USERNAME: listory
|
DB_USERNAME: listory
|
||||||
DB_PASSWORD: listory
|
DB_PASSWORD: listory
|
||||||
DB_DATABASE: listory
|
DB_DATABASE: listory
|
||||||
|
JWT_SECRET: listory
|
||||||
APP_URL: "http://localhost:3000"
|
APP_URL: "http://localhost:3000"
|
||||||
env_file: .env
|
env_file: .env
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "frontend",
|
"name": "@listory/frontend",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"author": {
|
||||||
|
"name": "Julian Tölle",
|
||||||
|
"email": "julian.toelle97@gmail.com"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fullhuman/postcss-purgecss": "^2.1.2",
|
"@fullhuman/postcss-purgecss": "^2.1.2",
|
||||||
"@testing-library/jest-dom": "^4.2.4",
|
"@testing-library/jest-dom": "^4.2.4",
|
||||||
|
|
|
||||||
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "listory",
|
"name": "@listory/api",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "listory",
|
"name": "@listory/api",
|
||||||
"version": "0.0.1",
|
"version": "0.1.0",
|
||||||
"description": "Track your Spotify Listen History",
|
"description": "Track your Spotify Listen History",
|
||||||
"author": "Julian Tölle <julian.toelle97@gmail.com>",
|
"author": {
|
||||||
|
"name": "Julian Tölle",
|
||||||
|
"email": "julian.toelle97@gmail.com"
|
||||||
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rimraf dist",
|
"prebuild": "rimraf dist",
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,10 @@ import { SpotifyStrategy } from "./spotify.strategy";
|
||||||
JwtModule.registerAsync({
|
JwtModule.registerAsync({
|
||||||
useFactory: (config: ConfigService) => ({
|
useFactory: (config: ConfigService) => ({
|
||||||
secret: config.get<string>("JWT_SECRET"),
|
secret: config.get<string>("JWT_SECRET"),
|
||||||
signOptions: { expiresIn: config.get<string>("JWT_EXPIRATION_TIME") },
|
signOptions: {
|
||||||
|
expiresIn: config.get<string>("JWT_EXPIRATION_TIME"),
|
||||||
|
algorithm: config.get("JWT_ALGORITHM"),
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
inject: [ConfigService],
|
inject: [ConfigService],
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,14 @@ import {
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
validationSchema: Joi.object({
|
validationSchema: Joi.object({
|
||||||
// Application
|
// Application
|
||||||
NODE_ENV: Joi.string().valid("dev", "production").default("dev"),
|
|
||||||
PORT: Joi.number().default(3000),
|
PORT: Joi.number().default(3000),
|
||||||
APP_URL: Joi.string().default("http://localhost:3000"),
|
APP_URL: Joi.string().default("http://localhost:3000"),
|
||||||
|
|
||||||
// JWT
|
// JWT
|
||||||
JWT_SECRET: Joi.string().required(),
|
JWT_SECRET: Joi.string().required(),
|
||||||
|
JWT_ALGORITHM: Joi.string()
|
||||||
|
.default("HS256")
|
||||||
|
.allow("HS256", "HS384", "HS512"),
|
||||||
JWT_EXPIRATION_TIME: Joi.string().default("1d"),
|
JWT_EXPIRATION_TIME: Joi.string().default("1d"),
|
||||||
|
|
||||||
// Spotify
|
// Spotify
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue