workflows.fit
Back to n8n workflows
n8n templateFreeBy Florent

Complete backup solution for n8n workflows & credentials (local/FTP)

Automated n8n Workflows & Credentials Backup to Local/Server Disk & FTP Complete backup solution that saves both workflows and credentials to local/server disk with optional FTP upload for off-site redundancy. What ma...

CommunicationHITLCore NodesData & StorageDevelopmentUtilitySticky NoteCode
Loading interactive preview...

Template notes

Automated n8n Workflows & Credentials Backup to Local/Server Disk & FTP

Complete backup solution that saves both workflows and credentials to local/server disk with optional FTP upload for off-site redundancy.

What makes this workflow different: Backs up workflows AND credentials together Saves to local/server disk (not Git, GitHub, or any cloud services) Optional FTP upload for redundancy (disabled by default) Comprehensive error handling and email notifications Timezone-aware scheduling Ready to use with minimal configuration

How it works

Backup Process (Automated Daily at 4 AM): 1. Initialisation - Sets up timezone-aware timestamps and configurable backup paths for both local/server disk and FTP destinations 2. Folder Creation - Creates date-stamped backup directories (YYYY-MM-DD format) on local/server disk 3. Dual Backup Operations - Processes credentials and workflows in two separate branches: - Credentials Branch: - Exports n8n credentials using the built-in CLI command with backup flag - Lists exported credential files in the credentials folder - Reads each credential file from disk - Optional: Uploads to FTP server (disabled by default) - Optional: Logs FTP upload results for credentials - Workflows Branch: - Retrieves all workflows via n8n API - Cleans workflow names for cross-platform compatibility - Converts workflows to formatted JSON files - Writes files to local/server disk - Optional: Uploads to FTP server (disabled by default) - Optional: Logs FTP upload results for workflows 4. Data Aggregation - Combines all workflow data with binary attachments for comprehensive reporting 5. Results Merging - Consolidates credentials FTP logs, workflows FTP logs, and aggregated workflow data 6. Summary Generation - Creates detailed backup logs including: - Statistics (file counts, sizes, durations) - Success/failure tracking for local and FTP operations - Error tracking with detailed messages - Timezone-aware timestamps 7. Notifications - Sends comprehensive email reports with log files attached and saves execution logs to disk

How to use

Initial Setup:

1. Configure the Init Node - Open the "Init" node and customize these key parameters in the "Workflow Standard Configuration" section: javascript // Admin email for notifications const N8NADMINEMAIL = $env.N8NADMINEMAIL || 'youremail@world.com'; // Workflow name (auto-detected) const WORKFLOWNAME = $workflow.name; // Projects root directory on your server const N8NPROJECTSDIR = $env.N8NPROJECTSDIR || '/files/n8n-projects-data'; // projects-root-folder/ // └── Your-project-folder-name/ // ├── logs/ // ├── reports/ // ├── ... // └── [other project files] // Project folder name for this backup workflow const PROJECTFOLDERNAME = "Workflow-backups"; Then customize these parameters in the "Workflow Custom Configuration" section: javascript // Local backup folder (must exist on your server) const BACKUPFOLDER = $env.N8NBACKUPFOLDER || '/files/n8n-backups'; // FTP backup folder (root path on your FTP server) const FTPBACKUPFOLDER = $env.N8NFTPBACKUPFOLDER || '/n8n-backups'; // FTP server name for logging (display purposes only) const FTPName = 'Synology NAS 2To'; These variables can also be set as environment variables in your n8n configuration.