mirror of
https://github.com/rmdes/indiekit-endpoint-lastfm.git
synced 2026-02-25 05:56:19 +00:00
Last.fm scrobble and listening activity endpoint for Indiekit
- JavaScript 78.5%
- Nunjucks 16.7%
- CSS 4.8%
The lastfm.widget.title key was referenced in the admin template but missing from locale files, causing raw key strings to display instead of labels. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| assets | ||
| includes | ||
| lib | ||
| locales | ||
| views | ||
| .gitignore | ||
| CLAUDE.md | ||
| index.js | ||
| package.json | ||
| README.md | ||
@rmdes/indiekit-endpoint-lastfm
Last.fm scrobble and listening activity endpoint for Indiekit.
Features
- Display scrobble history from Last.fm
- Now playing / recently played status
- Loved tracks
- Listening statistics (top artists, albums, trends)
- Background sync to MongoDB for offline access
- Public JSON API for frontend integration
Installation
npm install @rmdes/indiekit-endpoint-lastfm
Configuration
Add to your Indiekit config:
import LastFmEndpoint from "@rmdes/indiekit-endpoint-lastfm";
export default {
plugins: [
"@rmdes/indiekit-endpoint-lastfm",
// ... other plugins
],
"@rmdes/indiekit-endpoint-lastfm": {
mountPath: "/lastfmapi",
apiKey: process.env.LASTFM_API_KEY,
username: process.env.LASTFM_USERNAME,
cacheTtl: 900_000, // 15 minutes
syncInterval: 300_000, // 5 minutes
limits: {
scrobbles: 20,
loved: 20,
topArtists: 10,
topAlbums: 10,
},
},
};
Environment Variables
| Variable | Description |
|---|---|
LASTFM_API_KEY |
Your Last.fm API key (get one here) |
LASTFM_USERNAME |
Last.fm username to track |
API Endpoints
| Endpoint | Description |
|---|---|
GET /api/now-playing |
Current or recently played track |
GET /api/scrobbles |
Paginated scrobble history |
GET /api/loved |
Paginated loved tracks |
GET /api/stats |
Listening statistics |
GET /api/stats/trends |
Daily scrobble trends |
Requirements
- Node.js >= 20
- Indiekit >= 1.0.0-beta.25
- MongoDB (for background sync and statistics)
License
MIT