Telemetry & Music Analytics
LOCAL.FM
Status
Production / Stable
Year
2023
A self-hosted music statistics dashboard that brings scrobbling back to your own hardware. Track your listening habits on Spotify with detailed analytics, daily summaries, and yearly recaps.
Local.fm was born out of a desire for data privacy and high-fidelity analytics. While platforms like Last.fm exist, they often limit data access and historical depth. This project leverages the Spotify API to create a real-time bridge to a local PostgreSQL instance, enabling complex SQL queries and custom visualizations that are impossible on standard platforms.
System Architecture
The system utilizes a Node.js worker that polls the Spotify API via OAuth2, transforming raw JSON telemetry into relational records. A Next.js frontend communicates with the PostgreSQL database through a optimized Prisma layer, ensuring low-latency access to millions of historical scrobbles.
Spotify Realtime
Automatically track listening habits from Spotify with WebSocket updates.
Historical Data
Import entire Spotify streaming history from JSON exports.
Visual Insights
Interactive heatmaps, habit distributions, and genre breakdowns.
Technical Challenges
Rate Limit Management
Implemented a sophisticated token-bucket algorithm to stay within Spotify's API limits while maintaining real-time sync.
Data Integrity
Built a custom deduplication engine to handle overlapping sync windows and ensure scrobble accuracy.
Core Stack
Source Access
Developer Note
This project represents a push towards localized, high-performance infrastructure. Every architectural decision was made to prioritize data ownership and system resilience.