WIP. A little custom music server
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: update issues list

+20 -16
+20 -16
backend/ISSUES.md
··· 1 1 # Architectural Issues & Tasks 2 2 3 3 ## High Priority (Stability & Performance) 4 - - [ ] **Fix Critical Memory Usage in `FlacService`** 5 - - **Location**: `src/flac/service.ts` 6 - - **Issue**: `readMetadata` uses `fs.readFile` to load entire audio files (often 20-100MB) into memory just to read headers. 7 - - **Task**: Implement partial reads (open file descriptor -> read buffer) to parse headers and Vorbis comments without loading the binary audio data. 4 + - [ ] **Improve cover art logic** 5 + - **Issue**: Right now we base our cover art loading on musicbrainzReleaseId using cover art api, but we should cache it on server. and use multiple fallbacks 6 + - **Task**: Implement cover art fetching/fallbacking. 7 + 1. Loading from database / local cover art folder. 8 + - If we have releasegroupid - try fetching from coverart api; 9 + - Try parsing coverart from file. 10 + 2. If not - use link to coverart api based on relaseId 11 + 3. If not - use placeholder 8 12 9 - - [ ] **Implement Pagination for API Endpoints** 10 - - **Location**: `src/api.ts` 11 - - **Issue**: `getAlbumList` and `getAllSongs` fetch the entire database table in a single query. 12 - - **Task**: Add limit/offset or cursor-based pagination parameters to these endpoints and updated the database queries accordingly. 13 + Cover art fetcher should be running on schedule to load this shit in background rather then block user flow. 14 + 13 15 14 - - [ ] **Optimize Library Synchronization** 15 - - **Location**: `src/file-parser.ts` & `src/sync-library.ts` 16 - - **Issue**: `readDirectory` and the sync stream load all file paths into memory before processing. `alreadyIndexed` loads the entire file table. 17 - - **Task**: Refactor to use a streaming directory iterator and batched database lookups to handle large libraries (50k+ songs) without OOM. 18 16 19 17 ## Medium Priority (Reliability & Maintainability) 20 18 - [ ] **Standardize API Error Handling** ··· 22 20 - **Issue**: Inconsistent error handling. Some endpoints map errors explicitly, others rely on `runtime.runPromise` which may cause unhandled promise rejections or generic 500s for domain errors. 23 21 - **Task**: Create a standardized wrapper or middleware that executes Effects and maps specific `TaggedError` types to HTTP status codes (404, 400, etc.). 24 22 25 - - [ ] **Decouple API from Database Logic** 26 - - **Location**: `src/api.ts` 27 - - **Issue**: API handlers contain `db.query` and `db.select` calls directly ("Active Record" pattern in controllers). 28 - - **Task**: Extract database queries into a dedicated Repository layer or specific Service methods to enable unit testing without a database connection. 23 + - [ ] **Optimize Library Synchronization** 24 + - **Location**: `src/file-parser.ts` & `src/sync-library.ts` 25 + - **Issue**: `readDirectory` and the sync stream load all file paths into memory before processing. `alreadyIndexed` loads the entire file table. 26 + - **Task**: Refactor to use a streaming directory iterator and batched database lookups to handle large libraries (50k+ songs) without OOM. 27 + 29 28 30 29 ## Low Priority (Code Quality) 31 30 - [ ] **Refactor Effect <-> Elysia Adapter** ··· 37 36 - **Location**: `src/index.ts` 38 37 - **Issue**: Server port `3003` is hardcoded. 39 38 - **Task**: Use Effect's `Config` module to make the port configurable via environment variables. 39 + 40 + - [ ] **Implement Pagination for API Endpoints** 41 + - **Location**: `src/api.ts` 42 + - **Issue**: `getAlbumList` and `getAllSongs` fetch the entire database table in a single query. 43 + - **Task**: Add limit/offset or cursor-based pagination parameters to these endpoints and updated the database queries accordingly.