A powerful, lightweight command-line backup utility written in TypeScript. BackKit creates compressed backups of your files and directories, supports incremental backups, and provides easy restore functionality.
- ✅ Full Directory Backups - Backup entire directory structures with all files
- ✅ Incremental Backups - Only backup files that have changed (saves time and space)
- ✅ Compressed Archives - Creates
.tar.gzarchives to save disk space - ✅ Metadata Tracking - Tracks file metadata (size, modification time, SHA256 hash)
- ✅ Automatic Cleanup - Removes old backups based on retention policy
- ✅ Restore Functionality - Easily restore files from backup archives
- ✅ Permission Preservation - Maintains file permissions and timestamps
- ✅ Cross-Platform - Works on Windows, Linux, and macOS
- Node.js (v14 or higher)
- npm or yarn
- Clone the repository:
git clone https://github.com/avinash55o/backkit.git
cd backkit- Install dependencies:
npm install- Build the project:
npm run build# Using npm script
npm run dev -- -s "path/to/source" -d "path/to/destination"
# Using compiled version
node ./dist/cmd/main.js -s "path/to/source" -d "path/to/destination"Only backs up files that have changed since the last backup:
npm run dev -- -s "source" -d "destination" -iSet how many days to keep old backups (default: 30 days):
npm run dev -- -s "source" -d "destination" -r 7Restore files from a backup archive:
npm run dev -- --restore -s "backup-2025-01-15T10-30-00-000Z.tar.gz" -d "restore-folder"| Option | Short | Description | Required |
|---|---|---|---|
--source <path> |
-s |
Source directory to backup (or backup file for restore) | Yes |
--destination <path> |
-d |
Destination folder for backups (or restore location) | Yes |
--incremental |
-i |
Enable incremental backup mode | No |
--retention <days> |
-r |
Number of days to keep old backups (default: 30) | No |
--restore |
Restore from backup instead of creating backup | No |
# Basic backup
npm run dev -- -s "D:\MyDocuments" -d "D:\Backups"
# Incremental backup with 7-day retention
npm run dev -- -s "D:\Projects" -d "D:\Backups" -i -r 7
# Restore latest backup
npm run dev -- --restore -s "D:\Backups\backup-2025-01-15T10-30-00-000Z.tar.gz" -d "D:\Restored"# Basic backup
npm run dev -- -s "/home/user/documents" -d "/home/user/backups"
# Incremental backup
npm run dev -- -s "/home/user/projects" -d "/home/user/backups" -i
# Restore
npm run dev -- --restore -s "/home/user/backups/backup-2025-01-15T10-30-00-000Z.tar.gz" -d "/home/user/restored"- Validation - Validates source and destination paths
- Metadata Check - Reads previous backup metadata (if incremental)
- Directory Traversal - Recursively scans source directory
- Change Detection - Compares file size and modification time
- Hashing - Computes SHA256 hash for changed files
- Archive Creation - Creates compressed
.tar.gzarchive - Metadata Storage - Saves metadata to
.goback-meta.json - Cleanup - Removes old backups based on retention policy
- Archive Reading - Opens the
.tar.gzbackup file - Decompression - Decompresses the archive
- Extraction - Extracts files to destination directory
- Permission Restoration - Restores file permissions
- Timestamp Restoration - Restores file modification times
BackKit/
├── src/
│ ├── cmd/
│ │ └── main.ts # CLI entry point
│ ├── cli/
│ │ └── args.ts # Argument validation
│ ├── core/
│ │ ├── backup.ts # Main backup logic
│ │ ├── restore.ts # Restore functionality
│ │ ├── incremental.ts # Change detection
│ │ ├── traversal.ts # Directory walking
│ │ ├── archive.ts # Archive utilities
│ │ └── types.ts # TypeScript types
│ ├── storage/
│ │ └── metadataStore.ts # Metadata persistence
│ └── utils/
│ ├── hash.ts # File hashing
│ ├── passThroughHash.ts # Streaming hash
│ └── progress.ts # Progress tracking
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md
npm run buildRun directly with TypeScript (no build needed):
npm run dev -- -s "source" -d "destination"npm run lintBackKit creates a .goback-meta.json file in the destination directory that contains:
- Backup creation timestamp
- Version number
- File metadata (path, size, modification time, SHA256 hash, permissions)
This file is used for incremental backups to determine which files have changed.
Backups are stored as .tar.gz files with the naming convention:
backup-YYYY-MM-DDTHH-MM-SS-sssZ.tar.gz
Example: backup-2025-01-15T10-30-00-000Z.tar.gz
- Currently only supports
.tar.gzformat - No encryption support (yet)
- No cloud storage integration (yet)
- No progress bar (yet)
- No file exclusion patterns (yet)
- Progress bar for backup/restore operations
- File exclusion patterns (
.gitignorestyle) - Cloud storage integration (AWS S3, Google Drive, etc.)
- Backup encryption (AES-256)
- Scheduled backups
- Multiple backup format support (ZIP, 7z)
- Backup verification
- Resume interrupted backups
- Backup listing and management commands
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
If you encounter any issues or have questions, please open an issue on GitHub.
Built with TypeScript and Node.js