An open-source alternative to stats.fm - A music statistics platform for Spotify users. Track your listening habits, discover your top tracks and artists, and analyze your music preferences over time.
- π§ Top Tracks & Artists - View your most played music across different time periods (4 weeks, 6 months, all time)
- π Listening Statistics - Detailed analytics of your music consumption with interactive charts
- οΏ½ Data Visualization - Beautiful charts showing listening trends, genre distribution, and activity patterns
- οΏ½π Recently Played - Track your recent listening history with daily activity graphs
- π¨ Modern UI - Clean, responsive design built with Tailwind CSS
- π Privacy First - Your data stays yours, fully transparent and open-source
- π± Responsive Design - Works seamlessly on desktop, tablet, and mobile
- Framework: Next.js 14 (App Router)
- Authentication: NextAuth.js with Spotify OAuth
- Database: PostgreSQL with Prisma ORM
- Styling: Tailwind CSS
- Data Fetching: SWR for efficient caching
- API: Spotify Web API
- TypeScript: Full type safety
- Node.js 18+ and npm
- PostgreSQL database
- Spotify Developer Account
git clone https://github.com/yourusername/statly.git
cd statlynpm install- Go to Spotify Developer Dashboard
- Create a new application
- Add
http://localhost:3000/api/auth/callback/spotifyto Redirect URIs - Copy your Client ID and Client Secret
Copy .env.example to .env and fill in your values:
cp .env.example .envEdit .env:
DATABASE_URL="postgresql://user:password@localhost:5432/statly"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key-here"
SPOTIFY_CLIENT_ID="your-spotify-client-id"
SPOTIFY_CLIENT_SECRET="your-spotify-client-secret"Generate a secure NEXTAUTH_SECRET:
openssl rand -base64 32npx prisma generate
npx prisma db pushnpm run devOpen http://localhost:3000 in your browser.
statly/
βββ prisma/
β βββ schema.prisma # Database schema
βββ src/
β βββ app/
β β βββ api/ # API routes
β β β βββ auth/ # NextAuth configuration
β β β βββ spotify/ # Spotify API endpoints
β β βββ dashboard/ # Dashboard page
β β βββ top-tracks/ # Top tracks page
β β βββ top-artists/ # Top artists page
β β βββ recent/ # Recent tracks page
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Landing page
β βββ components/ # React components
β β βββ Navigation.tsx
β β βββ TrackCard.tsx
β β βββ ArtistCard.tsx
β β βββ ...
β βββ lib/ # Utilities
β β βββ prisma.ts # Prisma client
β β βββ spotify.ts # Spotify API service
β βββ types/ # TypeScript types
β βββ styles/ # Global styles
βββ package.json
βββ tailwind.config.ts
βββ tsconfig.json
βββ next.config.mjs
- Overview of your music statistics with key metrics
- Interactive charts showing top tracks ranking
- Genre distribution pie chart
- 7-day listening activity timeline
- Quick access to top tracks and artists
- Recent listening activity
- View your most played songs
- Interactive bar chart showing track rankings
- Filter by time range (short, medium, long term)
- See album artwork and artist info
- Discover your favorite artists
- Genre distribution visualization
- View artist images and genres
- Filter by different time periods
- Track your listening history
- Daily listening activity chart
- See when each track was played
- Complete track and artist information
- Push your code to GitHub
- Import your repository on Vercel
- Add environment variables in Vercel dashboard
- Deploy
For production, use a managed PostgreSQL service:
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Data visualization with charts (listening trends over time)
- Genre breakdown and analysis
- Playlist generation based on top tracks
- Export statistics and reports
- Social features (share your stats)
- Mobile app (React Native)
- Support for other music platforms (Apple Music, etc.)
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by stats.fm
- Built with Next.js
- Powered by Spotify Web API
If you like this project, please give it a βοΈ on GitHub!
For questions or issues, please open an issue on GitHub.