# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview **AudiOhm** is a music streaming application (Spotify alternative) with YouTube audio streaming. The architecture consists of: - **Backend**: FastAPI (Python 3.13+) with async SQLAlchemy, PostgreSQL, and Redis - **Frontend**: Pure HTML/JavaScript with Tailwind CSS (no framework - served directly by FastAPI) - **Streaming**: YouTube audio via yt-dlp - **Authentication**: JWT-based auth The project uses a service-oriented architecture with clear separation between API routes, business logic (services), data models, and schemas. ### File Locations - **Backend code**: `/opt/audiOhm/backend/app/` - **Frontend code**: `/opt/audiOhm/backend/app/static/` and `/opt/audiOhm/backend/app/templates/` - **Tests**: `/opt/audiOhm/backend/tests/` - **Migrations**: `/opt/audiOhm/backend/alembic/` (config at `/opt/audiOhm/backend/alembic.ini`) - **Working directory for all commands**: `/opt/audiOhm/backend/` --- ## Development Commands ### Backend Development ```bash # Start backend with hot-reload (from /opt/audiOhm/backend) uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload # Or using the module directly python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload ``` ### Database Operations ```bash # From /opt/audiOhm/backend # Run migrations alembic upgrade head # Create a new migration alembic revision --autogenerate -m "description" # Rollback one migration alembic downgrade -1 # View migration history alembic history ``` ### Testing ```bash # From /opt/audiOhm/backend # Run all tests pytest # Run specific test file pytest tests/api/test_auth.py # Run with coverage pytest --cov=app tests/ # Run specific test function pytest tests/api/test_library.py::test_get_liked_tracks -v ``` ### Docker Services (PostgreSQL + Redis) **Note**: Docker Compose is only for database services (PostgreSQL + Redis), not the FastAPI backend. ```bash # From /opt/audiOhm (not /opt/audiOhm/backend) docker-compose -f docker/docker-compose.yml up -d # Stop services docker-compose -f docker/docker-compose.yml down # View logs docker-compose -f docker/docker-compose.yml logs -f postgres ``` ### Code Quality ```bash # From /opt/audiOhm/backend # Format code black app/ tests/ # Lint code ruff check app/ tests/ # Type checking mypy app/ ``` ### Frontend Development The frontend is a single-page application (SPA) with no build process: - **HTML**: `app/templates/index.html` - All views in one file, served directly by FastAPI at root route `/` - **JavaScript**: `app/static/js/app.js` - All frontend logic - **CSS**: `app/static/css/style.css` - Minimal custom CSS (Tailwind is primary) - **Tailwind Config**: Defined in `