How taqitahmid1029/spotify-clone works
Project type and purpose
• This is a client-side only “Spotify Clone” — a static web application (HTML, CSS, JavaScript) that runs in the browser and uses the user’s local folder structure (served via a simple HTTP server) as “playlists.”
• Purpose: Discover playlists by scanning the Playlists directory, read JSON metadata, present a UI for browsing and playing audio files via the HTML5 Audio API.
File structure
• Top-level:
• Playlists/ – contains subfolders (one per playlist) each with audio files and an info.json
• index.html – single entry point and skeleton UI
• style.css – styling
• script.js – application logic (fetch playlists, render UI, handle playback)
• No backend code; must be served over HTTP to allow fetch() to access JSON and media.
Insights from the README
• Confirms local-only, static server requirement
• Explains that each folder under Playlists is treated as one playlist, optional cover image and JSON metadata.
Components & diagramming strategy
a. Main components
• Browser UI Layer
• Application Logic (script.js)
• Local Development Server (e.g., Live Server/Python HTTP)
• File System (Playlists directory + audio/JSON files)
• HTML5 Audio API (built into browser)
b. Relationships & interactions
1. User opens index.html → Browser requests index.html from Local Server.
2. script.js executes → Fetches directory listing or iterates known playlist paths via fetch() calls to JSON (info.json) and then to audio URLs.
3. script.js parses JSON metadata and dynamically injects DOM elements (playlist cards, track list).
4. User clicks “play” → JS calls HTML5 Audio API with the local-server-served audio URL.
5. Audio API streams/decodes the file and outputs sound.
c. Architectural patterns & principles
• Single-Page Application (SPA)-like pattern: one HTML entry point, dynamic DOM updates.
• Separation of concerns:
– Model: JSON metadata + audio URLs
– View: index.html + style.css
– Controller: script.js orchestrating fetch, rendering, and playback
• No persistent state beyond the browser’s session; everything loaded at runtime.
d. Key technologies
• HTML5 (audio element)
• CSS3 (layout, theming)
• Vanilla JavaScript (Fetch API, DOM manipulation, Audio API)
• Lightweight HTTP server (VS Code Live Server or Python http.server)
Detailed elements
– Labels: “index.html”, “style.css”, “script.js”, “Playlists/…/info.json”, “audio files”
– Note the requirement: “Must run via local HTTP server”
– Call out optional metadata: cover.jpg or playlist_info.json