Registry / database / dbdock

dbdock

JSON →
library1.1.26jsnpmunverified

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 dbdock
INSTALL
IMPORT
SIG · DBDOCK
D
dbdock
databasejavascriptv1.1.26
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createDBDock
import { createDBDock } from 'dbdock';
const { createDBDock } = require('dbdock');
Used to initialize the DBDock context for programmatic access, reading configuration from `dbdock.config.json` and environment variables. ESM import is preferred.
BackupService
import { BackupService } from 'dbdock';
const { BackupService } = require('dbdock');
Acquired from the initialized DBDock context (e.g., `dbdockContext.get(BackupService)`), this service provides methods for managing backups programmatically. Requires `createDBDock` first.
dbdock (CLI)
npx dbdock <command>
import { dbdock } from 'dbdock'; // This package is primarily a CLI tool; 'dbdock' is not a direct JavaScript function export.
The primary and recommended method of interaction for most users is via the command-line interface using `npx` or a global `npm install -g dbdock`.

Demonstrates the initial setup process and fundamental backup/restore operations using the CLI.

npx dbdock init # Follow the interactive prompts to set up database connection, storage, encryption, and alerts. # This creates dbdock.config.json (non-sensitive) and .env (secrets). # Create a full backup with encryption and compression, streaming directly to configured storage. # Real-time progress is shown in the terminal. npx dbdock backup # Restore a backup interactively, with smart filtering for many backups. npx dbdock restore
dbdock --version
Debug
Known issues
gotchaDBDock requires Node.js 18 or higher and specific PostgreSQL client tools (`pg_dump`, `pg_restore`, `psql`) to be installed on the system path. Failure to meet these prerequisites will result in runtime errors for database operations.
fix
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.
affects: >=1.0.0
gotchaConfiguration management uses a hybrid approach: non-sensitive settings go into `dbdock.config.json` (safe to commit), while sensitive secrets (e.g., database URLs, API keys) are stored in `.env` files (must be `.gitignore`d). Mismanaging these can expose credentials.
fix
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`.
affects: >=1.0.0
gotchaScheduled backups managed via `dbdock schedule` only execute when DBDock is integrated and running within a Node.js application. The CLI commands merely configure the schedule, but do not actively run the cron jobs themselves.
fix
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.
affects: >=1.0.0
deprecatedOlder versions might have stored sensitive secrets directly in `dbdock.config.json`. This is deprecated due to security risks.
fix
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.
affects: <1.1.0 (approx)
Errors
Common errors & fixes
command not found: dbdock
The `dbdock` command is not available in the system's PATH or `npx` is not being used.
fix
Either install DBDock globally (`npm install -g dbdock`) or use `npx` to execute commands (`npx dbdock <command>`).
Error: pg_dump: command not found
The PostgreSQL client tools (specifically `pg_dump`, `pg_restore`, `psql`) are not installed or not accessible in the system's PATH.
fix
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).
Error: Missing required environment variable: DBDOCK_DB_URL
DBDock requires a database connection URL, typically provided via `DBDOCK_DB_URL` or `DATABASE_URL` environment variables, or configured interactively via `dbdock init`.
fix
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.
Upgrade
Version history
1.1.26latest on npm
Audit
Dependencies
@nestjs/commonoptionalPeer dependency for programmatic integration, especially within NestJS applications.
@nestjs/coreoptionalPeer dependency for programmatic integration, especially within NestJS applications.
Agent activity
22 hits · last 30 days
node
19
OpenAI (training)
1
Resources
dbdock — npm install dbdock · libregistry