Instagram Story report generator (1080x1920) built from Last.fm listening data, with a Next.js web UI for configuring, customizing, and previewing reports in real-time.
- ✅ Monthly Listening Report - Generates Instagram Story (1080×1920) with listening stats
- ✅ Live Web UI - Real-time preview and configuration with 50/50 layout (form + preview)
- ✅ Customizable Modules - Toggle statistics, top items, mosaic, word cloud on/off
- ✅ Top Artists Mosaic - Dynamic grid layout (2-5 artists per row, up to 10 artists)
- ✅ Word Cloud - Tag cloud from top artists with accent color gradient
- ✅ Adaptive Text Colors - Automatic white/black text based on background luminance
- ✅ Custom Date Ranges - Override the default previous month with any date range
- ✅ Fontawesome Icons - Star icon for artists, disc icon for albums, note for tracks
- ✅ Smart Image Fallbacks - Multi-level fallback chain for artist/album/track images
- ✅ Intelligent Caching - Caches Last.fm API responses, reuses on config changes
- ✅ No Avatar - Lightweight, clean design without user avatar
npm install
cd web && npm installLASTFM_API_KEY=your_api_key
LASTFM_USERNAME=your_usernameCLI mode:
npm startWeb UI mode:
npm run webThen open http://localhost:3000 to configure and preview in real-time.
story-report/
├── index.js
├── README.md
├── QUICK_START.md
├── ARCHITECTURE.md
├── FAQ.md
├── AGENTS.md
├── .gitignore
├── package.json
├── web/
│ ├── package.json
│ └── pages/
│ ├── index.js
│ └── api/
│ ├── generate.js
│ └── report-image.js
└── generated/
├── report.typ
├── report.png
└── assets/
├── artist.*
├── album.*
└── track.*
Note: the generated directory is ignored by git.
- final image: generated/report.png
- API snapshot: generated/report.json
- Typst source: generated/report.typ
- downloaded helper images: generated/assets
The web UI provides real-time controls for:
- Font - 8 font presets displayed in their own fonts
- Background Color - Custom hex color for page background
- Accent Color - Custom hex color for highlights and text
- Date Range - Override the default previous month (ISO format: YYYY-MM-DD)
- Text Color Mode - Auto (based on background luminance), Light (white), or Dark (black)
- Mosaic Artist Count - 2, 4, 6, 8, or 10 artists in the top artists grid
- Module Toggles:
- Statistics (artists, albums, tracks count)
- Top Artists Mosaic
- Top Items (top artist, album, track)
- Word Cloud (top tags)
- Footer Text - Custom footer or leave empty to hide
Use the web UI font presets, or edit config.js if you want to change the default font family:
typography: {
font: 'Segoe UI', // Change to 'Courier New', 'IBM Plex Mono', 'JetBrains Mono' for monospace
monoFont: 'Courier New', // Fallback monospace font
...
}Common monospace fonts:
Consolas(default monospace fallback on Windows)Courier NewJetBrains MonoInconsolata
Edit config.js page margins and spacing properties:
page: {
margin: {
top: '60pt',
bottom: '60pt',
left: '48pt',
right: '48pt',
},
}Edit config.js icons section to customize the minimalist Unicode symbols:
icons: {
artists: '★', // BLACK STAR - change to ◆, ◈, etc.
albums: '◉', // FISHEYE (vinyl-like) - change to ◯, ◎, etc.
tracks: '♪', // EIGHTH NOTE - change to ♫, 🎵, etc.
}Use the web UI controls or edit config.js colors section.
The main extension points are:
- data aggregation: aggregateListeningData in index.js
- layout and typography: generateTypstTemplate and generateTagCloud in index.js
- image fallbacks: extractImageUrls, extractTrackImageUrls, downloadImage in index.js
- tag cloud styling: generateTagCloud function in index.js
- web UI: web/pages/index.js and web/pages/api/report-image.js
- Typst is not detected:
- run typst --version,
- add Typst to PATH.
- No data appears:
- make sure the account has scrobbles in the previous month.
- Missing images:
- Last.fm often returns empty image fields,
- the project has fallbacks, but not every entity has artwork in the API.
- Web UI preview does not load:
- make sure
npm run webis running from the repo root, - the preview image is served from
/api/report-imageinside the Next.js app.
- make sure
- do not commit .env
- do not commit generated images or runtime artifacts
MIT