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

  1. Entry point – HTTP requests hit Laravel’s front controller (public/index.php, not listed but standard). Routes are defined in routes/api.php and point to controllers such as BackupJobController.
  2. Controller → Request → Service – BackupJobController::store() uses SaveBackupScheduleRequest for validation, then calls BackupJob::create() (model in app/Models/BackupJob.php).
  3. Job dispatch – The controller queues ProcessBackupJob (app/Jobs/ProcessBackupJob.php). Laravel’s queue worker (started by php artisan queue:work inside the Docker image) picks it up.
  4. Backup pipeline – ProcessBackupJob::handle() invokes AgentRunCommand (via Symfony\Component\Process) to spin up the local dump tool, streams output through CompressionType (gzip/zstd/AES‑256), and writes the file to a Volume implementation (app/Livewire/Volume/Connectors/S3Config.php, etc.).
  5. Storage & Metadata – After upload, BackupJob record is updated, a Snapshot model (app/Models/Snapshot.php) is created, and a BackupLogger implementation logs progress to the DB (app/Contracts/BackupLogger.php).
  6. Restore path – SnapshotController::restore() triggers ProcessRestoreJob which 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 .env is tracked; if populated with real secrets it would expose credentials.
  • No explicit license file in the root (only LICENSE placeholder); 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.