A hobby music charts dashboard displaying weekly Spotify streaming data across multiple regions (Global, US, GB, IN, etc.).
Spotifx is a static SvelteKit site that provides an interactive dashboard to view Spotify charts. The data is scraped from kworb.net, processed into static JSON files via a Bun script, and deployed to Cloudflare Pages.
- Global & Regional Charts: View top streamed tracks for various countries.
- Fast & Static: Fully pre-rendered static site using SvelteKit 2 and Svelte 5.
- Deep Integrations & UX: Includes highlight tracking, dynamic stats bar (total streams, entries, biggest movers), search debouncing, keyboard shortcuts, and a responsive Hero track display with compact stream formatting.
- Modern Styling: Built with TailwindCSS v4 natively using
@theme. - Automated Scraping: Daily data updates via GitHub Actions.
- Framework: SvelteKit (Svelte 5 Runes)
- Styling: TailwindCSS v4
- Runtime & Scripts: Bun
- Hosting: Cloudflare Pages
Spotifx features a custom, gapless Music Player built on top of the YouTube IFrame API:
- Streaming Quality: YouTube's API does not support native "audio-only" streaming. To save bandwidth, we constrain the player to
1x1pixels, which signals YouTube's Adaptive Bitrate (ABR) algorithm to stream the lowest available video quality (typically 144p). The audio quality remains standard (usually ~128kbps AAC/Opus). - Hidden Video Location: The actual YouTube iframe is mounted completely off-screen (
left: -9999px,top: -9999px) inside afixed,pointer-events-nonecontainer inMusicPlayer.svelte. The UI you interact with is 100% custom Svelte/Tailwind. - Handling Ads: spotifx passes
modestbranding: 1andrel: 0, and ignores annotations (iv_load_policy: 3). However, as per YouTube's embedded policies, ads may still occasionally play depending on the copyright holder of the track. - Error Recovery: Tracks that restrict external embedding (YouTube Error 101/150) are automatically skipped. If the player hits 5 consecutive errors, it pauses safely to prevent infinite skip loops.
- Bun is required to run the scripts and install dependencies.
- Clone the repository:
git clone <repository-url> cd Spotifx
- Install dependencies:
bun install
- Scrape the latest data (populates
src/lib/data/):bun run scrape
- Start the development server:
bun run dev
Spotifx is built as a static site using @sveltejs/adapter-static. It must be deployed to Cloudflare Pages (not Workers) as it requires no server-side rendering.
- In your Cloudflare Dashboard, go to Workers & Pages -> Create application -> Pages -> Connect to Git
- Select your repository.
- Configure the build settings:
- Framework preset: SvelteKit
- Build command:
bun run build - Build output directory:
build
- Set the
BUN_VERSIONenvironment variable to ensure Cloudflare uses Bun. - Deploy. Cloudflare Pages will automatically serve the static files from the
builddirectory.
scripts/scrape.ts- The data scraping pipeline.src/lib/data/- Locally stored static JSON chart data.src/routes/- SvelteKit frontend implementation.src/lib/components/- Svelte components (ChartTable, CountrySelector, etc.).
Refer to the LICENSE file for details.