LazyBackup is a self-hosted web app for From → To backups between endpoints: this host (local), any configured Server, S3-compatible storage, a Bro Space peer, or a Git remote (source only). Connect over SSH, schedule jobs with cron, and transfer filesystem paths, Docker volumes, logical database dumps, Git bare mirrors, or the LazyBackup instance itself — including server→server (ephemeral direct or relay) and landings on S3 or a friend's disk.
Why not just rsync/cron? UI, schedules, retention, restore, and encryption without a pile of scripts — lazy.zic.ar/compare.
- Bun 1.4+ (the Docker image and CI pin 1.4.4). The Next.js process can also run on Node 20+, but
bunmust be onPATH: the SQLite snapshot helper shells out to it, andbun run db:migrateis Bun-only. - SSH access to your servers.
- SSH key authentication on each server endpoint used in a backup transfer (rsync/scp run from the LazyBackup host and need a key). Password auth still works for Test connection and other
node-sshoperations (list volumes/containers, etc.). rsync,openssh-client, andgiton the host running LazyBackup (Git repository sources clone a bare mirror on this host).- Not in the official image: the Docker CLI and
pg_dump/mysqldump. Local Docker-volume packing and local database dumps need an SSH server source, or a custom image with those tools. The image shipsrsync,ssh,git,curland SQLite.
docker run -d \
--name lazybackup \
--restart unless-stopped \
-p 3000:3000 \
-v lazybackup_data:/app/data \
-v ./backups:/backups \
-v ~/.ssh:/root/.ssh:ro \
-e DATABASE_URL=file:/app/data/data.db \
-e BACKUP_STORAGE_PATH=/backups \
ghcr.io/ceneka/lazybackup:latest
The image is multi-arch (linux/amd64 and linux/arm64). :latest moves on every v* release;
pin ghcr.io/ceneka/lazybackup:v0.4.3 if you prefer reproducible upgrades.
Or with Docker Compose (pulls the image, persists the database volume). No .env is required —
defaults are port 3000 and ./backups on the host.
docker compose up -d
.env and Compose: Compose uses .env only for interpolation — PORT,
BACKUP_STORAGE_PATH and SSH_KEYS_PATH change the published port and the bind mounts. Other
variables (AUTH_COOKIE_SECURE, ENABLE_HSTS, AUTH_TRUST_PROXY, AUTH_PUBLIC_URL,
ALLOW_*, …) are commented in the compose environment: block: uncomment them there, or add an
env_file: .env, for them to reach the container. DATABASE_URL is fixed to
file:/app/data/data.db by Compose.
To build a local image instead of pulling GHCR:
docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build
Open http://localhost:3000 (or http://<lan-ip>:3000 on your network).
HTTP vs HTTPS: On plain HTTP (typical LAN), leave
AUTH_COOKIE_SECUREunset so the app password session cookie works. SetAUTH_COOKIE_SECURE=trueonly when the UI is served over HTTPS.
Do these before the instance is reachable from anything you do not trust:
- Close the door first. Compose publishes port 3000 on all interfaces and a fresh instance has no password until you set one. Bind loopback only (
-p 127.0.0.1:3000:3000) or firewall the port before the first start, then add an app password and/or a passkey in Settings → General. - Mount only the SSH keys backups need. Point
SSH_KEYS_PATHat a dedicated directory (e.g../lazybackup-ssh) instead of~/.ssh; the container can read every key in that directory. - The Docker socket is root-equivalent. Only mount
/var/run/docker.sockif you run a custom image that also contains the Docker CLI; treat such an instance as having host root. The official image has no Docker CLI, so local Docker-volume packing and localdocker execdumps need an SSH server source or a custom image. - HTTPS settings only behind HTTPS. Set
AUTH_COOKIE_SECURE=trueandENABLE_HSTS=trueonly when every request is HTTPS (HSTS is usually better at the reverse proxy). On plain HTTP they break login or pin browsers to a broken origin. - Proxy trust is opt-in. Set
AUTH_TRUST_PROXY=trueonly behind a proxy that overwritesX-Forwarded-Host/X-Forwarded-Proto/X-Forwarded-For, and setAUTH_PUBLIC_URL=https://backup.example.comso passkeys use the right origin. - Never echo secrets in pre-backup commands. Their output is stored in the run's history log (readable from History and by
remote_execAPI tokens). Use credentials already stored in the app instead. - Bro Space through a tunnel. Mailbox transfers move in 4 MiB chunks, so proxy request-body caps are not the limit; very large pulls and downloads still depend on the proxy's response limits and timeouts. Keep Bro Space on Tailscale/LAN for big datasets. Public peer URLs must be
https://; plainhttp://is accepted only for Tailscale, or for LAN whenALLOW_PRIVATE_PEER_URLS=true. - Keep the TOFU pins. The SSH
known_hostsfile defaults next toDATABASE_URL(ssh_known_hosts); setLAZYBACKUP_KNOWN_HOSTSto put it on persistent storage.
- Unraid — Community Applications XML:
deploy/unraid/lazybackup.xml(ghcr.io/ceneka/lazybackup:latest, port 3000, data / backups / SSH mounts). - TrueNAS SCALE — Compose:
deploy/truenas/compose.yml(same mounts as the rootdocker-compose.yml). - awesome-sysadmin — ready-to-paste entry:
deploy/awesome-sysadmin.md(awesome-selfhosted's Backup section redirects there; the 12-month first-release rule is met from 2027-08).
git clone https://github.com/Ceneka/lazybackup.git
cd lazybackup
cp .env.example .env # optional
bun install
bun run db:migrate
bun run dev # development
# bun run build && bun run start # production
Set DATABASE_URL if you want a custom SQLite path (default: file:./data.db).
- From → To — Endpoints: this host, SSH servers, S3-compatible storage (MinIO, R2, B2, AWS, …), Bro Space peers, or Git remotes (source only)
- Server → Server — Ephemeral SSH key for direct rsync, or relay via the LazyBackup host when peers can’t reach each other
- Server management — Add, edit, and test VPS connections (password or SSH key auth; keys are parsed on save)
- Backup jobs — Paths, Docker volumes, database dumps, Git bare mirrors, or the LazyBackup instance; 5-field cron schedules (validated on save); exclude patterns; pre-backup shell commands (a command exiting non-zero aborts the run before transferring and creates no recovery point)
- Docker volumes — Discover named volumes on this host or a source server, pack as
.tar.gzto a destination path/prefix, restore from History. A missing volume fails the run instead of producing an empty archive. - Database dumps — Postgres / MySQL / MariaDB →
.sql.gz(native client ordocker exec); SQLite →.sqlite.gz(BunVACUUM INTO,sqlite3 .backup, or a clearly-warnedcpfallback); restore from History - S3 profiles — Source prefixes and destination prefixes for path trees and archives; bucket names and endpoints validated on save
- Git repositories — Connections → Git; clone
--mirrorwith a vault SSH key (or public HTTPS) and land.tar.gzanywhere; unreachable hosts fail in ~20 s - Versioned backups — Optional timestamped snapshots with automatic count-based retention
- File retention — Optional age-based cleanup for dump-style destinations (keep a minimum number of files); mutually exclusive with versioning
- Automated scheduling — In-process cron scheduler; set an app timezone so schedules run when you expect
- History & dashboard — Track runs, view logs, next run times, storage usage, and success rates; run logs keep the last 512 KiB (tail + truncation marker)
- Restore — One-click restore of paths, volumes, databases and Git mirrors from History, back to the source or onto another host; artifacts on S3, Bro or an SSH destination are pulled first, and SSH-destination pulls need key auth
- Validate before run — Probe SSH/S3/paths/DB without transferring (backup detail → Validate); last result is stored with a timestamp
- Failure webhooks — Customizable HTTPS webhook on backup failure (method, headers,
{{tag}}body/URL templates; Discord / Telegram / Gotify / Kuma / ntfy / Slack presets) - Success pings — Optional Healthchecks.io / Uptime Kuma-style ping (GET, POST or PUT) when a backup is actually delivered (Bro Space: after your friend confirms it stored it)
- Optional app password — Single-operator lock (set on first run or later in Settings); session cookie lasts 30 days
- MCP / API tokens — Let Cursor, Claude, or other agents manage backups via Streamable HTTP MCP at
/mcp(Settings → API) - Encryption — Age vault (active / retired / compromised keys), recovery recipients, passphrase-wrapped export (Settings → Encrypt); works with local, server, and S3 destinations
- Instance backup — Back up LazyBackup itself (SQLite + age vault + SSH key rows) as a schedulable job; a passphrase is required for any non-local destination
- Passkeys — WebAuthn login alongside or instead of the app password (Settings → General)
- Bro Space — Share encrypted backup space with a friend (Settings → Bro). Invite them to install LazyBro, or pair with another LazyBackup.
- Update check — Settings shows the running version and whether a newer GitHub release exists
Docs: Features · Compare · Changelog · CONTRIBUTING · SECURITY · CHANGELOG · static site landing/
- Frontend: Next.js 15, React 19, Tailwind CSS, shadcn/ui
- Backend: Next.js API routes
- Database: SQLite (libSQL) with Drizzle ORM
- Transfer: rsync (preferred) with scp fallback; S3 via AWS SDK
- Runtime: Bun (image and CI); the Next process also runs on Node 20+ with
bunonPATH
Back up the SQLite file first (data.db plus any -wal/-shm), then pull the new image:
docker compose pull && docker compose up -d # or: docker pull ghcr.io/ceneka/lazybackup:vX.Y.Z
Migrations run automatically at startup; there is no manual migration step. Behavior changes worth knowing when coming from 0.3.x:
- API body + CSRF: cookie-authenticated mutations must be same-origin and send
Content-Type: application/json; Bearer tokens are exempt from CSRF. - Tokens:
read_onlytokens lost the ad-hoc probe endpoints (POST /api/servers/test, …); a token can only be created while the instance is locked (password or passkey). - Restores require
confirm, and retargeting requiresallowRetarget. - Run logs are capped at 512 KiB (the tail is kept, with a truncation marker).
- Invalid cron expressions are rejected when a backup is saved.
- Partial config edits keep the fields you did not send (omitted = keep,
null= clear). - Bro Space: public peer URLs must be
https://. - Unknown
/api/*paths return JSON404; unsupported methods on static API paths return JSON405+Allow(dynamic routes keep Next's empty 405).
- Optional password — On first visit, set an app password or skip. Skipping leaves the dashboard and API open to anyone who can reach the address (the app warns before you skip); set or change it later under Settings → General. Passkeys also live there — the first passkey needs an existing password (or passkey) lock, then the password can be removed.
- Add a server — Connections → Servers → add host, user, and SSH credentials. Use Test connection to verify rsync/scp (and Docker) availability. Prefer an SSH key for any server you will back up from or to.
- (Optional) S3 profile — Connections → S3 → endpoint, bucket, and keys (path-style for MinIO/R2/B2 as needed).
- (Optional) Git repository — Connections → Git → remote URL and an SSH key from Settings for private remotes. Backups clone a bare mirror on this host and store
.tar.gzat the destination. - Create a backup — Backups → pick From and To (local, server, S3, Bro peer; Git as source), then filesystem path, Docker volume, database, Git repository, or LazyBackup instance. Default dest is
/backups/<server>/<name>on this host when To is local (Git sources suggest/backups/git/<repo>). Optionally enable versioning or age-based file retention (mutually exclusive). - Timezone — Settings → General → choose the timezone used for cron schedules and “next run” times.
- Encryption (optional) — Settings → Encrypt → generate an age key (export and acknowledge a copy), optionally add recovery recipients, then enable “Encrypt before storing” on a backup (or use a Bro destination). Create new keys instead of overwriting; old keys stay for decrypt.
- Backup this instance — Settings → Encrypt → “Backup LazyBackup data”, or New Backup → local source → LazyBackup instance data. The archive holds SQLite, the age vault and DB-stored SSH key rows; key files referenced by path are not copied. A passphrase is required for non-local destinations. Restore is manual (replace DB / import keys).
- Passkeys (optional) — Settings → General → Passkeys to register; use “Sign in with passkey” on
/login. - Bro Space (optional) — Settings → Bro → save your address, create an invite, and send it to your friend. They install LazyBro and paste the invite (or Accept below if they also run LazyBackup).
- Run or schedule — Trigger a manual run or rely on the cron schedule. View results, logs, and storage under History and each backup’s detail page.
- Restore — On a successful path, volume, database, or Git backup in History, restore back to the source (local path, SSH path, S3 prefix, named volume, DB, or a directory for the Git mirror), or onto a different host (History server picker). Artifacts on S3, Bro, or an SSH destination (key auth) are pulled onto this host first. Password-only SSH destinations cannot pull for restore. Download the artifact from History without restoring in place.
See bro/README.md. Your friend installs LazyBro, pastes your invite, picks a folder, and leaves it running. If they’re offline for a bit, that’s fine — backups still succeed and catch up later.
If friends can’t reach your LazyBackup from outside your network, Tailscale on your host is a common fix. LazyBackup does not ship Tailscale in the image (~50MB+). Use one of:
- Host Tailscale (keeps LAN
:3000) — install Tailscale on the machine, uncomment the/var/run/tailscalevolume indocker-compose.yml, open Settings → Bro → Use this address. - Compose overlay — create an auth key, set
TS_AUTHKEYin.env, then:
docker compose -f docker-compose.yml -f docker-compose.tailscale.yml up -d
The app shares the Tailscale network namespace (http://100.x.x.x:3000). Host port publish is disabled in that mode.
Connect Cursor, Claude, VS Code, or other MCP clients to this instance:
- Lock the instance with an app password or passkey. Tokens cannot be minted on an unprotected instance.
- Open Settings → API, create a token, and copy it immediately (shown once). Creating a token requires a fresh step-up — your current password or a passkey check.
- Use Add to Cursor / Add to VS Code, or copy
mcp.json/ Claude config / Claude Code CLI.
Example mcp.json (replace host and token):
{
"mcpServers": {
"lazybackup": {
"url": "https://your-host/mcp",
"headers": {
"Authorization": "Bearer lb_…"
}
}
}
}
Tokens can manage backups and servers. Remote shell (exec_command / POST /api/servers/:id/exec) and setting or changing pre-backup commands require the opt-in Allow remote command execution permission (browser sessions always have it). Prefer HTTPS or a trusted LAN. Revoke tokens anytime from the same Settings tab. Destructive MCP tools (delete_*, restore_history, exec_command) require confirm: true.
An authorize_keys token may add/remove its own OpenSSH public key in a server's
~/.ssh/authorized_keys (POST|DELETE /api/servers/:id/authorize-key). It can be combined with
read_only and is implied by remote_exec; treat it as shell-level access to that server.
Each call is audited with the key fingerprint.
A read_only token can list/inspect, run validate_backup, and test endpoints that are already stored (by id). It cannot create/run/delete backups, cannot call ad-hoc probe endpoints that accept a caller-supplied host or URL (POST /api/servers/test, /api/s3-profiles/test, /api/git-repos/test, /api/backups/database/test, MCP test_database) — those would otherwise be usable for SSRF / port scanning. Registering a new passkey also requires a fresh password/passkey check.
Under Settings → General, configure a failure webhook:
- Method —
GET,POST, orPUT - URL / headers / body — support
{{tags}}({{event}},{{backupName}},{{configId}},{{historyId}},{{errorMessage}},{{endedAt}}) - Presets — Default JSON, Discord, Telegram, Gotify, Uptime Kuma (push), ntfy, Slack
Empty body (POST/PUT) sends the built-in JSON:
{
"event": "backup.failed",
"backupName": "Daily DB",
"configId": "…",
"historyId": "…",
"errorMessage": "…",
"endedAt": "2026-08-10T12:00:00.000Z"
}
HTTPS is required (http:// only for localhost/LAN). Empty URL disables notifications. Use Send test notification to verify.
Also under Settings → General, optionally configure a success ping (Healthchecks.io / Uptime Kuma style):
- Defaults to GET (paste your check’s ping URL);
POSTandPUTare accepted - Same URL rules and optional
{{tags}}({{event}},{{backupName}},{{configId}},{{historyId}},{{endedAt}}) - Presets — Healthchecks.io, Uptime Kuma (up), Gotify, Default JSON (POST)
- Empty URL disables pings; failures never fail the backup (fire-and-forget)
- For Bro Space destinations, the ping is deferred until the friend's LazyBro confirms it stored the backup (verified ACK). A backup that is only staged is
waiting, not delivered; an offline friend is soft status, never a failure webhook. - Use Send test ping to verify
POST/PUT with an empty body sends {"event":"backup.succeeded",…}.
GET responses for servers, S3 profiles, and backups never include passwords, SSH private keys, S3 secret keys, or DB passwords. SSH key responses never include the PEM (hasPrivateKeyContent is a flag only). Bearer/MCP callers get a masked S3 accessKeyId (cookie sessions keep it for the edit form). Flags such as hasPassword / hasPrivateKey / hasSecretAccessKey / hasDbPassword tell the UI a secret is stored. On edit, leave those fields blank to keep the existing value.
GET /api/settings/export is advertised as non-secret: it drops auth/age secrets, masks webhook headers, and reduces webhook/success-ping URLs to scheme + host (their paths/queries often contain bot tokens or check UUIDs) and bodies to ***.
Settings writes use POST /api/settings (GET lists current values with secrets stripped; DELETE
removes a key). GET /api/backups/:id exposes the last validate result as
lastValidation: { ok, at, checks }, not flat lastValidatedAt fields. Schedules are validated as
5-field cron expressions on create/update.
Unknown /api/* paths return JSON 404 { error }. Unsupported methods on static API paths return
405 { error } with an Allow header, and OPTIONS returns 204 + Allow; routes with dynamic
segments keep Next.js's default empty 405.
Cookie-authenticated mutations are same-origin only. The server rejects POST/PUT/PATCH/DELETE when the browser says Sec-Fetch-Site is cross-site/same-site, or (without that header) when an Origin host does not match the host the instance is served on (AUTH_PUBLIC_URL, then X-Forwarded-Host when AUTH_TRUST_PROXY=true, then Host). Bearer API tokens are exempt because they are not ambient credentials. API mutations that carry a body must use Content-Type: application/json (bodyless calls such as POST /api/backups/:id/run are unaffected).
- Volume sources are a source server (SSH) or this host. The official image does not include the Docker CLI, so local volume packing needs a custom image (or use an SSH server source). Mounting
/var/run/docker.sockalone is not enough. - If you do run local Docker (custom image), the Docker user needs permission to run
docker(typically membership in thedockergroup, or the socket mount — root-equivalent on the daemon). - Packing uses a temporary
alpinehelper container; the host must be able to pull/run that image. The volume is inspected first, so a typo fails the run instead of backing up an auto-created empty volume. - Live database volumes can be inconsistent if written during backup — prefer the database source type for logical dumps, or stop the service first via pre-backup commands when you need a consistent filesystem snapshot.
| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
file:./data.db |
SQLite database location (file:/app/data/data.db in Docker) |
PORT |
3000 |
HTTP port (Compose interpolation) |
BACKUP_STORAGE_PATH |
./backups |
Host directory for backup files (Compose mounts this at /backups and /app/backups) |
SSH_KEYS_PATH |
~/.ssh |
System SSH keys (Docker mount, read-only) |
AUTH_SECRET |
(auto in settings) | HMAC secret for session cookies; auto-generated in SQLite if unset |
AUTH_COOKIE_SECURE |
unset (false) |
Set true only behind HTTPS; Secure cookies are dropped on plain HTTP |
ENABLE_HSTS |
unset (false) |
Set true only when every request is HTTPS; prefer HSTS on the reverse proxy. Leave unset for HTTP/LAN. |
AUTH_TRUST_PROXY |
unset (false) |
Trust X-Forwarded-Host / X-Forwarded-Proto / X-Forwarded-For for WebAuthn RP ID and login backoff. Set true only behind a reverse proxy that overwrites these headers. |
AUTH_PUBLIC_URL |
unset | Public origin for WebAuthn (overrides Host / forwarded headers), e.g. https://backup.example.com |
ALLOW_ARBITRARY_LOCAL_PATHS |
unset (false) |
Allow local backup destinations outside BACKUP_STORAGE_PATH. Default denies paths outside the storage root. |
ALLOW_PRIVATE_S3_ENDPOINTS |
unset (false) |
Allow S3-compatible endpoints on loopback/private IPs (LAN MinIO). Default denies loopback, RFC1918, link-local, and cloud metadata addresses. |
ALLOW_PRIVATE_PEER_URLS |
unset (false) |
Allow Bro Space pairing/sync to RFC1918 and loopback URLs. Default allows https:// anywhere and http:// only for Tailscale (public http:// is rejected). IMDS/link-local are always blocked. |
ALLOW_LAN_WEBHOOKS |
unset (true) |
Allow HTTP webhooks/pings to localhost and RFC1918 (LAN ntfy/Kuma). IMDS/link-local are always blocked. Set false for public HTTPS only. |
LAZYBACKUP_KNOWN_HOSTS |
next to DATABASE_URL |
SSH TOFU known_hosts file path (ssh_known_hosts in the data directory by default). |
BUN_BINARY |
first bun on PATH |
Bun executable used for SQLite snapshots when the app runs under Node. |
PEER_LOCK_QUEUE_MAX |
8 |
Per-peer concurrent transfer slots; extra waiters get 429. |
TS_AUTHKEY / TS_HOSTNAME |
unset | Only for docker-compose.tailscale.yml (sidecar auth key / hostname). |
See .env.example for a copy-paste template.
bun run dev # Start dev server
bun run lint # ESLint
bun test --isolate # Unit tests (CI mode; --isolate avoids process-wide Bun mocks)
bun run test:docker # Alpine unit tests + production image smoke (musl / GHCR parity)
test:docker builds the Alpine image, runs bun test inside it, then starts the production image and hits /api/health (migrations + @libsql natives). Use this when changing Docker/native deps so host bun run dev success doesn’t hide Alpine failures.
See AGENTS.md for architecture details aimed at contributors and AI agents.
MIT — see LICENSE. Anyone may use, modify, and redistribute LazyBackup.


