# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Development Commands ### Quick Start (Recommended) ```bash ./run_dev.sh ``` This single script starts both frontend (port 11111) and backend (port 11110) with auto-browser opening. ### Manual Development Setup **Frontend (Svelte):** ```bash cd frontend npm install npm run dev # Development server on :11111 npm run build # Production build npm run check # Type checking ``` **Backend (FastAPI):** ```bash cd backend pip install -r requirements.txt python -m hfstudio.cli --dev # Development server on :11110 # OR pip install -e . hfstudio --dev ``` ### Port Configuration - Frontend: 11111 (configured in `vite.config.js`) - Backend: 7860 (configured in `cli.py`) - CORS is configured for these specific ports in `server.py` ## Architecture Overview ### Frontend Structure (SvelteKit + TailwindCSS) - **Single Page App**: Main interface in `src/routes/+page.svelte` - **Layout**: Global layout with sidebar in `src/routes/+layout.svelte` - **Design System**: HuggingFace brand colors (`#FFD21E`, `#FF9D00`) used throughout - **State Management**: Local component state with reactive variables - **Audio Handling**: Custom HTML5 audio element with manual progress tracking ### Key UI Components - **Three-panel layout**: Sidebar (56 units) + Main content + Settings panel (80 units) - **Fixed bottom button**: Generate button positioned absolutely at page bottom - **Mini audio player**: Compact controls in generated audio card - **Full audio player**: Expanded controls with ElevenLabs-style design - **Custom pause icon**: CSS-only filled bars instead of outline ### Backend Structure (FastAPI) - **Main server**: `server.py` with CORS configured for development ports - **CLI interface**: `cli.py` with typer for command-line control - **Pydantic models**: TTSRequest, TTSResponse, Voice, Model - **Current implementation**: Mock TTS generation using placeholder audio ### API Endpoints ``` GET / - Health check GET /api/status - Mode and availability info GET /api/voices - Available voice list GET /api/models - Available model list POST /api/tts/generate - Generate speech from text ``` ## Design Patterns & Conventions ### Frontend Patterns - **HF Brand Integration**: Uses official logo (`/assets/hf-logo.png`) and gradient colors - **Responsive Controls**: All sliders use custom `.slider-hf` class with HF colors - **Audio State Management**: Manual synchronization between UI state and HTML5 audio element - **Progressive Enhancement**: Settings always visible, no hidden toggles ### Backend Patterns - **Development Mode**: Auto-reload enabled with `--dev` flag - **Mock Implementation**: Currently returns `/samples/harvard.wav` for testing - **CORS Configuration**: Explicitly configured for development ports ### Styling Conventions - **TailwindCSS**: Primary styling framework - **Custom CSS**: Limited to audio sliders and pause icon in `app.css` - **Color Scheme**: Light theme with HF amber/orange accents - **Typography**: System fonts with careful spacing ## Key Implementation Details ### Audio System The app uses a hidden HTML5 `