Website & Docs: backinghum.vercel.app npm: npmjs.com/package/backinghum ·
v1.0.6
A Node.js command-line tool to create, list, restore, and delete database backups for MongoDB, MySQL, and PostgreSQL. Interactive prompts guide you through every step — no config files required.
npm install -g backinghumThe project has a live website deployed on Vercel:
- Landing page with install instructions
- Full documentation at backinghum.vercel.app/docs
The frontend lives in the frontend/ directory and is built with React + Vite + Tailwind CSS v4.
npm install -g backinghumVerify installation:
backinghum --versionFull documentation is available at backinghum.vercel.app/docs.
Raw markdown docs are also available in this repo:
- Unified CLI interface for backup lifecycle operations.
- Interactive prompts for database-specific connection details.
- Adapter architecture (
BaseAdapter+ per-database adapters) for extensibility. - Backup creation for:
- MongoDB (
mongodump) - MySQL (
mysqldump) - PostgreSQL (
pg_dump) - PostgreSQL in Docker (
docker exec ... pg_dump)
- MongoDB (
- Optional backup compression:
- MySQL/PostgreSQL:
.sql.gz - MongoDB:
.tar.gzarchive of dump folder
- MySQL/PostgreSQL:
- Backup listing from registry.
- Backup restore by backup ID (merge or replace mode).
- Backup deletion by backup ID (file/folder + registry entry).
- Registry persistence in
$HOME/.db_backup/backupRegistry.json. - Connection snapshot saved with each backup entry to support restore runs.
# 1. Create a compressed backup
backinghum backup:create --compress --verbose
# 2. List all backups
backinghum backup:list
# 3. Restore by ID
backinghum backup:restore 1776174984348
# 4. Delete when no longer needed
backinghum backup:delete 1776174984348| Command | Description |
|---|---|
backup:create |
Interactive wizard to create a new backup |
backup:list |
List all backups from the registry |
backup:restore <id> |
Restore a backup by ID |
backup:delete <id> |
Delete a backup by ID |
Options for backup:create:
| Flag | Description |
|---|---|
-c, --compress |
Compress the backup output |
-v, --verbose |
Print detailed process logs |
Install Node.js LTS, then install the native database tools for the databases you plan to use.
| Database | Required tools |
|---|---|
| MongoDB | mongosh, mongodump, mongorestore, tar |
| MySQL | mysql, mysqldump, gzip, gunzip |
| PostgreSQL | psql, pg_dump, gzip, gunzip |
| PostgreSQL (Docker) | docker (container must have pg client tools) |
npm install -g backinghumgit clone https://github.com/AtharvaKatiyar/backinghum.git
cd backinghum
npm install
# Run directly
node bin/cli.js --help
# Or link globally
npm linkbackinghum/
├── bin/cli.js # CLI entrypoint
├── src/
│ ├── adapters/ # DB adapters (mongo, mysql, postgres)
│ ├── commands/backup/ # Command handlers (create, list, restore, delete)
│ ├── prompts/ # Interactive prompt flows per database
│ ├── registry/registry.js # Registry read/write helpers
│ └── utils/ # Errors, normalize, validate, sanitize
├── docs/ # Markdown documentation
├── frontend/ # React + Vite website (deployed to Vercel)
└── tests/ # Test suite
Each backup entry contains:
{
"id": "1776174984348",
"db": "postgres",
"database": "myapp",
"path": "/home/user/backups/myapp_2025-01-10.sql.gz",
"compressed": true,
"size": 204800,
"createdAt": "2025-01-10T14:32:00.000Z",
"connection": { "host": "127.0.0.1", "port": "5432", "user": "postgres", "..." : "..." }
}The
connectionobject stores credentials in plaintext. The registry file is created with mode0600and the directory with0700. Treat it as sensitive.
Registry path can be overridden with DB_BACKUP_REGISTRY_PATH — must be inside the current user's home directory.
prepublishOnlyenforcesnpm test+npm run auditbefore publishing.- Package
filesallowlist prevents accidental file leakage on publish. - Unused dependencies removed to reduce supply-chain risk.
- Registry path override restricted to paths inside the user's home directory.
| Layer | Technology |
|---|---|
| CLI parsing | Commander |
| Interactive prompts | Inquirer |
| DB tool invocation | Native child_process |
| Backup metadata | JSON file registry |
| Website | React, Vite, Tailwind CSS v4 |
| Hosting | Vercel |
ISC