Version: 1.7.0
Last Updated: 2026-02-11
The WebDev Backup Tool is a modular bash-based backup solution organized into core modules, utilities, and specialized scripts.
┌─────────────────────────────────────────────────────────────────┐
│ WebDev Backup Tool v1.7.0 │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ webdev-backup.sh (Main Entry) │
│ - Interactive menu system │
│ - Routes to other scripts │
└─────────────────────────────────────────┘
│
┌─────────────────────┼─────────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ backup.sh │ │ restore.sh │ │ cleanup.sh │
│ (Core) │ │ (Restore) │ │ (Maintain) │
└──────────────┘ └──────────────┘ └──────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Core Modules │
├─────────────────────────────────────────────────────────┤
│ config.sh - Configuration & paths │
│ utils.sh - Shared utilities & helpers │
│ fs.sh - Filesystem operations │
│ ui.sh - User interface components │
│ reporting.sh - HTML reports & email │
│ error-handling.sh - Error management │
└─────────────────────────────────────────────────────────┘
│
├─────────────────┬─────────────────┬──────────────┐
▼ ▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Cloud │ │ Encryption │ │ Security │ │ Testing │
│ Storage │ │ (OpenSSL) │ │ Audit │ │ Suite │
│ │ │ │ │ │ │ │
│ - AWS S3 │ │ - AES-256-GCM│ │ - Permissions│ │ - test-backup│
│ - DO Spaces │ │ - PBKDF2 │ │ - Secrets │ │ - test-cron │
│ - Dropbox │ │ - Key mgmt │ │ - Validation │ │ - test-tar │
│ - GDrive │ │ │ │ │ │ - run-tests │
└──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
User Input
│
▼
webdev-backup.sh (Menu/Launcher)
│
├──► backup.sh
│ │
│ ├──► config.sh (paths, settings)
│ ├──► utils.sh (helpers, logging)
│ ├──► fs.sh (file operations)
│ ├──► ui.sh (progress display)
│ └──► reporting.sh (generate reports)
│
├──► restore.sh
│ │
│ ├──► utils.sh
│ ├──► fs.sh
│ └──► ui.sh
│
└──► Other scripts...
Quick reference for which scripts source which modules:
| Script | Sources | Purpose |
|---|---|---|
webdev-backup.sh |
config, utils, ui, reporting | Main menu; routes to other scripts |
backup.sh |
config, utils, ui, fs, reporting | Core backup execution |
restore.sh |
utils, ui, fs | Restore from archives |
quick-backup.sh |
config, utils, ui, fs, reporting | One-command quick backup |
cleanup.sh |
config, utils, error-handling | Remove old backups/logs |
configure-cron.sh |
config, utils, ui | Cron schedule setup |
run-tests.sh |
config, utils | Test runner orchestration |
test-backup.sh |
config, utils, fs, ui | Unit + integration tests |
test/test-cron.sh |
config, utils, ui | Cron functionality tests |
test/test-tar-compatibility.sh |
config, utils, ui, fs | Tar compatibility tests |
Large scripts follow this internal structure for easier navigation:
- backup.sh: (1) Parse CLI args → (2) Validate config & discover projects → (3) Main backup loop per project → (4) Reports & history
- utils.sh: Path helpers → OS/time utilities → Formatting → Logging → Validation → Backup verification → Email
- Purpose: Main launcher with interactive menu
- Responsibilities:
- Display menu options
- Route to appropriate scripts
- Show configuration summary
- Handle command-line arguments
- Purpose: Primary backup execution
- Responsibilities:
- Discover projects in source directories
- Create compressed archives
- Handle full/incremental/differential backups
- Upload to cloud (optional)
- Generate reports
- Log operations
- Purpose: Centralized configuration
- Key Variables:
DEFAULT_SOURCE_DIRS- Source directories to backupDEFAULT_BACKUP_DIR- Backup destinationDEFAULT_CLOUD_PROVIDER- Cloud storage preferenceDATE_FORMAT- Backup naming format
- Purpose: Shared helper functions
- Key Functions:
format_size()- Human-readable file sizeslog()- Logging with timestampsverify_backup()- Integrity checkingsanitize_input()- Security validationsend_email_notification()- Email reports
- Purpose: File and directory operations
- Key Functions:
create_backup_archive()- Create compressed backupsfind_projects()- Discover projectsupload_to_cloud()- Cloud storage uploaddownload_from_cloud()- Cloud storage downloadextract_backup()- Restore operations
- Purpose: User interaction and display
- Key Functions:
print_dashboard_header()- Progress displaydisplay_backup_summary()- Results summaryshow_backup_help()- Help textselect_projects()- Interactive selection
- Purpose: Generate reports and visualizations
- Key Functions:
create_backup_report()- HTML reportscreate_email_report()- Email summariesgenerate_history_chart()- Visualizationscreate_visual_dashboard()- Dashboard HTML
1. User runs backup.sh
│
2. Load config.sh → Get source dirs, backup dir
│
3. Find projects in source directories
│
4. For each project:
│ ├── Get project size
│ ├── Create tar.gz archive
│ ├── Verify archive (optional)
│ ├── Upload to cloud (optional)
│ └── Log results
│
5. Generate HTML report
│
6. Send email notification (optional)
│
7. Update backup history log
1. User runs restore.sh
│
2. List available backups
│
3. User selects backup
│
4. Extract archive to destination
│
5. Verify extraction
│
6. Report results
backup-webdev/
├── webdev-backup.sh # Main entry point
├── backup.sh # Core backup (sources parse-backup-args.sh)
├── parse-backup-args.sh # CLI argument parsing for backup
├── restore.sh # Restoration
├── config.sh # Configuration
├── utils.sh # Utilities (sources utils-os, utils-time, utils-path, utils-format)
├── utils-os.sh # OS detection
├── utils-time.sh # Date/time utilities
├── utils-path.sh # Path helpers (abs_path, validate_path, get_file_size_bytes)
├── utils-format.sh # format_size, capitalize
├── fs.sh # Filesystem ops
├── ui.sh # User interface
├── reporting.sh # Reports
├── error-handling.sh # Error management
├── quick-backup.sh # Quick backup
├── cleanup.sh # Maintenance
└── [other scripts...]
archive/
└── src.legacy/ # Archived alternative structure
├── core/
├── utils/
├── ui/
├── reports/
├── security/
├── test/ # Archived (active tests moved to root test/)
└── setup/
-
Input Validation
sanitize_input()- Command injection preventionvalidate_path()- Path traversal prevention
-
File Permissions
umask 027- Restrictive defaultssecure-permissions.sh- Permission management
-
Encryption
- AES-256-GCM encryption
- PBKDF2 key derivation
- Secure key management
-
Archive Safety
- Path traversal detection
- Filename validation
- Safe extraction flags
-
New Backup Type:
- Add function to
backup.sh - Update
webdev-backup.shmenu - Add to
config.shif needed
- Add function to
-
New Cloud Provider:
- Add case to
upload_to_cloud()infs.sh - Add case to
download_from_cloud()infs.sh - Update documentation
- Add case to
-
New Report Format:
- Add function to
reporting.sh - Call from
backup.shorrestore.sh
- Add function to
- Parallel Compression: Uses
pigzwhen available - Progress Monitoring: Real-time file size tracking
- Incremental Backups: Only changed files
- Exclusion Rules: Skips
node_modulesautomatically - Timeout Protection: Prevents hanging on large directories
- Centralized error handling via
error-handling.sh - Logging to files and console
- Graceful degradation (fallbacks)
- User-friendly error messages
For detailed component documentation, see individual script headers and README.md