This repository contains the professional, lightweight, and high-performance source code used for the official website of music producer Duargan.
While this instance serves as Duargan's portfolio, the project is built as a reusable and SEO-optimized CMS engine designed specifically for electronic artists and producers to manage their discography, announcements, and social presence.
- Responsive MD3 Design: A modern and responsive interface following Material Design 3 principles with native Dark/Light mode support.
- Dynamic Discography: Client-side filtering by genre and release type, with date-based sorting.
- SEO & Social Sharing: Dynamic Open Graph (OG) tags for every song. When you share a track, social media platforms show the specific cover art and title.
- High Performance & Lightweight: Native lazy-loading for images and Intersection Observer animations for smooth scroll reveals. Lightweight code (src folder without images is less than 1MB).
- Custom Announcements: A customizable banner for important news (new releases, tours, etc.).
- Full CRUD Management: Easily add, edit, or delete songs, genres, platforms, and social media.
- Smart Image Processing: Automatically resizes high-res uploads to 900px and converts them to WebP for lightning-fast loading without quality loss.
- Secure Authentication: Protected by Two-Factor Authentication (2FA/TOTP) and CSRF protection.
- SVG Integration: Manage platform icons using raw SVG code with built-in XSS sanitization.
- Storage Cleanup: Automatically deletes old image files from the server when a song is updated or removed.
This project is fully containerized for a "zero-config" development experience.
docker-compose.yml: Orchestrates three interconnected services:web: The main application server. It builds from the localDockerfile, maps the web port, and mounts the./srcfolder as a volume for real-time code updates. It also injects a customphp.inito override default upload limits.db: A MariaDB container that persists data in./data/mysql. It automatically executesmysql/init.sqlon the first run to bootstrap the database schema.phpmyadmin: A GUI for database management accessible at port 8080.
Dockerfile: (Located in the root) This file defines the server environment. It uses an official PHP-Apache image, installs theGDlibrary (required for the CMS's smart image resizing), enablespdo_mysqlfor database communication, and activates Apache'smod_rewriteto handle the MVC routing.
- [Docker] installed.
-
Clone the repository:
git clone https://github.com/FroggyWarrior/duargan.com.git cd duargan.com -
Configure environment variables: Create a
.envfile in the root directory (copy from.env.exampleif provided) and set your database credentials. -
Spin up the containers:
docker compose up -d
-
Access the site locally:
- Public Site:
http://localhost - Admin Panel:
http://localhost/admin - Database (phpMyAdmin):
http://localhost:8080
- Public Site:
If you prefer to deploy on a traditional shared hosting service (CPanel) or a standard VPS:
- Requirements:
- PHP 8.1+ with
gd,pdo_mysql, andmbstringextensions. - MySQL or MariaDB server.
- Apache with
mod_rewriteenabled.
- PHP 8.1+ with
- Upload: Move the contents of the
src/directory to your server's root. - Document Root: Configure your web server to point its Document Root to the
/publicdirectory. Never point it to the project root, as this would expose your source code and.envfiles.- If you're using a shared hosting service, you probably won't be able to change what the Document Root points to. In that case, move the contents of
publicinto public_html (or whatever it's called in your website), and the rest (theappfolder and your.envfile) into another folder outside ofpublic_html. After that, change the$base_dirvariable onindex.phpto point to that folder.
- If you're using a shared hosting service, you probably won't be able to change what the Document Root points to. In that case, move the contents of
- Database: Create a database and import yours. Change the values in
Database.phpwith your own. - Environment: Create a
.envfile in the root (copy from.env.example) and fill in your own credentials. - Permissions: Ensure the
public/img/covers/directory is writable by the web server user (www-data).
The project is powered by a custom-built PHP MVC (Model-View-Controller) architecture:
app/Core/: The engine (Router, Database Singleton, Base Controller).app/Controllers/: Application logic (Public pages vs. Admin dashboard).app/Models/: Database interactions and data logic.app/Views/: HTML templates and page-specific scripts.app/Utils/: Security utilities (2FA, SVG Sanitizer).public/: The only directory accessible to the web (Router index, CSS, JS, Images).
If you are an artist forking this repository to build your own official website, here is how to customize it:
- Logo: Replace
public/img/logo.svgwith your own vector logo. - Profile Picture: Replace
public/img/me.jpgwith your artist photo. - Colors: Open
public/css/styles.cssand modify the CSS variables in:root. Changing--primarywill update the accent color across the entire site.
- About Me: Edit
app/Views/about.phpto update your biography. - Contact: Update the email addresses and Discord links in
app/Views/contact.php. - SEO: Set your default site title and keywords in
app/Controllers/BaseController.php.
If you plan to upload very large high-res covers, ensure your hosting provider or php.ini allows files up to 20MB. This is already configured in the provided src/php.ini and src/public/.htaccess.
- CSRF Protection: All administrative POST requests require a valid token.
- 2FA: It is highly recommended to enable 2FA in the "Credentials" section of the admin panel immediately after setup.
- Dual-User DB: The app uses separate database users for reading (public) and writing (admin) to minimize the impact of potential SQL injections.
- XSS Prevention: All user-generated SVG content is sanitized before being rendered.
The project is actively evolving. Here are the planned features:
- Albums Support: Ability to group tracks into EPs and Albums.
- Improved Workflow: Add new song types and genres directly from the song creation form without leaving the page.
- Play and download songs Add a player to song.php so visitors can play songs, and download them if it's a free release.
- Smart Onboarding: Automatic setup wizard for the admin panel if no database is detected, making the CMS truly plug-and-play, with import and export feature.
- Dynamic Content: Make 100% of the public site content (bio, contact info) editable via the admin dashboard.
- Customizable SEO Edit SEO info directly from the Admin Panel.
- UI Overhaul: Migration to Material 3 Expressive with enhanced transparency effects and smooth motion transitions.
- Multi-selection editing Change the genre, release date or song type of multiple songs at once.
- Lyrics and music videos Embedded YouTube player and lyrics section in the songs details page.
- Concerts and merch Integrate with third-party platforms (or maybe build an open source alternative?) for selling tickets and merch.
- Stats and metrics Show anonimized stats directly in the admin panel for easy understanding of the fanbase.
- Likes and comments Allow listeners to rate songs and leave feedback, improving the social interaction with the artist.
- Contact form Basic contact form in the contact page.
π‘ Have a suggestion? We want to hear from you! Please feel free to open an issue to ask for new features or report bugs.
This project is licensed under the GPL-3.0 License. You are free to fork, modify, and distribute this software, provided that the source code remains open.
Contributions are welcome! If you find a bug or have a feature request, please open an issue or submit a pull request.
Made with β€οΈ by FroggyWarrior