# Architecture: Karaoke Frontend & StemEngine Integration **Date**: April 3, 2026 **Status**: Documentation Organization Guide **Purpose**: Clarify Phase A, B, C scope and relationship to StemEngine --- ## Important Clarification **Phase A, B, C Documentation in this folder** are for building the **Karaoke Frontend Application** (React UI), NOT the StemEngine backend service. ### Architecture Overview ``` ┌─────────────────────────────────────────────────────────┐ │ KARAOKE FRONTEND (React) │ │ │ │ Phase A: Subsonic Library Browser │ │ Phase B: Audio Playback & Queue Management │ │ Phase C: Conversion Job Management │ └────────────────────┬────────────────────────────────────┘ │ HTTP/JSON API Calls │ ┌────────────────────▼────────────────────────────────────┐ │ STEMENGINE BACKEND │ │ │ │ - Audio Processing/Conversion Engine │ │ - Conversion Job Queue Management │ │ - Audio Stream Processing │ │ - Format Conversion Pipeline │ └─────────────────────────────────────────────────────────┘ ``` --- ## What Each Phase Does ### Phase A: Subsonic Library Browser (Frontend) **Location**: Phase A documentation in this folder **Type**: Frontend React Components **Components**: - FeishinShell (navigation/layout) - SubsonicContext (state management) - SubsonicAPI (Subsonic server connection) - SubsonicBrowser (UI for browsing music library) - SubsonicSetup (connection configuration) **Purpose**: Allow users to browse their Subsonic music library in the Karaoke frontend **Connects To**: Subsonic servers (for music metadata), NOT directly to StemEngine --- ### Phase B: Audio Playback & Queue (Frontend) **Location**: Phase B documentation in this folder **Type**: Frontend React Components **Components**: - QueueContext (queue state management) - AudioPlayer (HTML5 audio playback) - PlaybackService (playback utilities) **Purpose**: Allow users to queue tracks and play audio in the frontend **Connects To**: Subsonic servers (for audio streams), NOT directly to StemEngine --- ### Phase C: Conversion Job Management (Frontend + Backend) **Location**: Phase C documentation in this folder **Type**: - Frontend: React components for UI - Backend: API specification for StemEngine integration **Frontend Components**: - ConvertButton (trigger conversions) - ConversionQueue (display job status) - SingBrowser (browse karaoke projects) - KaraokePage (main layout) - ConversionService (API client) **Purpose**: - Frontend: Allow users to submit tracks for conversion - Backend: Actually perform the conversion using StemEngine **Connects To**: - Frontend submits jobs to StemEngine via `/api/karaoke/process` endpoint - StemEngine processes and returns status - Frontend polls for progress --- ## Phase C: The Bridge Between Frontend & StemEngine Phase C is where the **Frontend talks to StemEngine**: ### Frontend Flow (Phase C) 1. User clicks "Convert" button in Karaoke frontend 2. ConvertButton component submits to `/api/karaoke/process` 3. ConversionService polls `/api/karaoke/process/queue` for status 4. ConversionQueue displays real-time progress ### Backend Flow (StemEngine) 1. Receives POST `/api/karaoke/process` from frontend 2. Creates conversion job in database 3. Processes audio using conversion pipeline 4. Returns job status on GET `/api/karaoke/process/queue` --- ## Documentation Organization ### In This Folder (StemEngine Docs) #### Phase A Docs (Frontend) - `PHASE_A_SUMMARY.md` - Overview of Subsonic browser components - `PHASE_A_COMPLETION_GUIDE.md` - How to integrate Phase A - `PHASE_A_FILE_LISTING.md` - Files created in Phase A - etc. **Note**: These are frontend components, but documented here because they're part of the overall Karaoke/StemEngine system. #### Phase B Docs (Frontend) - `PHASE_B_SUMMARY.md` - Overview of audio/queue components - `PHASE_B_INTEGRATION_GUIDE.md` - How to integrate Phase B - etc. **Note**: These are frontend components for playback, documented here as part of the system. #### Phase C Docs (Frontend + Backend) - `PHASE_C_SPECIFICATION.md` - Feature requirements - `PHASE_C_QA_TEST_EXECUTION.md` - QA testing procedures - `PHASE_C_BACKEND_IMPLEMENTATION.md` - **Backend API implementation guide** ⭐ - `PHASE_C_API_REFERENCE.md` - **API specification for StemEngine endpoints** ⭐ - etc. **Note**: Phase C has both frontend (already created) and backend (StemEngine) components. The starred files are specifically for StemEngine backend development. #### Other Docs in This Folder - `KARAOKE_FRONTEND_STEMENGINE_CONNECTIVITY_PLAN.md` - Architecture and connectivity - Integration guides - API specifications --- ## Where the Code Actually Lives ### Frontend Code (Phases A, B, C) **Location**: `/home/translator/docker/karaokemugen-app/kmfrontend/src/frontend/` **Files**: - Phase A: `components/FeishinShell.tsx`, `components/SubsonicBrowser.tsx`, etc. - Phase B: `components/QueueContext.tsx`, `components/AudioPlayer.tsx`, etc. - Phase C: `components/ConvertButton.tsx`, `components/ConversionQueue.tsx`, etc. ### StemEngine Backend Code **Location**: `/home/translator/docker/appdata/stemengine/` **What Needs to Be Built** (from Phase C Backend Implementation guide): - Database schema (4 tables) - 9 API endpoints - Authentication & authorization - Conversion pipeline integration --- ## How to Use This Documentation ### If You're a Frontend Developer 1. Read Phase A, B, C docs in this folder 2. Navigate to `/home/translator/docker/karaokemugen-app/kmfrontend/src/frontend/` 3. Integrate the components documented in Phase A, B, C 4. Use `KARAOKE_FRONTEND_STEMENGINE_CONNECTIVITY_PLAN.md` for API endpoints to call ### If You're a Backend Developer 1. Read **Phase C Backend Implementation** in this folder 2. Read **Phase C API Reference** in this folder 3. Navigate to `/home/translator/docker/appdata/stemengine/` 4. Implement the 9 API endpoints specified in Phase C docs 5. Implement the 4 database tables from Phase C docs ### If You're a DevOps/Integration Engineer 1. Read `KARAOKE_FRONTEND_STEMENGINE_CONNECTIVITY_PLAN.md` 2. Understand how Phase A, B, C (frontend) communicates with StemEngine (backend) 3. Plan networking, authentication, and deployment strategy --- ## Next Steps ### For Phase C QA Testing & Backend Implementation **As documented in Phase C files**: 1. **QA Testing** (10-15 hours) - See: `PHASE_C_QA_TEST_EXECUTION.md` - Test the frontend components (ConvertButton, ConversionQueue, etc.) - These are already created and integrated 2. **Backend Implementation** (13-21 hours) - See: `PHASE_C_BACKEND_IMPLEMENTATION.md` - See: `PHASE_C_API_REFERENCE.md` - Implement the 9 API endpoints in StemEngine - Create the database schema - Wire frontend API calls to backend --- ## Summary | Phase | What | Type | Location | |-------|------|------|----------| | **A** | Subsonic Library Browser | Frontend | This folder (docs) + `/karaokemugen-app/kmfrontend/src/frontend/` (code) | | **B** | Audio Playback & Queue | Frontend | This folder (docs) + `/karaokemugen-app/kmfrontend/src/frontend/` (code) | | **C** | Conversion Management | Frontend + Backend | This folder (docs) + `/karaokemugen-app/kmfrontend/src/frontend/` (code) + `/appdata/stemengine/` (backend to implement) | **All documentation is in this folder (`/home/translator/docker/appdata/stemengine/docs/`) for centralized reference.** --- **Architecture Status**: Clearly documented **Next Action**: QA test Phase C frontend, then implement Phase C backend in StemEngine **Date**: April 3, 2026