Conversation
- add cache-aside utility with typed CacheKey enum and TTL constants - add Spotify API Client with wrappers for fetching playlists, top artists, and top tracks - implement /api/spotify routes that utilize the Spotify API Client and cache results - handle Spotify 401 and 429 errors explicitly in API routes - transform Spotify responses into simplified formats before caching and returning to clients Note: need to update deprecated attributes or endpoints - audio-features - top artists genres and popularity
- Add Last.fm API client with artist.getTopTags integration - Add genre tag filtering, normalization, and within-artist weighting - Add /api/lastfm/genre-breakdown route with 7-day DB cache - Remove deprecated /api/spotify/audio-features route - Remove deprecated genres and popularity attributes from SpotifyArtist type - Fix SpotifyPlaylist tracks -> items field rename - Add genre_breakdown CacheKey with 7-day TTL - Add LASTFM_API_KEY to env configuration
- Document Last.fm genre integration replacing deprecated Spotify endpoints - Note Spotify 2026 breaking changes (genres, popularity, tracks->items) - Update cache TTL reference table with genre_breakdown 7-day TTL - Add Spotify development mode 25-user limit to target users section - Remove audio features from architecture and SonaUserContext
- Add QueryClientProvider with optimized staleTime and gcTime defaults - Configure Google fonts in root layout - Add useTopTracks, useTopArtists, usePlaylists, useGenreBreakdown hooks - Add ReactQueryDevtools for development debugging
- Add SonaVoice and SectionLabel shared components - Build ArtistsSection with editorial top-3 grid and time range selector - Build TracksSection with ranked list, album art, and duration formatting - Build GenreSection with bars from Last.fm genre breakdown - Build PlaylistsSection with 6-up grid layout - Wire profile page with sticky nav, identity hero, and section anchors - Configure next/image remote patterns for Spotify CDN domains - Fix LCP warning with priority loading on first artist image
- Gate useGenreBreakdown on useTopArtists success to prevent race condition - Add SPOTIFY_RATE_LIMITED handling to playlists route for consistency - Harden Last.fm fetchArtistTopTags with try/catch and API key guard
- Remove deprecated audio features endpoint - Refactor TIME_RANGES constant - Semantic cleanup in profile page and components
Spotify Data Layer
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (28)
📝 WalkthroughWalkthroughThe pull request introduces a comprehensive profile page redesign with Last.fm genre integration. It adds API routes for fetching Spotify top artists, top tracks, and playlists; implements a Last.fm genre breakdown endpoint; creates React hooks for data fetching; develops multiple profile UI components; establishes caching infrastructure; updates type definitions; and configures the necessary environment variables and Next.js settings. Changes
Sequence DiagramsequenceDiagram
participant User
participant Browser as Browser (Client)
participant Profile as Profile Page
participant SpotifyAPI as Spotify API Route
participant LastFmAPI as Last.fm API Route
participant SpotifyService as Spotify Client
participant LastFmService as Last.fm Client
participant Cache as Cache DB
participant SpotifyWeb as Spotify Web API
participant LastFmWeb as Last.fm Web API
User->>Browser: Visit profile page
Browser->>Profile: Render page component
Profile->>SpotifyAPI: GET /api/spotify/top-artists?range=short_term
SpotifyAPI->>Cache: Check cached top_artists:short_term
alt Cache Hit
Cache-->>SpotifyAPI: Return cached artists
SpotifyAPI-->>Profile: Return artists + cached:true
else Cache Miss
SpotifyAPI->>SpotifyService: fetchTopArtists(token, short_term)
SpotifyService->>SpotifyWeb: GET /me/top/artists
SpotifyWeb-->>SpotifyService: Return artist data
SpotifyService-->>SpotifyAPI: Transformed artists
SpotifyAPI->>Cache: setCached top_artists:short_term
SpotifyAPI-->>Profile: Return artists + cached:false
end
Profile->>LastFmAPI: GET /api/lastfm/genre-breakdown
LastFmAPI->>Cache: Check cached genre_breakdown
alt Cache Hit
Cache-->>LastFmAPI: Return cached genres
LastFmAPI-->>Profile: Return genres + cached:true
else Cache Miss
LastFmAPI->>Cache: Load top_artists:short_term
Cache-->>LastFmAPI: Return cached artists
LastFmAPI->>LastFmService: fetchArtistTopTags(artistName) × N
LastFmService->>LastFmWeb: GET /2.0 (artist.gettoptags)
LastFmWeb-->>LastFmService: Return tags
LastFmService-->>LastFmAPI: Tags for each artist
LastFmAPI->>LastFmAPI: aggregateGenres (normalize, weight, rank)
LastFmAPI->>Cache: setCached genre_breakdown
LastFmAPI-->>Profile: Return genres + cached:false
end
Profile->>Browser: Render all sections with fetched data
Browser->>User: Display profile page
Estimated code review effort🎯 4 (Complex) | ⏱️ ~55 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit
Release Notes
New Features
Documentation