Skip to content

🎡 Arythm β€” A beautiful, open-source web music player powered by YouTube Music. Stream millions of songs, enjoy synced lyrics, and discover new music β€” all from your browser. 🎧

Notifications You must be signed in to change notification settings

aryanjsx/Arythm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Arythm

An open-source web music player powered by YouTube Music.

Built with Next.js Β· Tailwind CSS Β· Zustand Β· Web Audio API

Next.js React TypeScript Tailwind CSS License

Live Demo Β· Report Bug Β· Request Feature


What is Arythm?

Arythm is a full-featured music streaming app that runs entirely in your browser. It connects to the YouTube Music catalog through the InnerTube API, giving you access to millions of songs with a clean, modern interface. No YouTube Music subscription required.

It works across desktop, tablet, and mobile, and can be installed as a PWA so it behaves like a native app.


Features

Playback

  • Stream any song from the YouTube Music catalog in high-quality audio
  • Instant playback -- audio URLs are resolved via the InnerTube Player API in ~200ms, with yt-dlp as a fallback
  • Full-screen player with blurred album artwork background and ambient color extraction via ColorThief
  • Queue management -- shuffle, repeat (one/all/off), and remove songs from the queue
  • Volume normalization via Web Audio API so quiet and loud songs play at similar levels
  • OS media controls -- play/pause/skip from your lock screen, notification shade, or Bluetooth headphones
  • Playback speed -- 0.25x to 4x
  • Local file support -- drag and drop or pick audio files from your device

Smart Auto-Queue

When you play a single song, Arythm automatically fills your queue with related songs from the same genre. It uses YouTube Music's radio API (RDAMVM{videoId}) as a seed, giving you continuous listening without lifting a finger.

Prefetch & Offline Resilience

Arythm preloads the next 2 songs as in-memory blobs and pre-resolves URLs for the next 5 as soon as the current song starts. If your internet drops mid-session, the next songs play seamlessly from the local cache. No buffering, no interruption.

Lyrics

  • 4 lyrics providers -- LrcLib, KuGou, Musixmatch, and YouTube Music
  • Synced lyrics with Apple Music-style karaoke display (line-by-line highlighting, smooth font/color transitions)
  • Tap to seek -- click any lyric line to jump to that point in the song
  • Fast path -- returns synced lyrics as soon as the first provider responds (Promise.any), no waiting for slower providers
  • Pre-warm -- lyrics are fetched in the background when a song starts playing, so they're instant when you open the panel

Discovery

  • Personalized homepage -- Quick Picks, Song Suggestions, Mix Carousels, Playlist Recommendations, and Mood tiles, all powered by YouTube Music's home feed
  • Real-time search with autocomplete suggestions
  • Filtered results -- browse by Songs, Albums, Artists, or Playlists
  • Mood & genre browsing -- Chill, Workout, Focus, Night, Drive, Romance, and more
  • Artist, album, and playlist detail pages with full track listings
  • Personalized content when signed in with a YouTube Music cookie

Library

  • Like songs and access them from your library
  • Recently played history on the homepage
  • Create and manage playlists (syncs with YouTube Music if authenticated)
  • Listening statistics -- most played songs and artists
  • All library data is persisted in localStorage -- no account required

UI & Experience

  • Responsive layout -- sidebar on desktop, bottom tab bar on mobile
  • Dark theme with glassmorphism design (frosted glass cards, subtle transparency)
  • Ambient background -- dominant color extracted from album art, blurred across the entire page
  • Installable as a PWA on any device
  • Keyboard shortcuts -- spacebar to play/pause, arrow keys to seek, and more
  • Framer Motion animations throughout

Architecture

Arythm is a two-part system:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Arythm (Frontend)                        β”‚
β”‚                                                              β”‚
β”‚  Next.js app hosted on Vercel                                β”‚
β”‚  Handles: UI, search, browsing, queue, lyrics, library       β”‚
β”‚  Talks to: YouTube Music InnerTube API (server-side)         β”‚
β”‚            Arythm-Proxy (for CORS-safe audio streaming)      β”‚
β”‚            LrcLib, KuGou, Musixmatch (for lyrics)            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚ Fast path (InnerTube)       β”‚ Fallback (yt-dlp)
          β”‚ POST /api/innertube/player  β”‚ GET /stream?v=VIDEO_ID
          β”‚ β†’ 200ms URL resolution      β”‚ β†’ 3-10s URL resolution
          β”‚ β†’ GET /stream?url=...&v=... β”‚
          β–Ό                             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Arythm-Proxy (Backend)                     β”‚
β”‚                                                              β”‚
β”‚  Express server hosted on Render                             β”‚
β”‚  Handles: Piping audio bytes from googlevideo.com with CORS  β”‚
β”‚           Resolving URLs via yt-dlp (fallback only)          β”‚
β”‚           Request deduplication (one yt-dlp per video)       β”‚
β”‚           Caching resolved URLs for 5 hours                  β”‚
β”‚           Forwarding Range headers for seeking               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Why a separate proxy? YouTube's audio servers (googlevideo.com) don't set CORS headers, so browsers block direct playback. The proxy fetches audio server-side and pipes it back with proper CORS headers.


Tech Stack

Layer Technology Purpose
Framework Next.js 16 (App Router) Server-side rendering, API routes, file-based routing
UI React 19 Component architecture
Language TypeScript 5 Type safety across the entire codebase
Styling Tailwind CSS v4 + Framer Motion Utility-first CSS + smooth animations
State Zustand Lightweight stores for player, library, and settings
Audio HTML5 Audio + Web Audio API Playback engine + volume normalization
Music API YouTube Music InnerTube Search, browse, home feed, radio, player, artist/album pages
Lyrics LrcLib + KuGou + Musixmatch + YouTube Music 4-provider synced and plain lyrics
Audio Proxy Express + yt-dlp CORS-safe audio streaming with URL resolution fallback
Color ColorThief Dominant color extraction for ambient backgrounds
Icons Lucide React Consistent icon set

Getting Started

Prerequisites

  • Node.js 20 or later
  • npm (comes with Node.js)

1. Clone and install

git clone https://github.com/aryanjsx/Arythm.git
cd Arythm
npm install

2. Set up environment variables

Create a .env file in the project root:

YOUTUBE_COOKIE=""
AUDIO_PROXY_URL="https://your-proxy.onrender.com"
NEXT_PUBLIC_AUDIO_PROXY_URL="https://your-proxy.onrender.com"
Variable Required Description
YOUTUBE_COOKIE No Your YouTube Music cookie. Enables personalized home feed, recommendations, lyrics from YouTube Music, and library sync. Without it, you still get generic content.
AUDIO_PROXY_URL Yes URL of your Arythm-Proxy instance (server-side usage).
NEXT_PUBLIC_AUDIO_PROXY_URL Yes Same URL, exposed to the browser for client-side streaming.
How to get your YouTube Music cookie
  1. Open music.youtube.com in Chrome and sign in
  2. Press F12 to open DevTools, go to the Network tab
  3. Click on any request to music.youtube.com
  4. In the request headers, find the Cookie header and copy its full value
  5. Paste it as YOUTUBE_COOKIE in your .env file

This cookie is used server-side only and never sent to the browser.

3. Start the dev server

npm run dev

Open http://localhost:3000 in your browser.

4. Deploy the audio proxy

The frontend needs the Arythm-Proxy running separately. See the Arythm-Proxy README for setup instructions.


Project Structure

src/
β”œβ”€β”€ app/                            # Next.js App Router
β”‚   β”œβ”€β”€ page.tsx                    #   Homepage
β”‚   β”œβ”€β”€ search/page.tsx             #   Search results
β”‚   β”œβ”€β”€ album/[id]/page.tsx         #   Album detail
β”‚   β”œβ”€β”€ artist/[id]/page.tsx        #   Artist detail
β”‚   β”œβ”€β”€ playlist/[id]/page.tsx      #   Playlist detail
β”‚   β”œβ”€β”€ browse/[id]/page.tsx        #   Mood/genre category
β”‚   β”œβ”€β”€ library/page.tsx            #   User library
β”‚   β”œβ”€β”€ history/page.tsx            #   Play history
β”‚   β”œβ”€β”€ stats/page.tsx              #   Listening statistics
β”‚   β”œβ”€β”€ settings/page.tsx           #   Preferences
β”‚   β”œβ”€β”€ mood-and-genres/page.tsx    #   Browse by mood & genre
β”‚   β”œβ”€β”€ login/page.tsx              #   YouTube Music authentication
β”‚   β”œβ”€β”€ icon.tsx                    #   Dynamic favicon
β”‚   └── api/
β”‚       β”œβ”€β”€ innertube/              #   YouTube Music API proxy
β”‚       β”‚   β”œβ”€β”€ browse/route.ts     #     Home feed, artist, album, playlist, moods
β”‚       β”‚   β”œβ”€β”€ search/route.ts     #     Search + autocomplete suggestions
β”‚       β”‚   β”œβ”€β”€ player/route.ts     #     Stream URLs, formats, loudness
β”‚       β”‚   β”œβ”€β”€ next/route.ts       #     Radio queue (related songs)
β”‚       β”‚   └── playlist/route.ts   #     Playlist CRUD, like/unlike
β”‚       β”œβ”€β”€ lyrics/route.ts         #   4-provider lyrics (LrcLib, KuGou, Musixmatch, YTM)
β”‚       β”œβ”€β”€ stream/                 #   Audio stream helpers
β”‚       └── auth/route.ts           #   YouTube auth check
β”‚
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ home/                       # Homepage sections
β”‚   β”‚   β”œβ”€β”€ HeroSection.tsx         #   Greeting banner
β”‚   β”‚   β”œβ”€β”€ QuickPickGrid.tsx       #   Song card grid
β”‚   β”‚   β”œβ”€β”€ SongSuggestionRow.tsx   #   Horizontal song list
β”‚   β”‚   β”œβ”€β”€ MixCarousel.tsx         #   YouTube Music mixes
β”‚   β”‚   β”œβ”€β”€ PlaylistSuggestionRow.tsx   # Playlist recommendations
β”‚   β”‚   β”œβ”€β”€ PlaylistCarousel.tsx    #   Mixed-content carousel
β”‚   β”‚   β”œβ”€β”€ MoodCategoryRow.tsx     #   Mood tiles
β”‚   β”‚   └── RecentlyPlayed.tsx      #   Recently played grid
β”‚   β”œβ”€β”€ player/                     # Audio player
β”‚   β”‚   β”œβ”€β”€ player-wrapper.tsx      #   Root: mounts mini + full player
β”‚   β”‚   β”œβ”€β”€ mini-player.tsx         #   Bottom bar controls
β”‚   β”‚   β”œβ”€β”€ full-player.tsx         #   Full-screen player with artwork
β”‚   β”‚   β”œβ”€β”€ player-controls.tsx     #   Play/pause, seek, volume
β”‚   β”‚   β”œβ”€β”€ queue-panel.tsx         #   Queue list
β”‚   β”‚   β”œβ”€β”€ lyrics-view.tsx         #   Synced lyrics display
β”‚   β”‚   └── AmbientBackground.tsx   #   Blurred artwork background
β”‚   β”œβ”€β”€ music/                      # Reusable music item components
β”‚   └── layout/                     # Sidebar, header, bottom nav
β”‚
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ audio/player.ts             # PlayerService singleton
β”‚   β”‚                               #   HTML5 Audio + Web Audio API
β”‚   β”‚                               #   InnerTube-first URL resolution (~200ms)
β”‚   β”‚                               #   Prefetch next 2 songs as blobs
β”‚   β”‚                               #   Pre-resolve next 5 URLs via InnerTube
β”‚   β”‚                               #   Auto-queue related songs
β”‚   β”‚                               #   Pre-warm lyrics on song change
β”‚   β”‚                               #   Media Session integration
β”‚   β”œβ”€β”€ innertube/                  # YouTube Music InnerTube client
β”‚   β”‚   β”œβ”€β”€ innertube.ts            #   API functions (search, browse, player, next)
β”‚   β”‚   β”œβ”€β”€ parsers.ts              #   Response β†’ typed objects (Song, Album, etc.)
β”‚   β”‚   β”œβ”€β”€ client.ts               #   Client configs (WEB_REMIX, ANDROID, IOS, etc.)
β”‚   β”‚   β”œβ”€β”€ auth.ts                 #   Cookie auth + SAPISID hash generation
β”‚   β”‚   └── stream.ts              #   youtubei.js session management
β”‚   └── lyrics/                     # Lyrics providers
β”‚       β”œβ”€β”€ lrclib.ts               #   LrcLib (synced + plain)
β”‚       β”œβ”€β”€ kugou.ts                #   KuGou (synced + plain)
β”‚       β”œβ”€β”€ musixmatch.ts           #   Musixmatch (synced + plain)
β”‚       └── youtube-music.ts        #   YouTube Music (plain, via InnerTube)
β”‚
β”œβ”€β”€ stores/                         # Zustand state management
β”‚   β”œβ”€β”€ player-store.ts             #   Queue, playback state, repeat/shuffle
β”‚   β”œβ”€β”€ library-store.ts            #   Liked songs, recently played, playlists
β”‚   └── settings-store.ts           #   Theme, preferences
β”‚
β”œβ”€β”€ hooks/                          # React hooks
β”‚   β”œβ”€β”€ use-player.ts               #   Initialize PlayerService, expose controls
β”‚   β”œβ”€β”€ use-lyrics.ts               #   Fetch/cache lyrics, sync with playback time
β”‚   β”œβ”€β”€ use-keyboard-shortcuts.ts   #   Global keyboard bindings
β”‚   └── use-local-files.ts          #   Local audio file playback
β”‚
└── types/                          # TypeScript definitions
    β”œβ”€β”€ music.ts                    #   Song, Album, Artist, Playlist, Lyrics, etc.
    └── innertube.ts                #   InnerTube request/response types

How It Works

Playing a Song

  1. User clicks a song anywhere in the app
  2. playSong(song) sets the queue and increments _playbackGeneration in the Zustand store
  3. PlayerService detects the generation change and calls onPlaybackTriggered(song)
  4. URL resolution (fast path): calls /api/innertube/player to get a direct googlevideo.com audio URL (~200ms)
  5. Passes the URL to the proxy: GET /stream?url=<direct_url>&v=<videoId> -- the proxy just pipes bytes, no yt-dlp needed
  6. If InnerTube fails, falls back to GET /stream?v=<videoId> where the proxy resolves via yt-dlp
  7. audio.play() is called and the browser starts playback as data arrives
  8. After playback starts:
    • Auto-queue fires if only 1 song in queue -- fills queue with related songs via InnerTube radio API
    • Prefetch downloads the next 2 songs as blobs for offline resilience
    • Pre-resolve warms InnerTube URL cache for the next 5 songs
    • Lyrics pre-warm fires the lyrics API request so lyrics are cached before the user opens the panel

Lyrics Resolution

All 4 providers are queried in parallel. Promise.any returns immediately when the first provider delivers synced lyrics. If none have synced lyrics, it falls back to Promise.all and picks the best plain text result. Results are cached server-side for 10 minutes and client-side per session.

Homepage Sections

The homepage fetches YouTube Music's home feed via InnerTube and categorizes each section:

Section Detection Component
Quick Picks First all-songs section QuickPickGrid
Song Suggestions Remaining all-songs sections SongSuggestionRow
Mixes All-playlist sections with "mix"/"radio" in title or radio IDs MixCarousel
Playlists All-playlist sections (non-mix) PlaylistSuggestionRow
Mixed Sections with albums + playlists + songs PlaylistCarousel
Moods Static mood/genre tiles MoodCategoryRow

Attribution

License

This project is for educational purposes only. It is not affiliated with or endorsed by Google. YouTube Music is a trademark of Google LLC.


About

🎡 Arythm β€” A beautiful, open-source web music player powered by YouTube Music. Stream millions of songs, enjoy synced lyrics, and discover new music β€” all from your browser. 🎧

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages