How iborntowin/nasmytunes works
Project type and purpose
• This is a full-stack, monolithic web application written in Python (Flask or Flask-style), with a static front-end (HTML/CSS/JS) served from the same server.
• Its goal: take a Spotify playlist URL, fetch track metadata via the Spotify API, search and download audio from YouTube, convert tracks to MP3 (using FFmpeg), bundle them in a ZIP, and serve them to the user.
File structure (layers and modules)
• Top-level entrypoints:
• app.py / src/main.py: Flask app startup
• start.sh / start_production.py: production launch scripts
• Routes/controllers (src/routes): conversion.py, spotify.py, youtube.py, user.py
• Business logic/services (src/utils): YouTube bypass/download modules, alternative platform modules, cookie bypass, FFmpeg invocation
• Data models (src/models) + database (src/database/app.db): user and session persistence (SQLite)
• Static assets (src/static): front-end UI (index.html, styles.css, app.js, glassmorphism demo notice)
• Config/deployment: Dockerfile, railway.json, render.yaml, vercel.json, Procfile
Main components
a. Client (Web Browser)
• Loads static HTML/CSS/JS, initiates REST calls.
b. Web Server (Flask Application)
• HTTP layer (Flask routes/controllers)
• Service layer (Spotify API client, YouTube downloader, bypass modules)
• Conversion engine (FFmpeg process)
• ZIP bundling module
• Persistence layer (SQLite via ORM in src/models)
c. Database (SQLite file)
d. File storage / temp workspace
• Intermediate MP3 files, ZIP archives on local disk (or ephemeral container storage)
e. External Services
• Spotify Web API
• YouTube (unofficial bypass download endpoints)
• (Optional) Genius API for metadata
Relationships and data flows
• Browser → (HTTP GET/POST) → Flask
• Flask → (API calls over HTTPS) → Spotify API
• Flask → (HTTP requests + bypass logic) → YouTube download servers
• Flask → (shell invocation) → FFmpeg for MP3 conversion
• Flask → (filesystem I/O) → Local storage (MP3 + ZIP)
• Browser ← (HTTP file stream) ← Flask (ZIP download)
• Flask ↔ (SQLite queries) ↔ Database
Architectural patterns and design principles
• Layered architecture:
• Presentation layer (static front-end + Flask view functions)
• Application layer (controllers + service modules under src/utils)
• Data layer (ORM models + SQLite DB)
• Single-container monolith deployed via Docker/Railway/Render/Vercel
• Plugin-style downloader modules: utility classes in src/utils
• Synchronous request flow (no separate background worker, though could be extended)
Relevant technologies/frameworks
• Python 3.x, Flask (or Flask-like framework)
• SQLite (app.db) via SQLAlchemy or similar ORM
• FFmpeg CLI for audio transcoding
• Front-end: vanilla JS + HTML/CSS (glassmorphism UI)
• Deployment: Docker, Railway, Render, Vercel (serverless)