A TypeScript-based CLI tool for backing up and restoring MongoDB databases using
mongodumpandmongorestore.
- Archive-based backups (
--archive) - Gzip compression
- Database rename during restore
- Structured logging (Winston)
- TypeScript support
- Safe
spawn()execution - Clean CLI workflow
git clone https://github.com/yourname/mongo-backup-cli.git
cd mongo-backup-cli
npm installnpm start- Node.js 18+
- MongoDB Database Tools installed
mongodumpandmongorestoreavailable in PATH- Mongo connection strings inside
.envfile in form ofMONGO_<NAME>=<CONNECTION_STRING>
Creates a compressed archive file:
backups/mydb-2026-02-19.archive.gz
Supports restoring to same or different database using namespace mapping.