A cross-database backup and recovery CLI built with Node.js for PostgreSQL and MongoDB.
Penguin provides a unified workflow for creating backups, restoring databases, compressing backup files, uploading backups to AWS S3, scheduling automated backups, and sending email notifications.
- Create PostgreSQL backups
- Create MongoDB backups
- Restore databases from backup files
- Automatic timestamp-based backup naming
- Support for compressed backup files
- Restore backups into a temporary database
- Compare restored data with the existing database
- Review differences before applying changes
- Rollback support through temporary database validation
- Compress backup files using Gzip
- Optional removal of raw backup files after compression
- Reduced storage requirements
- Upload backups directly to an AWS S3 bucket
- Preserve backup directory structure in cloud storage
- Optional upload configuration
- Send email notifications after backup operations
- Success and failure status reporting
- Automated backup execution using cron schedules
- Configurable backup intervals through configuration files
- Structured logging using Winston
- Operation status tracking
- Error logging
- Backup and restore duration tracking
- PostgreSQL
- MongoDB
- Adapter-based architecture for future database support
| Database | Backup | Restore |
|---|---|---|
| PostgreSQL | ✅ | ✅ |
| MongoDB | ✅ | ✅ |
git clone https://github.com/GR4V1TY123/Penguin_Backup_Tool.git
cd penguinnpm installInstall PostgreSQL and ensure the following commands are available in your system PATH:
pg_dump
pg_restore
psqlInstall MongoDB Database Tools and ensure the following commands are available in your system PATH:
mongodump
mongorestoreCreate a .env file in the project root:
AWS_REGION=ap-south-1
AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
AWS_SECRET_ACCESS_KEY=YOUR_SECRET_KEY
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-passwordExample configuration:
{
"user": {
"username": "postgres",
"password": "password",
"host": "localhost",
"port": 5432,
"database": "Office",
"aws": {
"allow_upload": true,
"bucket_name": "penguin-backups"
},
"options": {
"notification": {
"enabled": true,
"email": "example@gmail.com"
},
"delete_raw_file": true,
"cron": {
"enabled": true,
"schedule": "0 0 * * *"
}
}
}
}node index.js backupOr provide connection details:
node index.js backup \
-u postgres \
-p password \
-H localhost \
-P 5432 \
-d Officenode index.js restoreOr provide connection details:
node index.js restore \
-u postgres \
-p password \
-H localhost \
-P 5432 \
-d Officebackups/
└── postgres/
└── Office/
└── postgres_Office_20260604T142733.sql.gz
backups/
└── mongodb/
└── world/
└── world_20260604T142733.archive.gz
Current Database
│
▼
Create Temporary Database
│
▼
Restore Backup
│
▼
Compare Databases
│
▼
User Confirmation
│
┌──────┴──────┐
▼ ▼
Proceed Rollback
▼ ▼
Apply Delete Temp DB
Restore
- Node.js
- Commander
- PostgreSQL
- MongoDB
- Winston
- Inquirer
- Ora
- AWS SDK
- Nodemailer
- node-cron
- Child Process API
- Gzip Compression
- MySQL Support
- SQLite Support
- Backup Encryption
- Backup Integrity Verification
- Differential Backups
MIT License