Last.fm scrobble and listening activity endpoint for Indiekit
  • JavaScript 78.6%
  • Nunjucks 16.6%
  • CSS 4.8%
Find a file
2026-03-28 23:24:56 +01:00
assets fix: use upstream @indiekit/frontend form classes 2026-02-12 20:14:47 +01:00
includes Initial release: Last.fm endpoint for Indiekit 2026-01-24 13:43:56 +01:00
lib fix: store dates as ISO strings instead of Date objects 2026-02-12 22:30:44 +01:00
locales fix: add missing widget.title locale key across all languages 2026-02-17 10:19:12 +01:00
views fix: use upstream @indiekit/frontend form classes 2026-02-12 20:14:47 +01:00
.gitignore Initial release: Last.fm endpoint for Indiekit 2026-01-24 13:43:56 +01:00
CLAUDE.md docs: document startup-gate usage in CLAUDE.md 2026-03-28 23:24:56 +01:00
index.js feat: defer background sync until host readiness signal 2026-03-28 22:11:24 +01:00
package.json feat: defer background sync until host readiness signal 2026-03-28 22:11:24 +01:00
README.md Initial release: Last.fm endpoint for Indiekit 2026-01-24 13:43:56 +01:00

@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