BackupForge is a production-focused command-line utility for backing up and restoring databases across multiple engines. It provides a consistent interface for creating reliable backups, storing them locally or on S3, applying compression, and validating artifact integrity with cryptographic manifests.
Repository: https://github.com/RajeshBasnet-dev/Database_Backup_Utility_CLI
- Why BackupForge
- Key Features
- Supported Databases
- Architecture Overview
- Installation
- Quick Start
- Command Reference
- Integrity Workflow (Recommended)
- Configuration
- Examples
- Operational Notes
- Roadmap Ideas
BackupForge is designed for teams and builders who need:
- Multi-database support with one CLI interface.
- Operational simplicity for backup, restore, and scheduling flows.
- Reliability controls such as compression and backup integrity verification.
- Deployment flexibility for local-first workflows and cloud storage (AWS S3).
- 🔥 Multi-Database Support: MySQL, PostgreSQL, MongoDB, SQLite
- 💾 Storage Backends: Local filesystem and AWS S3
- 🗜️ Compression: ZIP and GZIP options
- ⏰ Scheduling: Automated recurring backups
- 📢 Notifications: Slack webhook integration for backup and restore outcomes
- 🔐 Integrity Manifests: SHA-256 + size metadata for tamper detection
- 🌐 Cross-Platform: Linux, macOS, and Windows compatible
| Database | Backup | Restore | Compression | S3 Storage | Integrity Verify |
|---|---|---|---|---|---|
| MySQL | ✅ | ✅ | ✅ | ✅ | ✅ |
| PostgreSQL | ✅ | ✅ | ✅ | ✅ | ✅ |
| MongoDB | ✅ | ✅ | ✅ | ✅ | ✅ |
| SQLite | ✅ | ✅ | ✅ | ✅ | ✅ |
graph LR
A[CLI Interface] --> B[Argument Parser]
B --> C{Database Type}
C --> D[MySQL Connector]
C --> E[PostgreSQL Connector]
C --> F[MongoDB Connector]
C --> G[SQLite Connector]
D --> H[Backup / Restore Engine]
E --> H
F --> H
G --> H
H --> I{Storage}
I --> J[Local]
I --> K[S3]
H --> L[Compression]
H --> M[Manifest Generation]
H --> N[Logging + Notifications]
git clone https://github.com/RajeshBasnet-dev/Database_Backup_Utility_CLI.git
cd Database_Backup_Utility_CLIpip install -r requirements.txt- MySQL:
mysqldump,mysql - PostgreSQL:
pg_dump,pg_restore,psql - MongoDB:
mongodump,mongorestore,mongosh(ormongo) - SQLite: bundled with Python (
sqlite3module)
backupforge backup \
--db-type mysql \
--host localhost \
--port 3306 \
--username root \
--password root \
--database appdbbackupforge restore \
--db-type postgres \
--host localhost \
--username postgres \
--password postgres \
--database appdb \
--file backup.dumpbackupforge backup --db-type sqlite --database /path/to/app.sqlite --manifestCreate a backup and optionally compress and store it.
backupforge backup --db-type <mysql|postgres|mongodb|sqlite> [options]Common options:
--compress zip|gzip--storage local|s3--manifest(generate SHA-256 sidecar manifest)
Restore a database from a backup artifact.
backupforge restore --db-type <...> --file <backup-file> [options]Validate database connection parameters.
backupforge test-connection --db-type <...> [options]Schedule recurring backups.
backupforge schedule --db-type <...> --interval 60 [options]List existing backups from local path or S3.
backupforge list --storage local --path ./backupsVerify backup file integrity against its manifest.
backupforge verify --file ./backups/my_backup.sql.gzIf manifest path is custom:
backupforge verify --file ./backups/my_backup.sql.gz --manifest-file ./backups/custom.manifest.json- Create backup with manifest
backupforge backup --db-type sqlite --database /path/to/app.sqlite --manifest
- Store/transmit backup artifact (local or S3).
- Verify integrity before restore
backupforge verify --file ./backups/app_backup.db
- Restore only after successful verification.
This workflow reduces risk from accidental corruption and unauthorized tampering.
Set webhook URL:
export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK"You can provide credentials via:
- CLI flags (
--access-key,--secret-key) - Environment variables (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY) - Standard AWS credential/config files
backupforge backup \
--db-type postgres \
--host localhost \
--username user \
--password pass \
--database mydb \
--compress gzip \
--storage s3 \
--bucket my-backups \
--region us-east-1 \
--access-key YOUR_ACCESS_KEY \
--secret-key YOUR_SECRET_KEY \
--manifestbackupforge backup \
--db-type mongodb \
--host localhost \
--port 27017 \
--username admin \
--password admin \
--database analyticsbackupforge list --storage local --path ./backups- Verify required database client binaries are installed and available in
PATH. - For production usage, prefer:
- storing backups in immutable/object storage,
- enabling manifests (
--manifest), - verifying backups before restore,
- rotating and monitoring backup jobs.
- Treat credentials securely (avoid exposing secrets in shell history when possible).
Potential next steps to elevate BackupForge further:
- End-to-end encryption for backup artifacts
- Signed manifests (e.g., HMAC or asymmetric signing)
- Policy-driven retention/pruning
- Health dashboards and periodic restore drills
- Pluggable storage targets beyond S3