# david-crty/databasement architecture

> Architecture diagram of the GitHub repository david-crty/databasement, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/david-crty/databasement
- Repository: https://github.com/david-crty/databasement

## Overview

Databasement is a self-hosted database-backup management application. Users configure database servers and storage, then trigger or schedule backups; the system runs database-specific dumps, stores snapshots, monitors jobs, and can restore snapshots to compatible servers. The README documents remote agents, scheduling, integrations, and automation; source-index references support the key model and query relationships. Several implementation details were not sampled, so those links are limited to documented product flows.

Main entry points: [`app/Jobs/ProcessBackupJob.php`](https://github.com/david-crty/databasement/blob/main/app/Jobs/ProcessBackupJob.php) (Backup jobs), [`app/Livewire`](https://github.com/david-crty/databasement/tree/main/app/Livewire) (Web interface), [`app/Services/Backup/BackupTask.php`](https://github.com/david-crty/databasement/blob/main/app/Services/Backup/BackupTask.php) (Database dump engine), [`app/Models/Snapshot.php`](https://github.com/david-crty/databasement/blob/main/app/Models/Snapshot.php) (Snapshots)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_management["User management"]
  node_web["Web interface"]
  node_api["REST API"]
  node_mcp["MCP tools"]
  node_server[("Database servers<br/>[DatabaseServer.php]")]
  node_ssh[("SSH configuration")]
  node_oauth["OAuth login<br/>[OAuthService.php]"]
  node_dashboard["Monitoring dashboard<br/>[Dashboard.php]"]
end

subgraph group_backup["Backup operations"]
  node_backup_config[("Backup configuration<br/>[Backup.php]")]
  node_schedule[("Backup schedules<br/>[BackupSchedule.php]")]
  node_scheduler["Schedule dispatcher<br/>[app.php]"]
  node_backup_job["Backup jobs"]
  node_backup_engine["Database dump engine<br/>[BackupTask.php]"]
  node_database_drivers["Database drivers"]
  node_compression["Compression"]
  node_snapshot[("Snapshots<br/>[Snapshot.php]")]
end

subgraph group_restore["Restore operations"]
  node_restore["Restore workflow<br/>[RestoreTask.php]"]
  node_restore_job["Restore jobs"]
end

subgraph group_agent["Agent execution"]
  node_agent["Remote agent<br/>[AgentJobRunner.php]"]
  node_agent_api["Agent API"]
end

subgraph group_platform["Storage and integrations"]
  node_snapshot_files[("Snapshot files<br/>[SnapshotFile.php]")]
  node_volumes[("Storage volumes<br/>[Volume.php]")]
  node_filesystem["Storage drivers"]
  node_notifications["Job notifications"]
  node_adminer["Adminer browser<br/>[AdminerService.php]"]
end

node_user(("User"))

node_user -->|"manages"| node_web
node_user -->|"automates"| node_api
node_user -->|"automates"| node_mcp
node_web -.->|"configures"| node_server
node_web -.->|"configures"| node_backup_config
node_web -.->|"configures"| node_schedule
node_api -->|"manages"| node_server
node_api -->|"triggers"| node_backup_job
node_mcp -->|"triggers"| node_backup_job
node_schedule -->|"registers"| node_scheduler
node_scheduler -->|"dispatches"| node_backup_job
node_backup_job -->|"dispatches"| node_agent
node_agent -->|"connects outbound"| node_agent_api
node_backup_job -.->|"runs"| node_backup_engine
node_backup_engine -.->|"uses"| node_database_drivers
node_backup_engine -->|"compresses"| node_compression
node_backup_engine -.->|"records"| node_snapshot
node_snapshot -->|"tracks"| node_snapshot_files
node_snapshot_files -->|"stored on"| node_volumes
node_volumes -.->|"uses"| node_filesystem
node_user -->|"requests restore"| node_restore_job
node_restore_job -.->|"runs"| node_restore
node_restore -->|"reads snapshot"| node_snapshot
node_restore -->|"restores to"| node_server
node_backup_job -->|"reports failure"| node_notifications
node_restore_job -->|"reports failure"| node_notifications
node_user -->|"browses data"| node_adminer
node_user -->|"authenticates"| node_oauth
node_user -->|"monitors"| node_dashboard
node_dashboard -->|"summarizes"| node_snapshot

click node_web "https://github.com/david-crty/databasement/tree/main/app/Livewire"
click node_api "https://github.com/david-crty/databasement/tree/main/app/Http/Controllers/Api/V1"
click node_mcp "https://github.com/david-crty/databasement/tree/main/app/Mcp/Tools"
click node_server "https://github.com/david-crty/databasement/blob/main/app/Models/DatabaseServer.php"
click node_ssh "https://github.com/david-crty/databasement/blob/main/app/Models/DatabaseServerSshConfig.php"
click node_backup_config "https://github.com/david-crty/databasement/blob/main/app/Models/Backup.php"
click node_schedule "https://github.com/david-crty/databasement/blob/main/app/Models/BackupSchedule.php"
click node_scheduler "https://github.com/david-crty/databasement/blob/main/bootstrap/app.php"
click node_backup_job "https://github.com/david-crty/databasement/blob/main/app/Jobs/ProcessBackupJob.php"
click node_backup_engine "https://github.com/david-crty/databasement/blob/main/app/Services/Backup/BackupTask.php"
click node_database_drivers "https://github.com/david-crty/databasement/blob/main/app/Services/Backup/Databases/DatabaseProvider.php"
click node_compression "https://github.com/david-crty/databasement/blob/main/app/Services/Backup/Compressors/CompressorFactory.php"
click node_snapshot "https://github.com/david-crty/databasement/blob/main/app/Models/Snapshot.php"
click node_snapshot_files "https://github.com/david-crty/databasement/blob/main/app/Models/SnapshotFile.php"
click node_volumes "https://github.com/david-crty/databasement/blob/main/app/Models/Volume.php"
click node_filesystem "https://github.com/david-crty/databasement/blob/main/app/Services/Backup/Filesystems/FilesystemProvider.php"
click node_agent "https://github.com/david-crty/databasement/blob/main/app/Services/Agent/Runners/AgentJobRunner.php"
click node_agent_api "https://github.com/david-crty/databasement/blob/main/app/Http/Controllers/Api/V1/AgentController.php"
click node_restore "https://github.com/david-crty/databasement/blob/main/app/Services/Backup/RestoreTask.php"
click node_restore_job "https://github.com/david-crty/databasement/blob/main/app/Jobs/ProcessRestoreJob.php"
click node_notifications "https://github.com/david-crty/databasement/blob/main/app/Services/NotificationService.php"
click node_adminer "https://github.com/david-crty/databasement/blob/main/app/Services/AdminerService.php"
click node_oauth "https://github.com/david-crty/databasement/blob/main/app/Services/OAuthService.php"
click node_dashboard "https://github.com/david-crty/databasement/blob/main/app/Livewire/Dashboard.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_api,node_mcp,node_server,node_ssh,node_oauth,node_dashboard,node_user toneBlue
class node_backup_config,node_schedule,node_scheduler,node_backup_job,node_backup_engine,node_database_drivers,node_compression,node_snapshot toneAmber
class node_restore,node_restore_job toneMint
class node_agent,node_agent_api toneRose
class node_snapshot_files,node_volumes,node_filesystem,node_notifications,node_adminer toneIndigo
```

## Components

### User management

- [Web interface](https://github.com/david-crty/databasement/tree/main/app/Livewire): `app/Livewire`
- [REST API](https://github.com/david-crty/databasement/tree/main/app/Http/Controllers/Api/V1): `app/Http/Controllers/Api/V1`
- [MCP tools](https://github.com/david-crty/databasement/tree/main/app/Mcp/Tools): `app/Mcp/Tools`
- [Database servers](https://github.com/david-crty/databasement/blob/main/app/Models/DatabaseServer.php): `app/Models/DatabaseServer.php`
- [SSH configuration](https://github.com/david-crty/databasement/blob/main/app/Models/DatabaseServerSshConfig.php): `app/Models/DatabaseServerSshConfig.php`
- [OAuth login](https://github.com/david-crty/databasement/blob/main/app/Services/OAuthService.php): `app/Services/OAuthService.php`
- [Monitoring dashboard](https://github.com/david-crty/databasement/blob/main/app/Livewire/Dashboard.php): `app/Livewire/Dashboard.php`

### Backup operations

- [Backup configuration](https://github.com/david-crty/databasement/blob/main/app/Models/Backup.php): `app/Models/Backup.php`
- [Backup schedules](https://github.com/david-crty/databasement/blob/main/app/Models/BackupSchedule.php): `app/Models/BackupSchedule.php`
- [Schedule dispatcher](https://github.com/david-crty/databasement/blob/main/bootstrap/app.php): `bootstrap/app.php`
- [Backup jobs](https://github.com/david-crty/databasement/blob/main/app/Jobs/ProcessBackupJob.php): `app/Jobs/ProcessBackupJob.php`
- [Database dump engine](https://github.com/david-crty/databasement/blob/main/app/Services/Backup/BackupTask.php): `app/Services/Backup/BackupTask.php`
- [Database drivers](https://github.com/david-crty/databasement/blob/main/app/Services/Backup/Databases/DatabaseProvider.php): `app/Services/Backup/Databases/DatabaseProvider.php`
- [Compression](https://github.com/david-crty/databasement/blob/main/app/Services/Backup/Compressors/CompressorFactory.php): `app/Services/Backup/Compressors/CompressorFactory.php`
- [Snapshots](https://github.com/david-crty/databasement/blob/main/app/Models/Snapshot.php): `app/Models/Snapshot.php`

### Restore operations

- [Restore workflow](https://github.com/david-crty/databasement/blob/main/app/Services/Backup/RestoreTask.php): `app/Services/Backup/RestoreTask.php`
- [Restore jobs](https://github.com/david-crty/databasement/blob/main/app/Jobs/ProcessRestoreJob.php): `app/Jobs/ProcessRestoreJob.php`

### Agent execution

- [Remote agent](https://github.com/david-crty/databasement/blob/main/app/Services/Agent/Runners/AgentJobRunner.php): `app/Services/Agent/Runners/AgentJobRunner.php`
- [Agent API](https://github.com/david-crty/databasement/blob/main/app/Http/Controllers/Api/V1/AgentController.php): `app/Http/Controllers/Api/V1/AgentController.php`

### Storage and integrations

- [Snapshot files](https://github.com/david-crty/databasement/blob/main/app/Models/SnapshotFile.php): `app/Models/SnapshotFile.php`
- [Storage volumes](https://github.com/david-crty/databasement/blob/main/app/Models/Volume.php): `app/Models/Volume.php`
- [Storage drivers](https://github.com/david-crty/databasement/blob/main/app/Services/Backup/Filesystems/FilesystemProvider.php): `app/Services/Backup/Filesystems/FilesystemProvider.php`
- [Job notifications](https://github.com/david-crty/databasement/blob/main/app/Services/NotificationService.php): `app/Services/NotificationService.php`
- [Adminer browser](https://github.com/david-crty/databasement/blob/main/app/Services/AdminerService.php): `app/Services/AdminerService.php`

### Other components

- **User**

## Connections

- User → Web interface: manages (evidence: `README.md`)
- User → REST API: automates (evidence: `README.md`)
- User → MCP tools: automates (evidence: `README.md`)
- Web interface → Database servers: configures
- Web interface → Backup configuration: configures
- Web interface → Backup schedules: configures
- REST API → Database servers: manages (evidence: `README.md`)
- REST API → Backup jobs: triggers (evidence: `README.md`)
- MCP tools → Backup jobs: triggers (evidence: `README.md`)
- Backup schedules → Schedule dispatcher: registers (evidence: `bootstrap/app.php`)
- Schedule dispatcher → Backup jobs: dispatches (evidence: `bootstrap/app.php`)
- Backup jobs → Remote agent: dispatches (evidence: `README.md`)
- Remote agent → Agent API: connects outbound (evidence: `README.md`)
- Backup jobs → Database dump engine: runs
- Database dump engine → Database drivers: uses
- Database dump engine → Compression: compresses (evidence: `README.md`)
- Database dump engine → Snapshots: records
- Snapshots → Snapshot files: tracks (evidence: `app/Models/Snapshot.php`)
- Snapshot files → Storage volumes: stored on (evidence: `app/Models/Volume.php`)
- Storage volumes → Storage drivers: uses
- User → Restore jobs: requests restore (evidence: `README.md`)
- Restore jobs → Restore workflow: runs
- Restore workflow → Snapshots: reads snapshot (evidence: `README.md`)
- Restore workflow → Database servers: restores to (evidence: `README.md`)
- Backup jobs → Job notifications: reports failure (evidence: `README.md`)
- Restore jobs → Job notifications: reports failure (evidence: `README.md`)
- User → Adminer browser: browses data (evidence: `README.md`)
- User → OAuth login: authenticates (evidence: `README.md`)
- User → Monitoring dashboard: monitors (evidence: `README.md`)
- Monitoring dashboard → Snapshots: summarizes (evidence: `app/Livewire/Dashboard/StorageCard.php`)
