DBDock is an enterprise-grade, CLI-first tool designed for comprehensive database operations, including backup, restore, cross-database migration (MongoDB ↔ PostgreSQL), and database copying. Currently at version 1.1.26, it offers a streamlined approach to repetitive database tasks, aiming to replace custom scripts with single commands. Key differentiators include its 'beautiful CLI' with real-time progress, built-in AES-256 encryption, Brotli compression, and support for multiple cloud storage providers like S3, R2, and Cloudinary. It provides interactive setup, intelligent filtering for operations like restore, and features like retention policies and email/Slack alerts. While primarily a command-line utility, DBDock also offers a programmatic TypeScript API, particularly for integration within NestJS applications, leveraging its peer dependencies on `@nestjs/common` and `@nestjs/core`. This allows developers to embed its powerful features directly into their Node.js applications and manage features like cron schedules programmatically.
npm install dbdockVerified import paths — ran on the pinned version, not inferred.
Demonstrates the initial setup process and fundamental backup/restore operations using the CLI.
Ensure Node.js >=18.0.0 is installed. For PostgreSQL client tools, use `brew install postgresql` on macOS or `sudo apt-get install postgresql-client` on Ubuntu/Debian.
Run `npx dbdock init` once for guided setup that automatically handles `.env` and `.gitignore`. Explicitly set `DBDOCK_DB_URL` and other sensitive variables as environment variables, not in `dbdock.config.json`.
For active scheduling, you must integrate DBDock programmatically into a running Node.js application (e.g., a NestJS service) that can manage and trigger the cron tasks based on the configured schedules.
Run `npx dbdock migrate-config` to automatically extract secrets from `dbdock.config.json` to a `.env` file and update your `.gitignore` to prevent committing them.
Either install DBDock globally (`npm install -g dbdock`) or use `npx` to execute commands (`npx dbdock <command>`).
Install the PostgreSQL client tools for your operating system (e.g., `brew install postgresql` on macOS, `sudo apt-get install postgresql-client` on Debian/Ubuntu).
Set the `DBDOCK_DB_URL` environment variable in your shell or a `.env` file, or run `npx dbdock init` to configure your database connection interactively.