feat: migrate to PostgreSQL and enhance playlist curation

- Migrate database from SQLite to PostgreSQL (100.91.248.114:5433)
- Fix playlist curation to use actual top tracks instead of AI name matching
- Add /playlists/history endpoint for historical playlist viewing
- Add Playlist Archives section to frontend with expandable history
- Add playlist-modify-* scopes to Spotify OAuth for playlist creation
- Rewrite Genius client to use official API (fixes 403 scraping blocks)
- Ensure playlists are created on Spotify before curation attempts
- Add DATABASE.md documentation for PostgreSQL schema
- Add migrations for PlaylistConfig and composition storage
This commit is contained in:
bnair123
2025-12-30 22:24:56 +04:00
parent 26b4895695
commit 272148c5bf
19 changed files with 1130 additions and 145 deletions

View File

@@ -79,25 +79,26 @@ Open your browser to: **http://localhost:8991**
┌────────┴────────┐
▼ ▼
┌──────────┐ ┌──────────────┐
SQLite │ │ Spotify API │
│ music.db │ │ Gemini AI │
PostgreSQL│ │ Spotify API │
│ music_db │ │ Gemini AI │
└──────────┘ └──────────────┘
```
- **Backend Container**: Runs both the FastAPI server AND the background Spotify polling worker
- **Frontend Container**: Nginx serving the React build, proxies `/api/` to backend
- **Database**: SQLite stored in a Docker named volume (`music_data`) for persistence
- **Database**: PostgreSQL hosted on internal server (100.91.248.114:5433)
## Data Persistence
Your listening history is stored in a Docker named volume:
- Volume name: `music_data`
- Database file: `/app/music.db`
- Migrations run automatically on container startup
Your listening history is stored in PostgreSQL:
- Host: `100.91.248.114:5433`
- Database: `music_db`
- Data Location (on server): `/opt/DB/MusicDB/pgdata`
- Migrations run automatically on container startup via Alembic
To backup your data:
```bash
docker cp $(docker-compose ps -q backend):/app/music.db ./backup.db
pg_dump -h 100.91.248.114 -p 5433 -U bnair music_db > backup.sql
```
## Local Development
@@ -136,4 +137,4 @@ Access at http://localhost:5173 (Vite proxies `/api` to backend automatically)
| `SPOTIFY_REFRESH_TOKEN` | Yes | Long-lived refresh token from OAuth |
| `GEMINI_API_KEY` | Yes | Google Gemini API key |
| `GENIUS_ACCESS_TOKEN` | No | Genius API token for lyrics |
| `DATABASE_URL` | No | SQLite path (default: `sqlite:///./music.db`) |
| `DATABASE_URL` | No | PostgreSQL URL (default: `postgresql://bnair:Bharath2002@100.91.248.114:5433/music_db`) |