How wolefabikun/lujay works
Project Type and Purpose
• Full-stack web application built with Next.js (app router + API routes)
• Allows users to search Spotify, get recommendations, preview tracks, and download audio previews
Main Components
a. Frontend (Next.js app)
• Server-Rendered React pages (app/layout.tsx, page.tsx, recommendations/page.tsx)
• UI components (components/, ShadCN UI library)
• Static assets (public/, fonts, globals.css)
b. Backend (Next.js API routes)
• Authentication endpoints (spotify/auth/route.ts, callback)
• Data endpoints (search, recommendation, track-data, user-info, refresh_token, download)
• Utility modules (src/lib/getToken.ts, src/lib/utils.ts)
c. External Services
• Spotify Web API (authentication, search, recommendations, user data)
d. Deployment / Hosting
• Vercel (build & deploy)
Relationships and Data Flows
• User’s browser → HTTP request → Next.js frontend page
• Frontend → calls Next.js API routes (using Axios or fetch)
• API routes → request to Spotify Web API (OAuth token exchange, search, recommendations)
• Spotify API → returns JSON payloads → API route processes via utils → returns to frontend
• Frontend → renders UI, plays audio previews, triggers “Download Previews” route
• Download route → gathers preview URLs → streams files back to user as ZIP or folder
Architectural Patterns & Key Technologies
• App Router pattern (Next.js 13) separating UI layers (app/) from API layers (app/api/)
• Server Functions for all backend logic—no separate microservice needed
• ShadCN UI for design system components, Tailwind for styling
• Axios or native fetch in API and UI (lib/utils.ts)
• Token management via getToken.ts, refresh_token endpoint for long-running sessions
Essential Elements
• Clear component names (e.g., “Search Page”, “Recommendations API Route”)