Album rating and recommendation engine with confidence-weighted preference ranking.
- Framework: FastAPI (async)
- Database: PostgreSQL with SQLAlchemy 2.0 (async)
- Cache: Redis
- Auth: JWT (python-jose + bcrypt)
- External API: MusicBrainz for album metadata
- Python: 3.11+
POST /api/v1/auth/register- Register a new userPOST /api/v1/auth/login- Login and get access tokenGET /api/v1/auth/me- Get current user profile (requires auth)
GET /api/v1/albums/search- Search albums via MusicBrainzGET /api/v1/albums/db/list- List rated albums from databaseGET /api/v1/albums/{mbid}- Get album details by MusicBrainz ID
POST /api/v1/ratings- Rate an album 1-10 (requires auth)GET /api/v1/ratings- Get your ratings (requires auth)DELETE /api/v1/ratings/{rating_id}- Delete a rating (requires auth)
GET /health- Health checkGET /- API info
docker-compose up -dThis starts the API on port 8000, PostgreSQL on 5432, and Redis on 6379.
- Create a virtual environment:
python -m venv .venv
source .venv/bin/activate- Install dependencies:
pip install -e ".[dev]"- Set up environment variables (copy from .env.example or set directly):
export DATABASE_URL=postgresql+asyncpg://user:pass@localhost:5432/ratemyalbum
export REDIS_URL=redis://localhost:6379/0
export SECRET_KEY=your-secret-key- Run the server:
uvicorn backend.app.main:app --reloadOnce running, visit:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
backend/
app/
api/v1/endpoints/ # Route handlers
core/ # Config, database
models/ # SQLAlchemy models
schemas/ # Pydantic schemas
services/ # Business logic (auth, MusicBrainz client)
main.py # FastAPI app
alembic/ # Database migrations
| Variable | Description | Default |
|---|---|---|
| DATABASE_URL | PostgreSQL connection string | postgresql+asyncpg://... |
| REDIS_URL | Redis connection string | redis://localhost:6379/0 |
| SECRET_KEY | JWT signing key | dev-secret-key-change-in-production |
| DEBUG | Enable debug mode | true |
| CWPR_LAMBDA | Confidence penalty factor | 1.0 |