Skip to content
tracksensefmPublic

About

An Apple Music client with a richer stats engine, shared queues and remote playback.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

TrackSense

An Apple Music client that goes beyond what the native app offers. TrackSense is built around a richer stats engine, tracking play counts, listening time, trends, and milestones, while adding social and collaborative features like shared queues and remote playback that Apple Music doesn't support. The stats foundation is designed to support a personalized recommendation engine in the future.


Features

  • Library: Browse your full Apple Music library across songs, albums, artists, and playlists, with recently played and recently added sections on the home screen.
  • Search: Search across your entire library with fast, ranked results.
  • Stats Dashboard: View your top songs, albums, and artists by play count or total listening time, alongside library-wide metrics like total play hours and play counts.
  • Historical Trends: Visualize how your listening habits evolve over time with daily and weekly charts, including trend analysis for growth, momentum, and streaks.
  • Genre Map: See a breakdown of your listening time by genre.
  • Milestones: Track how many songs, albums, and artists you've hit at 10, 25, 50, 100, 250, 500, and 1000+ plays.
  • Now Playing: A full-screen player with dynamic colors extracted from album artwork, playback controls, progress scrubbing, AirPlay output, per-song stats, lyrics, and queue management.
  • Sessions: Start a listening session to take control of your playback queue with drag-and-drop reordering and cross-device sync via Firebase.
  • Playlist Management: Browse playlist stats, add tracks to existing playlists, or create new ones from within the app.
  • Cloud Sync: Stats sync to a personal Firebase backend, with support for Apple and Google sign-in to link your account across devices.

Tech Stack

Layer Technology
UI SwiftUI
Music MusicKit, MediaPlayer
Backend Firebase Realtime Database, Firestore, Firebase Auth
Audio AVFoundation
Font Montserrat

Architecture

The app uses an MVVM-adjacent pattern with environment-injected managers handling shared state:

  • AuthManager: Firebase anonymous auth with Apple and Google sign-in; supports account linking.
  • SongLibraryManager: Fetches and caches the user's Apple Music library via MusicKit.
  • SessionManager: Manages the active playback queue with drag-and-drop reordering.
  • QueueSyncManager: Syncs the queue to Firebase Realtime Database for cross-device persistence.
  • OverlayManager: Global overlay state for success and error messages.

Sync is unidirectional: local library data is aggregated and pushed to Firebase. Daily history snapshots are stored as YYYY-MM-DD keys, enabling chart rendering for any metric over time.


Directory Structure

MusicApp/
├── App/                        App entry point and root views
│   ├── ResonateApp.swift
│   ├── AppRootView.swift
│   └── LoadingView.swift
├── Views/                      Top-level navigation destinations
│   ├── HomeView.swift
│   ├── LibraryView.swift
│   ├── StatsView.swift
│   ├── SessionsView.swift
│   ├── SettingsView.swift
│   └── AuthView.swift
├── Features/                   Self-contained feature modules
│   ├── Album/
│   ├── Artist/
│   ├── Home/
│   ├── NowPlaying/
│   ├── Playlists/
│   ├── Search/
│   ├── Sessions/
│   ├── Song/
│   └── Stats/
├── Components/                 Reusable UI components
│   ├── Charts/                 History and play count chart views
│   ├── Controls/               Menus, pickers, and search inputs
│   ├── Layout/                 Layout utilities and general UI primitives
│   ├── MusicItem/              Artwork, item blocks, and detail views
│   └── Playback/               AirPlay picker and output button
└── Managers/                   App-wide state and service managers

Setup

Requirements

  • Xcode 15+
  • iOS 16+
  • An Apple Music subscription (required for MusicKit library access)
  • A Firebase project with Realtime Database enabled

Firebase

  1. Create a Firebase project and enable Anonymous Authentication (plus Apple and Google Sign-In if desired), Realtime Database, and Firestore.
  2. Download GoogleService-Info.plist and place it at the repo root.
  3. The Realtime Database uses the following structure:
users/
  {userID}/
    songs/{songId}/
    albums/{albumId}/
    artists/{artistId}/
    libraryPlayedHours/
    totalPlays/

MusicKit

The app fetches a MusicKit developer token from a remote Cloud Function endpoint. To use your own:

  1. Deploy a Cloud Function (or any server) that returns a signed MusicKit developer token as { "token": "..." }.
  2. Replace YOUR_MUSICKIT_TOKEN_ENDPOINT in AuthView.swift with your endpoint URL.

Refer to Apple's MusicKit documentation for instructions on generating developer tokens.


License

This project is licensed under the Apache License 2.0. See the LICENSE file for more details.

About

An Apple Music client with a richer stats engine, shared queues and remote playback.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages