# Seen Backend (Phase 2 Skeleton)

This is a runnable Go backend skeleton for `/seen/` with:

- Gin HTTP API with versioned routes (`/api/v1`)
- PostgreSQL connectivity (pgx pool)
- Dragonfly/Redis connectivity
- Auth service scaffolding (register/login/refresh)
- Baseline workers/downloader/scanner interfaces
- Unified movie/show/game catalog model
- Metadata provider configuration for TMDB and IGDB
- Optional live IGDB game-search augmentation when credentials are present
- Migrations and sqlc query layout placeholders

## Run locally

```bash
cp .env.example .env
go mod tidy
go run ./cmd/api
```

Populate these external metadata credentials in `.env` to enable provider-backed metadata lookups:

- `SEEN_TMDB_API_KEY`
- `SEEN_IGDB_CLIENT_ID`
- `SEEN_IGDB_CLIENT_SECRET`

IGDB should be accessed server-side only through the backend.

## Health endpoints

- `GET /api/v1/health/live`
- `GET /api/v1/health/ready`

## Auth endpoints (skeleton)

- `POST /api/v1/auth/register`
- `POST /api/v1/auth/login`
- `POST /api/v1/auth/refresh`

## Placeholder endpoints

- `GET /api/v1/movies`
- `GET /api/v1/shows`
- `GET /api/v1/watchlist`
- `GET /api/v1/downloads`
- `GET /api/v1/library`
- `GET /api/v1/recommendations`

## Live catalog slice endpoints

- `GET /api/v1/dashboard`
- `GET /api/v1/progress/continue-watching`
- `GET /api/v1/discover`
- `GET /api/v1/games`
- `GET /api/v1/search`
- `GET /api/v1/watch-later`
- `POST /api/v1/watch-later`
- `DELETE /api/v1/watch-later/:mediaId`
- `POST /api/v1/progress`

## Migrations

SQL files are in `migrations/` and currently include:

- auth/session baseline schema
- catalog schema + seeded discover dataset
- user watch later persistence table
- user progress persistence table
