How alexatsu/tune-legacy works
Purpose and deployment shape
Tune-legacy is a discontinued multi-source music application: users search, save, organize into albums/playlists, and stream music sourced through YouTube/Spotify (SoundCloud planned). It is a container-oriented microservice repository, coordinated locally by docker-compose.yaml, with CI/workflow automation under .github/workflows/main.yaml.
Primary user-facing application
The main product is a Next.js/TypeScript client with App Router pages, server-side API routes, authentication, and Prisma persistence.
• Web entry and global composition: client/src/app/layout.tsx, client/src/app/page.tsx, client/src/middleware.ts
• Auth boundary: client/src/app/api/auth/[...nextauth]/route.ts, client/src/app/_/providers/SessionProvider.tsx
• Music-area shell and shared player/navigation state: client/src/app/(music)/layout.tsx, client/src/app/_/providers/PlayerProvider.tsx, client/src/app/(music)/_/providers/StreamProvider.tsx
The UI is organized around music browsing/search, charts, albums, settings/themes, and an active player rather than a separate public API product.
Application API and persistence
Next.js route handlers form the client-facing backend boundary. They encapsulate database operations and service calls for songs, streaming, albums, charts, and preferences.
• Database access and schema evolution: client/src/app/api/_/services/db.ts, client/prisma/schema.prisma
• Song and stream endpoints: client/src/app/api/songs/search/route.ts, client/src/app/api/songs/stream/route.ts, client/src/app/api/songs/add/route.ts
• Album and theme mutations: client/src/app/api/albums/create/route.ts, client/src/app/api/albums/add-or-delete-song/route.ts, client/src/app/api/settings/themes/update-current-theme/route.ts
Prisma migrations indicate durable user, OAuth, music, album, and theme-related state. The exact database engine is not established by the supplied tree.
Music acquisition and streaming service
A Python service handles external music lookup, temporary listening/streaming, download/storage work, and audio models. Per the README, this layer uses yt-dlp to retrieve source metadata/audio and supplies media for client playback, with music ultimately wrapped in an iframe.
• Service entry and HTTP routing: music-service/src/main.py, music-service/src/routes/search.py
• Search, temporary stream, and storage pipeline: music-service/src/controllers/search/searchSongs.py, music-service/src/controllers/search/streamTemporal.py, music-service/src/controllers/search/saveAndStore.py
• Media acquisition/model boundary: music-service/src/utils/functions/downloadSong.py, music-service/src/models/audio.py
This service is the principal boundary between application-owned data and external content platforms.
Charts ingestion, processing, and presentation
Charts are a separate pipeline rather than being generated in the web app. A Node/TypeScript parser runs scheduled chart parsing, exposes/retrieves processed results, and can send them to backup; a Python charts service generates chart output consumed through the client’s charts API/UI.
• Parser startup, schedule, and chart controllers: parser-service/main.ts, parser-service/src/cron/parseCharts.ts, parser-service/src/routes/charts/controllers/retrieveProcessedCharts.ts
• Chart generation service: charts-service/main.py, charts-service/routes/charts.py, charts-service/controllers/charts/generateCharts.py
• Client integration: client/src/app/api/charts/get-all/route.ts, client/src/app/(music)/charts/page.tsx
Backup and external storage
A Bun/TypeScript backup service separates restoration and backup of charts/database data from request-serving components. Its Cloudinary utility identifies Cloudinary as an external storage integration.
• Backup service entry and operations: backup-service/src/main.ts, backup-service/src/modules/backupCharts.ts, backup-service/src/modules/backupDB.ts
• Restore/storage integration: backup-service/src/modules/restore.ts, backup-service/src/utils/cloudinary.ts
• Automation: .github/workflows/backup.yaml, .github/workflows/charts.yaml
Secondary desktop client
An early desktop implementation uses Wails: Go launches the native shell and a Vite/React frontend communicates through generated Wails bindings. It appears independent of the primary Next.js client and is not the main deployed product.
• Native entry points: desktop/main.go, desktop/app.go, desktop/wails.json
• Desktop frontend entry: desktop/frontend/src/main.tsx, desktop/frontend/src/App.tsx
Main entry points: docker-compose.yaml Docker Compose · route.ts Application API · backupCharts.ts Backup operations · layout.tsx Music UI
Components 21
Primary web app
Next.js client and its server-side API boundary.
- Music UI · Browse, search, organize music, and play streams.
client/src/app/(music)/layout.tsx - Web entry · Global layout, landing page, and middleware.
client/src/app/layout.tsx - Authentication · Auth route and client session boundary.
client/src/app/api/auth/[...nextauth]/route.ts - Application API · Client-facing backend for music, albums, themes, and charts.
client/src/app/api/songs/search/route.ts - Prisma persistence · Durable user, OAuth, music, album, and theme state.
client/src/app/api/_/services/db.ts - Prisma schema
client/prisma/schema.prisma - Player state · Shared player and stream state.
client/src/app/_/providers/PlayerProvider.tsx - Charts UI
client/src/app/(music)/charts/page.tsx
Music service
Python acquisition and temporary streaming boundary.
- Music HTTP routes · Search and media requests enter the music service here.
music-service/src/routes/search.py - Acquisition pipeline · Searches sources, creates temporary streams, and stores media.
music-service/src/controllers/search/streamTemporal.py - Media download · Retrieves source metadata and audio.
music-service/src/utils/functions/downloadSong.py
Charts pipeline
Scheduled parsing and generated chart delivery.
- Chart parser scheduler · Runs scheduled chart parsing.
parser-service/src/cron/parseCharts.ts - Processed charts · Retrieves processed parser results.
parser-service/src/routes/charts/controllers/retrieveProcessedCharts.ts - Chart generator · Generates chart output for consumers.
charts-service/controllers/charts/generateCharts.py
Backup and storage
Backup, restore, and external storage operations.
- Backup operations · Backs up charts and database data and restores them.
backup-service/src/modules/backupCharts.ts
Desktop client
Independent early Wails implementation.
- Wails native shell · Launches the independent desktop application.
desktop/main.go - Desktop frontend · Uses generated Wails bindings to communicate with Go.
desktop/frontend/src/App.tsx
Other components
- Docker Compose · Coordinates local multi-service deployment.
docker-compose.yaml - Music platforms · YouTube and Spotify content sources.
- Cloudinary
- CI and scheduled workflows · Build automation plus chart and backup jobs.
.github/workflows/main.yaml
Connections 25
- Docker Compose → Web entry: runs
- Docker Compose → Music HTTP routes: runs
- Docker Compose → Chart parser scheduler: runs
- Docker Compose → Chart generator: runs
- Docker Compose → Backup operations: runs
- Web entry → Music UI: composes
- Music UI → Authentication: uses session
- Music UI → Player state: shares playback
- Music UI → Application API: calls
- Application API → Prisma persistence: persists through
- Prisma schema → Prisma persistence: defines models
- Application API → Music HTTP routes: searches and streams
- Music HTTP routes → Acquisition pipeline: dispatches
- Acquisition pipeline → Media download: acquires media
- Media download → Music platforms: retrieves from
- Chart parser scheduler → Processed charts: produces
- Processed charts → Chart generator: supplies input
- Application API → Chart generator: retrieves charts
- Charts UI → Application API: requests charts
- Chart parser scheduler → Backup operations: backs up charts
- Backup operations → Prisma persistence: backs up and restores
- Backup operations → Cloudinary: stores backups
- CI and scheduled workflows → Chart parser scheduler: triggers chart jobs
- CI and scheduled workflows → Backup operations: triggers backups
- Wails native shell → Desktop frontend: hosts