Overview
Discover what makes Ampache powerful
Ampache is a PHP‑based web application that exposes a music and video library over the network, allowing users to stream media from any internet‑enabled device. From a developer’s perspective it functions as a lightweight, metadata‑centric service that relies on existing file organization rather than performing its own cataloging. The core logic is split into a backend API layer and a templated frontend, both of which can be customized or replaced with minimal friction. Ampache’s design prioritizes modularity: almost every functional block (authentication, streaming, metadata extraction) is implemented as a plug‑in or service class, making it straightforward to extend or replace.
Language & Frameworks
Database
Web Server
Caching
Overview
Ampache is a PHP‑based web application that exposes a music and video library over the network, allowing users to stream media from any internet‑enabled device. From a developer’s perspective it functions as a lightweight, metadata‑centric service that relies on existing file organization rather than performing its own cataloging. The core logic is split into a backend API layer and a templated frontend, both of which can be customized or replaced with minimal friction. Ampache’s design prioritizes modularity: almost every functional block (authentication, streaming, metadata extraction) is implemented as a plug‑in or service class, making it straightforward to extend or replace.
Architecture
- Language & Frameworks: Pure PHP (≥8.4 for the latest releases) with a minimal MVC pattern; no heavy frameworks are used, which keeps the footprint small and improves compatibility across web servers (Apache, Nginx, lighttpd, IIS).
- Database: MySQL/MariaDB via PDO; the schema is intentionally flat to support rapid querying of large media collections.
- Web Server: Any server that can run PHP is supported; most developers use Apache with mod_php or PHP‑FPM behind Nginx.
- Caching: Built‑in file‑based caching and optional Memcached support for metadata lookups.
- Streaming: Uses HTTP range requests to stream MP3/FLAC/M4A and video formats; the PHP script acts as a proxy to the media files, allowing for authentication enforcement.
Core Capabilities
- REST‑style API: Fully documented endpoints (
/api.php?action=...) expose catalog data, playback controls, and user management. The API accepts JSON or XML responses, making it suitable for mobile apps, custom dashboards, or integration with home‑automation systems. - Metadata Extraction: The
taglibrary reads ID3v2, Vorbis comments, and other embedded tags; it can also parse file paths for fallback metadata. - User & Permission Model: Fine‑grained ACLs (artist, album, song, playlist) are stored in the database; OAuth2 support is available via a community plugin.
- Playlist & Queue APIs: Programmatic creation, editing, and playback of playlists, including shuffle and repeat logic.
- Webhooks & Events: A lightweight event bus allows plugins to hook into user login, media playback start/stop, and library updates.
Deployment & Infrastructure
Ampache is intentionally lightweight: a single PHP process per web server instance, with optional Docker images available on Docker Hub (ampache/ampache). For scalability, the recommended pattern is:
- Stateless PHP front‑end behind a load balancer (NGINX or HAProxy).
- Shared storage for media files, e.g., NFS or cloud object storage (S3 with a compatible filesystem driver).
- Centralized database (MySQL/MariaDB) with replication for read‑scaling.
- Optional reverse proxy (Caddy, Traefik) for HTTPS termination and automatic ACME certificates.
Because the application is pure PHP, it runs on any LAMP/LEMP stack and can be containerized with minimal image size (~200 MB). The Docker image includes a pre‑configured Apache + PHP-FPM stack, making CI/CD pipelines straightforward.
Integration & Extensibility
- Plugin System: Developers can drop PHP classes into the
plugins/directory; the core automatically discovers and registers them. Existing plugins include OAuth2, Nextcloud sync, and custom authentication backends. - Template Override: All UI templates are plain PHP/HTML files; swapping a theme or adding custom CSS is as simple as copying the template directory.
- CLI Utilities: A
ampache-cliscript exposes commands for bulk metadata updates, cache clearing, and database migrations. - Webhooks: External services can subscribe to events (e.g., “song_played”) via a simple HTTP callback mechanism.
Developer Experience
The codebase is well‑structured with clear separation of concerns, and the public API is versioned. Documentation lives in the GitHub wiki and includes sample requests for each endpoint, making it easy to prototype. Community support is active on GitHub Issues and a dedicated IRC channel; however, the main maintainer’s availability can fluctuate (see project news). The test suite is comprehensive (unit + integration) and uses PHPUnit, which aids in maintaining code quality when extending the platform.
Use Cases
- Home Media Server: Deploy on a Raspberry Pi or NAS, expose the library to all household devices via the web UI or mobile app.
- Custom Media Player: Build a lightweight client that consumes the API for playback, playlist management, and search.
- Enterprise Asset Management: Use the metadata API to integrate with a corporate LMS or streaming service, leveraging Ampache’s ACLs for secure access.
- IoT Integration: Trigger playback or change playlists via webhooks from smart home assistants (Alexa, Home Assistant).
Advantages
- Zero‑Dependency Footprint: No heavy frameworks mean fewer attack vectors and easier deployment on constrained hardware.
- Flexible Licensing: GPL‑v3 allows commercial use while encouraging community contributions.
- Performance: Streaming via PHP range requests is efficient for moderate loads; the flat database schema scales well with thousands of tracks.
- Extensibility: The plugin architecture and
Open SourceReady to get started?
Join the community and start self-hosting Ampache today
Related Apps in other
Immich
Self‑hosted photo and video manager
Syncthing
Peer‑to‑peer file sync, no central server
Strapi
Open-source headless CMS for modern developers
reveal.js
Create stunning web‑based presentations with HTML, CSS and JavaScript
Stirling-PDF
Local web PDF editor with split, merge, convert and more
MinIO
Fast, S3-compatible object storage for AI and analytics
Weekly Views
Repository Health
Information
Explore More Apps
BTCPay Server
Self‑hosted Bitcoin payment processor, zero fees, no middleman
txtdot
Text‑only web proxy for faster, ad‑free browsing
Request Tracker
Enterprise‑grade ticketing and issue tracking
Traduora
Open-source translation management for teams
Webtor
Instant torrent streaming and direct downloads in one app
File Browser
Self-hosted file manager for your server