phaze/
βββ src/phaze/ # Application package
β βββ config.py # Pydantic settings (env vars)
β βββ constants.py # File categories, extension map, tuning constants
β βββ database.py # Async SQLAlchemy engine + session factory
β βββ main.py # FastAPI app factory with lifespan
β βββ models/ # SQLAlchemy ORM models
β β βββ base.py # DeclarativeBase + TimestampMixin
β β βββ file.py # FileRecord + FileState enum
β β βββ scan_batch.py # ScanBatch progress tracking
β β βββ metadata.py # FileMetadata (audio tags)
β β βββ analysis.py # AnalysisResult (BPM, key, mood, style)
β β βββ fingerprint.py # FingerprintResult (per-engine)
β β βββ proposal.py # RenameProposal + ProposalStatus
β β βββ execution.py # ExecutionLog (audit trail)
β β βββ tracklist.py # Tracklist + TracklistVersion + TracklistTrack
β β βββ file_companion.py # FileCompanion (companion-media join)
β βββ routers/ # API + UI endpoints
β β βββ health.py # GET /health
β β βββ scan.py # File discovery scan
β β βββ pipeline.py # Pipeline dashboard + processing triggers
β β βββ proposals.py # Proposal review + approval UI
β β βββ execution.py # Batch execution + SSE progress
β β βββ preview.py # Directory tree preview
β β βββ duplicates.py # Duplicate resolution UI
β β βββ tracklists.py # Tracklist management UI
β β βββ companion.py # Companion file association
β βββ schemas/ # Pydantic request/response models
β β βββ scan.py # Scan API schemas
β β βββ companion.py # Companion/duplicate schemas
β βββ services/ # Business logic
β β βββ ingestion.py # File discovery, hashing, bulk upsert
β β βββ metadata.py # Tag extraction via mutagen
β β βββ analysis.py # BPM/key/mood via essentia
β β βββ fingerprint.py # Multi-engine fingerprint orchestrator
β β βββ proposal.py # LLM calling + context building
β β βββ proposal_queries.py # Proposal queries + pagination
β β βββ execution.py # Copy-verify-delete with audit logging
β β βββ execution_queries.py# Execution log queries + pagination
β β βββ companion.py # Companion file association
β β βββ dedup.py # Duplicate detection + resolution
β β βββ collision.py # Destination path collision detection
β β βββ pipeline.py # Pipeline stats + file state queries
β β βββ tracklist_scraper.py# 1001Tracklists web scraper
β β βββ tracklist_matcher.py# Fuzzy match tracklists to files
β βββ tasks/ # SAQ async background jobs
β β βββ worker.py # SAQ settings + startup/shutdown
β β βββ functions.py # process_file (full pipeline per file)
β β βββ metadata_extraction.py # extract_file_metadata
β β βββ fingerprint.py # fingerprint_file (multi-engine)
β β βββ proposal.py # generate_proposals (batch LLM)
β β βββ execution.py # execute_approved_batch
β β βββ scan.py # scan_live_set (fingerprint matching)
β β βββ tracklist.py # scrape/search/refresh tracklists
β β βββ pool.py # ProcessPoolExecutor for CPU work
β β βββ session.py # Session utilities
β βββ prompts/ # LLM prompt templates
β βββ templates/ # Jinja2 HTML templates (HTMX + Tailwind)
β βββ pipeline/ # Pipeline dashboard
β βββ proposals/ # Proposal approval UI
β βββ execution/ # Execution dashboard + audit log
β βββ duplicates/ # Duplicate resolution UI
β βββ tracklists/ # Tracklist management UI
β βββ preview/ # Directory tree preview
βββ services/ # Fingerprint microservices
β βββ audfprint/ # Landmark-based fingerprinting
β βββ panako/ # Tempo-robust fingerprinting
βββ tests/ # Test suite (85%+ coverage)
β βββ conftest.py # Fixtures + test DB setup
β βββ test_models/ # ORM model tests
β βββ test_routers/ # Endpoint integration tests
β βββ test_services/ # Business logic unit tests
β βββ test_tasks/ # SAQ job tests
βββ alembic/ # Database migrations (async template)
β βββ versions/ # Migration scripts (001-008)
βββ .github/workflows/ # CI/CD pipelines
β βββ ci.yml # Main orchestrator
β βββ code-quality.yml # Pre-commit hooks
β βββ tests.yml # Pytest + Codecov
β βββ security.yml # pip-audit, bandit, Semgrep, Trivy
βββ scripts/ # Utility scripts
β βββ download-models.sh # Download essentia ML models
βββ docker-compose.yml # Service orchestration
βββ docker-compose.override.yml # Local development overrides
βββ Dockerfile # Multi-stage build (API + worker)
βββ justfile # Developer commands
βββ pyproject.toml # Project config + tool settings
βββ uv.lock # Frozen dependency versions