40 lines
1.1 KiB
Markdown
40 lines
1.1 KiB
Markdown
# API
|
|
|
|
To install dependencies:
|
|
|
|
```bash
|
|
bun install
|
|
```
|
|
|
|
To run:
|
|
|
|
```bash
|
|
bun run dev
|
|
```
|
|
|
|
Requires running Postgres and environment setup.
|
|
|
|
Create `.env` file (in this folder):
|
|
|
|
```sh
|
|
# Leave as is if using docker/default Postgres install
|
|
DATABASE_URL=postgres://postgres:postgres@localhost/postgres
|
|
BETTER_AUTH_URL=http://127.0.0.1:3000
|
|
|
|
# random secure secret; can be left as is for development/testing
|
|
BETTER_AUTH_SECRET=vGIwQFYm4kUPHOhFNt882IbFaWhLklke
|
|
|
|
# Create a spotify web app.
|
|
# Add http://127.0.0.1:3000/api/auth/callback/spotify as callback URL there
|
|
# Copy and paste Client ID and Client secret to the following places:
|
|
SPOTIFY_CLIENT_ID=
|
|
SPOTIFY_CLIENT_SECRET=
|
|
```
|
|
|
|
Important files for editing:
|
|
|
|
- `src/workflows/quiz.ts` has the main Quiz loop.
|
|
- Questions are generated in `src/party/` files.
|
|
- `src/workflows/sync.ts` gets data from spotify and saves into database
|
|
- `src/workflows/party-analysis.ts` generates analysis details of a given party, to be used for question generation
|
|
- `src/party-types.ts` contains type definitions of party data, shared with frontend
|