From bc03225e47987a3ab08e623fbafcf9e40a5ae41b Mon Sep 17 00:00:00 2001 From: root Date: Tue, 20 Jan 2026 09:48:17 +0000 Subject: [PATCH] docs: Improve CLAUDE.md with project documentation Add comprehensive guidance for Claude Code working in this repository: - Alembic config location clarification - Docker Compose scope (database services only) - Frontend serving explanation (FastAPI root route) - Tailwind config location (in HTML script tag) - Pytest async configuration details Generated with [Claude Code](https://claude.com/claude-code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- CLAUDE.md | 384 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 384 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..58b4e6d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,384 @@ +# 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 `