The Problem
Enterprises that run many heterogeneous databases need a single, auditable place to schedule dumps, store them off‑site, and restore on demand. Doing this manually (cron + scp + ad‑hoc scripts) is error‑prone, hard to monitor, and provides no role‑based access control.
What This Does
databasement is a Laravel + React application that centralises backup/restore orchestration for MySQL, PostgreSQL, MariaDB, MSSQL, MongoDB, SQLite, Firebird and Redis. The backend lives under app/ – e.g. app/Http/Controllers/Api/V1/BackupJobController.php receives API calls, validates them with request classes such as SaveBackupScheduleRequest.php, and dispatches Laravel jobs (ProcessBackupJob.php). The frontend entry point is resources/js/app.js, compiled by the bundled Vite/React stack.
Storage back‑ends are abstracted in the app/Livewire/Volume components (S3, SFTP, Azure, SMB, local). Compression/encryption choices are defined in app/Enums/CompressionType.php and applied in the dump pipeline inside app/Actions/Fortify/* and the agent command app/Console/Commands/AgentRunCommand.php. The optional remote agent runs as a lightweight Go/Node process (not in this PHP tree) and pushes dumps to the server via HTTPS.
How It Is Wired
- Entry point – HTTP requests hit Laravel’s front controller (
public/index.php, not listed but standard). Routes are defined inroutes/api.phpand point to controllers such asBackupJobController. - Controller → Request → Service –
BackupJobController::store()usesSaveBackupScheduleRequestfor validation, then callsBackupJob::create()(model inapp/Models/BackupJob.php). - Job dispatch – The controller queues
ProcessBackupJob(app/Jobs/ProcessBackupJob.php). Laravel’s queue worker (started byphp artisan queue:workinside the Docker image) picks it up. - Backup pipeline –
ProcessBackupJob::handle()invokesAgentRunCommand(viaSymfony\Component\Process) to spin up the local dump tool, streams output throughCompressionType(gzip/zstd/AES‑256), and writes the file to aVolumeimplementation (app/Livewire/Volume/Connectors/S3Config.php, etc.). - Storage & Metadata – After upload,
BackupJobrecord is updated, aSnapshotmodel (app/Models/Snapshot.php) is created, and aBackupLoggerimplementation logs progress to the DB (app/Contracts/BackupLogger.php). - Restore path –
SnapshotController::restore()triggersProcessRestoreJobwhich pulls the snapshot from the chosen volume, runs the appropriate DB client (mysqldump,pg_dump, etc.), and streams data back into the target server, optionally via SSH tunnel (app/Exceptions/SshTunnelException.php).
The most critical hub is the Laravel queue worker: any change to ProcessBackupJob or its downstream helpers can affect all backup schedules. The volume connectors are isolated – swapping S3 for SFTP only touches the corresponding *Config.php class.
How To Use It
# Clone the repo
git clone https://github.com/moses-y/databasement.git
cd databasement
# Copy example env and edit required keys (DB_HOST, S3_ACCESS_KEY, etc.)
cp .env.example .env
# Edit .env – see docs/self-hosting/docker-compose.md for required vars
# Build and start containers
docker compose up -d --build
# Run migrations and seed default data
docker exec -it databasement-php php artisan migrate --seed
# Access UI
open http://localhost:8000
The Dockerfile builds a PHP 8.2 image with Composer dependencies (composer.json). docker-compose.yml defines three services: php (Laravel app + queue worker), nginx (static assets), and db (MariaDB for the app’s own metadata). The Makefile offers shortcuts such as make test (runs PHPUnit in tests/).
Real‑World Use
A SaaS provider can deploy databasement behind its internal network, register each customer’s MySQL instance via the UI, set a daily 03:00 UTC schedule, and choose S3‑compatible storage in a separate AWS account. The provider’s CI pipeline can call the REST endpoint (POST /api/v1/backup-jobs) to trigger ad‑hoc backups before a major release.
Code Health & Issues
- Low – .env file present – a template
.envis tracked; if populated with real secrets it would expose credentials. - No explicit license file in the root (only
LICENSEplaceholder); legal compliance may need confirmation. - Test suite exists (
tests/), but CI workflow (.github/workflows/tests.yml) does not enforce coverage thresholds.
No static analysis warnings beyond the above were reported.
The Bottom Line
databasement delivers a full‑stack, Docker‑ready backup manager with a clean Laravel/React separation and extensible storage plugins. It is production‑ready for teams comfortable with Laravel queues and Docker, but the presence of a tracked .env and missing licence details require careful handling before public deployment. Suitable for organisations that need multi‑DB scheduling, role‑based UI, and API‑driven automation.