How cgzirim/seek-tune works
Project type and purpose
• SeekTune is a full‑stack song‑recognition web application implementing Shazam’s audio‑fingerprinting algorithm.
• It exposes a React frontend (in “client/”) served by a Go backend API (in “server/”).
• The backend handles audio processing, fingerprint generation, database storage (SQLite or MongoDB), and external API integrations (Spotify & YouTube).
File structure
• Top‑level: Docker (Dockerfile, docker‑compose.yml, .env.example), orchestration scripts (scripts/), README, LICENSE.
• “client/”: React app with public assets (including WebAssembly runtime, compiled .wasm), source components, CSS modules.
• “server/”: Go modules for:
– HTTP entrypoint (main.go, socketHandlers.go, cmdHandlers.go)
– Audio I/O and conversion (wav/)
– Fingerprinting algorithm (shazam/)
– Database adapters (db/client.go, mongo.go, sqlite.go)
– External APIs (spotify/, including download and YouTube fallback)
– Utility packages (utils/logger, helpers).
• There’s also a “server/wasm/” directory—Go code compiled to WASM for client‑side fingerprinting.
README for technical stack and flow
• Frontend: React, WebAssembly (WASM), communicates via HTTP/S or WebSocket to the Go server.
• Backend: Golang HTTP server, uses ffmpeg for conversions, persists fingerprints and track metadata to SQLite or MongoDB.
• External services: Spotify API (to fetch metadata and track audio), YouTube (to download tracks).
Main components & their interactions
a. Frontend (React + WASM)
– Hosts UI (App.js, components/)
– Loads WebAssembly fingerprinting engine (main.wasm + wasm_exec.js)
– Captures audio input or references local files, generates fingerprint locally or sends to server for processing
– Sends REST / WebSocket requests to backend endpoints.
b. Backend API (Go server)
– HTTP Server (main.go) routes requests (download, save, find, erase) to command handlers.
– Audio conversion pipeline (wav/convert.go + ffmpeg)
– Fingerprinting engine (shazam/) used for matching.
– Database layer (db/) abstracts SQLite or Mongo connections.
– External integration (spotify/ & youtube fallback) for fetching audio and metadata.
c. Database
– SQLite (default) or MongoDB (via env vars).
– Stores song metadata, fingerprints, match results.
d. External Services
– Spotify Web API
– YouTube (for audio download)
– FFmpeg (local binary invoked by backend).
Architectural patterns & principles
• Layered architecture: Presentation (frontend), Application/API, Domain (fingerprinting logic), Infrastructure (DB + external APIs).
• Modular design: Each concern in its own package (shazam, wav, spotify, db).
• Use of WebAssembly to offload fingerprint generation to client (optional path).
• Configuration via environment variables, containerized deployment with Docker Compose.