Everything the CLI does, you can do from code. DBdock exports a small NestJS-based module that works with any Node.js backend — you don’t need to understand NestJS to use it.Documentation Index
Fetch the complete documentation index at: https://docs.dbdock.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Install
The one pattern to learn
await createDBDock()— initializes DBdock (readsdbdock.config.jsonand env vars)dbdock.get(ServiceClass)— fetches the service you need- Call methods on the service
Available services
BackupService
Create backups, list backups, get metadata.
StorageService
Direct access to the storage adapter (advanced).
CryptoService
Encrypt/decrypt arbitrary data (advanced).
AlertService
Send notifications programmatically.
TypeScript support
DBdock ships full type definitions. In TypeScript:Configuration
The SDK reads from the same sources as the CLI:dbdock.config.json(path controlled byDBDOCK_CONFIG_PATH)- Environment variables (
.envand.env.local) - Environment-only if no config file exists
Lifecycle
createDBDock() returns a context. Internally it holds connections and caches. If you’re running a long-lived process, create it once and reuse it:
What’s supported programmatically
| Operation | CLI | SDK |
|---|---|---|
| Create backup | ✅ | ✅ |
| List backups | ✅ | ✅ |
| Get backup metadata | ✅ | ✅ |
| Delete backup | ✅ | ❌ (CLI only for now) |
| Restore backup | ✅ | ❌ (CLI only for now) |
| Cleanup (retention) | ✅ | ✅ |
| Send alerts | ✅ | ✅ |
| Cross-DB migration | ✅ | ❌ (CLI only) |
| copydb | ✅ | ❌ (CLI only) |
See also
Creating backups
Full API for
BackupService.createBackup().Listing backups
Query the backup history.
Scheduling
Build a scheduler with
node-cron.Alerts
Use the alert system from code.

