MusicFLAC is a modern web application that allows you to download music tracks in lossless FLAC format with CD quality directly from Spotify links. The application uses ISRC (International Standard Recording Code) to uniquely identify tracks and automatically find them on premium services like Tidal, Qobuz, and Amazon Music.
β οΈ Alpha Version: This application is still in active development. Contributions, bug reports, and feedback are very welcome!
MusicFLAC uses an intelligent approach to ensure maximum audio quality:
- π― Spotify Link Analysis: Enter any Spotify URL (track, album, or playlist)
- π’ ISRC Extraction: The app extracts the unique International Standard Recording Code for each track
- π Automatic Search: Uses ISRC codes to find the same tracks on premium services
- π₯ FLAC Download: Automatically downloads in lossless CD quality format
- π¦ Organization: Single tracks or complete albums organized in ZIP files
No configuration required - everything happens automatically!
FLAC (Free Lossless Audio Codec) is the reference audio format for audiophiles:
- π Authentic CD Quality: 16-bit/44.1kHz without any quality loss
- π¦ Intelligent Compression: Reduces file size by 30-50% while maintaining original audio
- π§ Universal Compatibility: Supported by all professional audio players
- π Future-Proof: Superior quality audio archive for your collection
- π Lossless Conversion: Convert to any format without degradation
Forget compressed MP3 and AAC - experience music as the artist created it!
- π― Superior Audio Quality: Downloads exclusively in lossless FLAC at CD quality
- π΅ Complete Spotify Support: Paste any Spotify link (single track, complete album, or playlist)
- π’ ISRC-Based Search: Precise track identification through international standard codes
- π Automatic Premium Services: Tidal, Qobuz, and Amazon Music as high-quality audio sources
- π± Modern Interface: Responsive dark/light design optimized for desktop and mobile
- π₯ Advanced User Management: Authentication system with admin approval
- π Administrative Dashboard: Detailed statistics, user management, and service configuration
- β‘ Intelligent Downloads: Single FLAC tracks or complete albums in ZIP format
- π§Ή Automatic Cleanup: Automatic removal of temporary files (configurable)
- ποΈ Advanced Debug: Separate debug controls for frontend and backend
- π Real-time Statistics: Download monitoring, active users, and most used services
The installer automatically checks all system requirements, PHP extensions, and directory permissions.
Configure the first administrator user of the application with username, email, and secure password.
Database created successfully! The application is ready to use and properly configured.
Log in with admin credentials or register for a new account. New registrations require approval from an administrator.
Clean and intuitive interface with Spotify URL bar and automatic selection of available download services.
Copy the link of any content from Spotify: single tracks, complete albums, or playlists.
Press "Fetch" to automatically get all metadata via ISRC (title, artist, artwork, duration, etc.).
Choose whether to download the entire album/playlist as ZIP or select individual tracks for FLAC download.
- PHP 7.4+ (strongly recommended PHP 8.x)
- Required PHP Extensions:
PDO SQLite(database)cURL(API calls)Zip(archive creation)OpenSSL(security)JSON(data parsing)mbstring(string handling)
- Web Server: Apache, Nginx, or built-in PHP server for development
- Stable Internet Connection
- Write permissions for directories:
data/,downloads/,cache/
-
Clone the Repository
git clone https://github.com/Fabiodalez/musicflac.git cd musicflac -
Prepare Directories
# Create necessary directories mkdir -p data downloads cache # Set correct permissions chmod -R 755 data downloads cache # If your hosting requires specific owner: # chown -R www-data:www-data data downloads cache
-
Upload to Server
- Upload all files maintaining the directory structure
- Ensure the web server can execute PHP files
-
Run the Installer
π With Web Server (Production):
https://yourdomain.com/installer/π» With Built-in PHP Server (Development):
php -S 127.0.0.1:8080 -t .Then open:
http://127.0.0.1:8080/installer/ -
Follow the Guided Procedure
- β Automatic verification of dependencies and permissions
- π€ First administrator user creation
- πΎ SQLite database configuration
- π Installation completed!
-
First Access
- Log in with the created admin credentials
- The application is ready to use immediately
- Start downloading music in FLAC quality right away!
MusicFLAC is designed to be used immediately after installation:
- Access the application with admin credentials
- Paste a Spotify link in the main bar
- Select your preferred service (Tidal, Qobuz, Amazon Music)
- Press "Fetch" - the app automatically finds tracks via ISRC
- Download single FLAC tracks or complete albums in ZIP
No additional configuration required!
MusicFLAC/
βββ π admin/ # Administrative area
β βββ index.php # Admin dashboard
β βββ users.php # User management
β βββ service.php # Available services management
β βββ settings.php # System settings
β βββ stats.php # Statistics and analytics
βββ π data/ # SQLite database (writable)
βββ π downloads/ # Generated FLAC/ZIP files (writable)
βββ π cache/ # Temporary cache (writable)
βββ π includes/ # Core: bootstrap, config, auth, services, helpers
βββ π installer/ # Installation and upgrade scripts
βββ π js/ # Frontend logic and UX helpers
βββ π css/ # Stylesheets
βββ π img/ # Images and assets
βββ π§ api.php # API endpoints
βββ π index.php # Frontend home
βββ π login.php # Authentication system
βββ π tracks.php # Track display
βββ π about.php # Information page
βββ π status.php # System status
βββ πͺ logout.php # Logout
βββ π signup.php # User registration
βββ π serve.php # Secure file serving by name
- Free registration with admin approval
- Differentiated roles: standard users and administrators
- Secure sessions: HTTP-only cookies, SameSite, secure when HTTPS is active
- Per-user statistics: download tracking and analytics
- Real-time statistics: downloads, active users, services used
- Service management: enable/disable Tidal, Qobuz, Amazon Music
- Endpoint override: ability to override base URLs per service
- Debug controls: separate for frontend and backend
- Data export: CSV of download statistics
- User management: activate/deactivate, promote/demote admin, delete users
- Download concurrency: configure from 1 to 8 simultaneous downloads
- Automatic cleanup: configure timeout for temporary files (default: 1 hour)
- Granular debug:
- Frontend Debug UI: show/hide debug panel in interface
- Backend Debug (PHP): enable/disable server logging and browser console
- Admin password change: modify administrator credentials
Two independent controls in Admin β Settings:
- Frontend Debug UI: controls only the visibility of the debug panel/button
- Backend Debug (PHP): master switch for server logging and browser console
- When DISABLED: nothing is written to
debug.logand allconsole.*calls are silenced - When ENABLED: server writes to
debug.logand browser console works normally
- When DISABLED: nothing is written to
Log path: php/debug.log (rotation not provided by the app)
SQLite database created in data/app.sqlite with tables:
-- System settings
settings (key TEXT PRIMARY KEY, value TEXT)
-- Available services
services (id INTEGER PK, name TEXT UNIQUE, enabled INTEGER, endpoint TEXT, config TEXT, notes TEXT)
-- API tokens (if needed)
tokens (id INTEGER PK, service_id INTEGER, name TEXT, value TEXT, updated_at TEXT)
-- Users
users (id INTEGER PK, username, email, password_hash, is_active, is_admin, created_at, last_login, reset_token, reset_token_expires)
-- Download logs
downloads (id INTEGER PK, user_id, username, type, title, spotify_url, service, file_size, ip_address, user_agent, downloaded_at, meta)
-- Active downloads
active_downloads (id INTEGER PK, job_id, title, started_at)
-- System jobs
jobs (job_id TEXT PK, type, total, completed, started_at, finished_at)The app uses api.php internally. Main endpoints:
GET /api.php?action=status- Basic system health informationGET /api.php?action=services- List available services and enable flags
-
POST /api.php?action=fetch_metadata(application/x-www-form-urlencoded)- Parameters:
url=<spotify_url> - Returns: normalized metadata for track/album/playlist
- Parameters:
-
POST /api.php?action=prepare_track(JSON)- Body:
{ service, track, job_id? } - Returns:
{ ok, file }- downloads single FLAC track
- Body:
-
POST /api.php?action=prepare_album(JSON)- Body:
{ service, tracks, album, job_id? } - Returns:
{ ok, file }- creates ZIP with multiple tracks
- Body:
-
Other UI endpoints:
active_downloads,job_status
Note: All API endpoints require authenticated user and respect service enablement status.
DOWNLOAD_DIR: generated files directory (default:downloads/)CACHE_DIR: cache directory (default:cache/)DOWNLOAD_EXPIRY_TIME: cleanup threshold in seconds (default:3600)SUPPORTED_SERVICES: list of supported service keys and names*_API_URL: default base endpoints per service (overridable in Admin)USER_AGENT: default user-agent for external requestsDEBUG_LOG_FILE: absolute path todebug.log
download_concurrency(1β8)frontend_debug(0/1)backend_debug(0/1)
For quick testing without Apache/Nginx:
cd musicflac
php -S 127.0.0.1:8080 -t .
# Visit: http://127.0.0.1:8080/installer/install.phpNote: Some hosts may require .htaccess or server rules for PHP handling; this app uses direct *.php endpoints and doesn't require URL rewriting.
- Back up your database: copy
data/app.sqlite - Replace application files with the new release (keep
data/,downloads/, andcache/) - Visit
installer/upgrade.phpif present to run migrations - Clear browser cache and reload the app
- Verify Admin β Stats and basic flows
- Hardened sessions: HTTP-only cookies, SameSite, secure when HTTPS detected
- CSRF protection: tokens protect POST actions in admin
- Escaped output: all outputs are escaped with
htmlspecialchars() - Avoid public exposure: review legal/compliance aspects before exposure
- Log rotation: use OS logrotate for
debug.logif backend debug active
- Subdirectory support: app calculates base URL at runtime, so hosting under subfolder like
/musicworks - File permissions:
data/,downloads/, andcache/must be writable by web server - Automatic cleanup: background cleanup runs per request to delete old files in
downloads/andcache/ - Installer redirect: any page redirects to
installer/install.phpuntil app is fully installed
π Non-writable directories
# Set correct permissions
chmod -R 755 data downloads cache
# On some hosting it might be necessary:
chown -R www-data:www-data data downloads cacheπΎ Database error or corruption
# Delete database and re-run installer
rm data/app.sqlite
# Navigate to: https://yourdomain.com/installer/π§ Missing PHP extensions
# Ubuntu/Debian
sudo apt update
sudo apt install php-sqlite3 php-curl php-zip php-mbstring php-json php-openssl
# CentOS/RHEL/AlmaLinux
sudo yum install php-pdo php-curl php-zip php-mbstring php-json php-openssl
# Verify installation
php -m | grep -E "(sqlite|curl|zip|json|mbstring|openssl)"π Subdirectory issues
- The application automatically calculates base URL at runtime
- Ensure web server serves PHP files correctly in the subfolder
- Verify there are no restrictions in Apache/Nginx configurations
π "Not installed" redirect loop
- App bootstrap automatically redirects to installer until:
- Database
data/app.sqlitedoesn't exist or isn't valid - At least one administrator user doesn't exist
- Database
- Solution: Complete installation via
/installer/
π Debug not working
- To enable full logging: Admin β Settings β "Backend Debug (PHP)"
- To show debug panel: Admin β Settings β "Frontend Debug UI"
- Log file: check
php/debug.login app directory - Browser console: only works if "Backend Debug (PHP)" is enabled
π SQLite/Database errors
# Check data directory permissions
ls -la data/
# Test file creation in directory
touch data/test.txt && rm data/test.txt
# Verify SQLite is installed
php -m | grep sqlite
# Manual database test
sqlite3 data/app.sqlite ".tables"π Network/API issues
- Verify server has Internet access
- Check firewall that might block outgoing connections
- Test connectivity manually:
curl -I https://api.spotify.com/- β PHP 7.4+ installed and working
- β
PHP Extensions:
pdo_sqlite,curl,zip,json,mbstring,openssl - β Web server configured to serve PHP files
- β Stable Internet connection for API calls
- β
Directory
data/exists and has 755 or 777 permissions - β
Directory
downloads/exists and has 755 or 777 permissions - β
Directory
cache/exists and has 755 or 777 permissions - β Directory owner compatible with web server user
- β
File
data/app.sqlitepresent after installation - β
Installation completed via
/installer/ - β At least one administrator user created
- β No error messages during setup
- β "Backend Debug (PHP)" enabled in Admin β Settings
- β
File
php/debug.logcreated and writable - β Web server error logs consultable
- β Browser console shows any JavaScript errors
- β Server can reach Internet
- β No firewall blocking outgoing connections
- β Target services (Spotify, Tidal, etc.) reachable
- β User agent and headers not blocked
Quick test commands:
# Test PHP extensions
php -r "echo 'SQLite: ' . (extension_loaded('pdo_sqlite') ? 'OK' : 'MISSING') . PHP_EOL;"
php -r "echo 'cURL: ' . (extension_loaded('curl') ? 'OK' : 'MISSING') . PHP_EOL;"
# Test directory permissions
ls -la data downloads cache
# Test writing
echo "test" > data/write_test.txt && rm data/write_test.txt && echo "Write permissions OK"
# Test built-in PHP server
cd /path/to/musicflac
php -S localhost:8080 -t . &
sleep 2 && curl -s http://localhost:8080/api.php?action=status
# Test database
sqlite3 data/app.sqlite "SELECT name FROM sqlite_master WHERE type='table';"Important log files to check:
php/debug.log- Application debug log/var/log/apache2/error.log- Apache errors/var/log/nginx/error.log- Nginx errors/var/log/php_errors.log- PHP errors (path varies)
API connectivity tests:
# Test Spotify API
curl -I "https://api.spotify.com/v1/"
# Test general connection
ping -c 3 8.8.8.8We're in Alpha phase and every contribution is valuable!
- Fork the repository and create a branch for your feature
- Commit changes with descriptive messages
- Open a detailed Pull Request
- Use GitHub Issues to report problems
- Include steps to reproduce the bug
- Specify PHP version, operating system, and browser
- Attach screenshots if helpful
- Propose new features in Issues
- Explain the use case and benefits
- Let's discuss implementation together
This project is released under Apache License 2.0. See the LICENSE file.
Copyright 2024 MusicFLAC Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
MusicFLAC is provided "as-is" for personal and educational use.
- βοΈ Respect the terms of service of Spotify, Tidal, Qobuz, Amazon Music
- π Educational use: understanding audio formats and web technologies
- π Personal use: managing your own music collection
- π« Not for redistribution: don't share downloaded files
Developers are not responsible for misuse of the application.
π΅ Start building your FLAC quality music collection today! π΅
β Give us a star if the project is useful to you! β







