A music collection organizer that ingests music and concert files, fingerprints and analyzes them, uses AI to propose better filenames and destination paths, and provides a web UI to review and approve renames. All file operations use a safe copy-verify-delete protocol with full audit trails.
π Quick Start | π Documentation | π Features | π¬ Community
Phaze is a music collection organizer for managing a large personal archive of music and live concert recordings. It provides:
- π΅ Audio Analysis: BPM, key, mood, and style detection via essentia-tensorflow
- π Audio Fingerprinting: Dual-engine deduplication with audfprint (landmark) and Panako (tempo-robust)
- π€ AI-Powered Renaming: LLM-generated filename and path proposals via litellm
- π§ Tracklist Matching: Concert set identification from 1001Tracklists
- π Human-in-the-Loop: Web UI to review, approve, or reject every proposed change
- π Safe File Operations: Copy-verify-delete protocol with full audit trails -- nothing moves without review
Perfect for DJs, music collectors, and live recording enthusiasts who want their messy archives properly named, organized, and deduplicated.
| Service | Port | Purpose | Key Technologies |
|---|---|---|---|
| API | 8000 | FastAPI application server | FastAPI, SQLAlchemy, asyncpg |
| Worker | -- | SAQ async background task processor | SAQ, Redis, essentia, mutagen |
| Postgres | 5432 | Primary database | PostgreSQL 18, Alembic |
| Redis | 6379 | Task queue broker and cache | Redis 8 |
| Audfprint | 8001 | Landmark-based audio fingerprinting | audfprint |
| Panako | 8002 | Tempo-robust audio fingerprinting | Panako |
graph TD
subgraph Frontend ["π Frontend"]
UI["π₯οΈ Web UI<br/>HTMX + Tailwind<br/>Proposals Β· Duplicates Β· Tracklists Β· Exec"]
end
subgraph Backend ["βοΈ Backend"]
API["π FastAPI<br/>async, :8000<br/>/api/v1/* Β· /proposals Β· /pipeline"]
WORKER["π§ SAQ Worker<br/>async background jobs"]
end
subgraph Storage ["πΎ Storage"]
PG[("π PostgreSQL 18<br/>:5432")]
REDIS[("π΄ Redis 8<br/>:6379")]
end
subgraph Fingerprint ["π΅ Fingerprinting"]
AUD["π― Audfprint :8001<br/>landmark"]
PAN["πΌ Panako :8002<br/>tempo-robust"]
end
UI --> API
API --> PG
API --> REDIS
API --> WORKER
WORKER --> AUD
WORKER --> PAN
WORKER --> PG
style UI fill:#e3f2fd,stroke:#0d47a1,stroke-width:2px
style API fill:#e8f5e9,stroke:#1b5e20,stroke-width:2px
style WORKER fill:#fff3e0,stroke:#e65100,stroke-width:2px
style PG fill:#f3e5f5,stroke:#4a148c,stroke-width:2px
style REDIS fill:#ffebee,stroke:#b71c1c,stroke-width:2px
style AUD fill:#e0f2f1,stroke:#004d40,stroke-width:2px
style PAN fill:#fce4ec,stroke:#880e4f,stroke-width:2px
See Architecture Overview for detailed diagrams covering data flow, service communication, and the approval pipeline.
stateDiagram-v2
[*] --> DISCOVERED
DISCOVERED --> METADATA_EXTRACTED : mutagen
METADATA_EXTRACTED --> FINGERPRINTED : audfprint + panako
FINGERPRINTED --> ANALYZED : essentia
ANALYZED --> PROPOSAL_GENERATED : LLM via litellm
PROPOSAL_GENERATED --> APPROVED : human review
PROPOSAL_GENERATED --> REJECTED : human review
APPROVED --> EXECUTED : copyβverifyβdelete
APPROVED --> FAILED
PROPOSAL_GENERATED --> DUPLICATE_RESOLVED
- π΅ Broad Format Support: mp3, m4a, ogg, flac, wav, aiff, wma, aac, opus, plus video (mp4, mkv, avi, webm, mov) and companion files (cue, nfo, m3u)
- π Dual Fingerprinting: Landmark-based (audfprint) and tempo-robust (Panako) engines for comprehensive deduplication
- π€ AI Rename Proposals: LLM-generated filenames and paths with structured validation via Pydantic
- π§ Tracklist Integration: Automatic concert set identification from 1001Tracklists with fuzzy matching
- π Approval Workflow: Every rename requires human review through the web UI
- π Safe Operations: Copy-verify-delete protocol ensures no data loss
- π Full Audit Trail: Every file operation is tracked in PostgreSQL
- β‘ Async Processing: SAQ task queue with Redis for parallel file analysis
- π Type Safety: Full type hints with strict mypy validation and Bandit security scanning
git clone https://github.com/SimplicityGuy/phaze.git
cd phaze
uv sync
cp .env.example .env # Edit to configure paths and API keys
just download-models # Required for audio analysis
just up # Start all services
just db-upgrade # Run database migrations
curl http://localhost:8000/health # Verify: {"status": "ok"}| Service | URL | Default Credentials |
|---|---|---|
| π Web UI | http://localhost:8000 | None |
| π PostgreSQL | localhost:5432 |
phaze / phaze |
| π΄ Redis | localhost:6379 |
None |
| π΅ Audfprint | http://localhost:8001 | None |
| π§ Panako | http://localhost:8002 | None |
See the Quick Start Guide for prerequisites, local development setup, and environment configuration.
| Document | Purpose |
|---|---|
| Quick Start Guide | π Get Phaze running in minutes |
| Configuration | βοΈ Environment variables and settings reference |
| Document | Purpose |
|---|---|
| API Reference | π REST API endpoints and usage |
| Database Schema & Migrations | ποΈ PostgreSQL schema and Alembic migrations |
| Project Structure | π Codebase layout and module organization |
See docs/README.md for the full documentation index.
just install # Install dependencies
just up / just down # Start / stop services
just test # Run tests
just test-cov # Tests with coverage (85% min)
just check # Lint + typecheck + test
just pre-commit # Run all pre-commit hooksSee just --list for the full command reference.
- Linter/Formatter: Ruff (150-char line length, double quotes)
- Type checker: mypy (strict mode, excludes tests)
- Pre-commit hooks: ruff, bandit, mypy, shellcheck, yamllint, actionlint, jsonschema validation
- All hooks use frozen SHAs for reproducibility
GitHub Actions runs on every push and PR:
| Job | Description |
|---|---|
| Quality | Pre-commit hooks (ruff, mypy, yamllint, etc.) |
| Test | pytest with PostgreSQL, coverage upload to Codecov |
| Security | pip-audit, bandit, Semgrep, TruffleHog, Trivy |
| Category | Technology | Purpose |
|---|---|---|
| Runtime | Python 3.13 | Application runtime |
| Web | FastAPI + Uvicorn | Async API server |
| Database | PostgreSQL 18 + SQLAlchemy + asyncpg | Primary data store (async ORM) |
| Migrations | Alembic (async template) | Database schema management |
| Task Queue | SAQ + Redis | Async background job processing |
| Audio Tags | mutagen | Read/write audio metadata |
| Analysis | essentia-tensorflow | BPM, key, mood, style detection |
| Fingerprint | audfprint + Panako | Audio deduplication + identification |
| AI/LLM | litellm (pinned <1.82.7) | Unified LLM API for rename proposals |
| Scraping | BeautifulSoup4 + lxml | 1001Tracklists integration |
| Matching | rapidfuzz | Fuzzy string matching |
| UI | Jinja2 + HTMX + Tailwind CSS + Alpine.js | Server-rendered interactive UI |
| Deploy | Docker Compose | Container orchestration |
- π Bug Reports: GitHub Issues
- π‘ Feature Requests: GitHub Discussions
- β Questions: Discussions Q&A
- π Full Documentation: docs/README.md
This project is licensed under the MIT License -- see the LICENSE file for details.
- πΌ discogsography for the CI/CD patterns, project conventions, and HTTP API integration target that shaped this project
- π΅ Discogs and AcoustID for music identification services
- π§ 1001Tracklists for concert tracklist data
- π uv for blazing-fast package management
- π₯ Ruff for lightning-fast linting
- π The Python community for excellent libraries and tools