dbdock
v1.2.3
Published
Enterprise-grade database backup, restore, and cross-database migration (MongoDB ↔ PostgreSQL). CLI-first tool with encryption, compression, and multi-cloud storage.
Maintainers
Readme
DBdock
The open-source database CLI for PostgreSQL backups, restores, database copies, and cross-database migrations between MongoDB and PostgreSQL — with encryption, compression, and multi-cloud storage built in.
Documentation ・ Discussions ・ Report a Bug
Stop writing backup scripts. Stop maintaining migration code. One CLI, one command.
npx dbdock init # One-time setup
npx dbdock backup # Backup with encryption + compression
npx dbdock restore # Interactive restore
npx dbdock copydb "src_url" "dst_url" # Copy a database, zero config
npx dbdock migrate "mongo_url" "postgres_url" # Cross-database migrationInstall
With npx (no install):
npx dbdock --helpGlobal install:
npm install -g dbdockPrerequisites: Node.js 18+ and PostgreSQL client tools (pg_dump, pg_restore, psql).
# macOS
brew install postgresql
# Ubuntu/Debian
sudo apt-get install postgresql-client
# Windows
# Download from https://www.postgresql.org/download/windows/Features
- Beautiful CLI — real-time progress bars, speed tracking, smart filtering
- Multiple storage — local disk, AWS S3, Cloudflare R2, Cloudinary
- Security-first — AES-256-GCM encryption, env-var secrets, credential masking,
.pgpasssupport - Retention policies — auto-cleanup by count/age with a safety net
- Alerts — email (SMTP) and Slack for backup success and failure
- Cron schedules — automated backups
- Cross-database — MongoDB ↔ PostgreSQL with schema mapping and dry runs
- TypeScript SDK — use DBdock programmatically in any Node.js app
Quick start
npx dbdock init # Interactive setup (30 seconds)
npx dbdock test # Validate connections
npx dbdock backup # Create your first backup
npx dbdock restore # Interactive restoreSee the Quickstart guide for a full walkthrough.
Commands at a glance
| Command | Purpose |
|---|---|
| init | Interactive setup wizard |
| backup | Create a backup |
| restore | Restore a backup (with filtering) |
| copydb | Copy a database between two URLs |
| list | List backups |
| delete | Delete specific or all backups |
| cleanup | Apply retention policy |
| schedule | Manage cron schedules |
| status | View schedules and service health |
| test | Validate configuration |
| analyze | Inspect a database structure |
| migrate | Cross-database migration |
| migrate-config | Move legacy secrets to env vars |
Full reference at docs.dbdock.xyz/cli/overview.
Cross-database migration
MongoDB → PostgreSQL or PostgreSQL → MongoDB with automatic schema mapping, dry runs, and incremental sync.
npx dbdock analyze "mongodb://localhost:27017/myapp" # Inspect first
npx dbdock migrate "mongo_url" "postgres_url" --dry-run # Validate
npx dbdock migrate "mongo_url" "postgres_url" # Run itSee docs.dbdock.xyz/migration.
Storage providers
DBdock writes backups to your storage of choice:
- Local disk — fastest, single server
- AWS S3 — industry standard, any S3-compatible service
- Cloudflare R2 — zero egress fees
- Cloudinary — generous free tier
Swap providers by changing one line in dbdock.config.json.
Programmatic usage
const { createDBDock, BackupService } = require('dbdock');
const dbdock = await createDBDock();
const backups = dbdock.get(BackupService);
const result = await backups.createBackup({
compress: true,
encrypt: true,
});
console.log(`Backup ${result.metadata.id} — ${result.metadata.formattedSize}`);Full SDK reference at docs.dbdock.xyz/sdk.
Security
- Secrets live in environment variables, never in
dbdock.config.json - AES-256-GCM encryption with PBKDF2 key derivation
- Credential masking in logs
.pgpasssupport for host-level credential isolation- Strict mode (
DBDOCK_STRICT_MODE=true) refuses any config file that contains secrets
See docs.dbdock.xyz/core/security and SECURITY.md for vulnerability reporting.
Contributing
Contributions welcome! See CONTRIBUTING.md for development setup and guidelines.
Contributors
Thanks to everyone who has contributed to DBdock:
Created and maintained by Naheem Olaide.
License
MIT — free forever, self-hosted, no vendor lock-in.
