Skip to main content

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

Workflow preview

Workflow preview
100%
Complete backup solution for n8n workflows & credentials (local/FTP) preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

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...

Best for

  • DevOps automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.code, n8n-nodes-base.readwritefile, n8n-nodes-base.emailsend, n8n-nodes-base.executecommand, n8n-nodes-base.scheduletrigger, n8n-nodes-base.converttofile, n8n-nodes-base.n8n

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Florent.

Original n8n.io source

1.1 Workflow description

Title
Complete backup solution for n8n workflows & credentials (local/FTP)
Workflow name
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 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:

    // Admin email for notifications
    const N8N_ADMIN_EMAIL = $env.N8N_ADMIN_EMAIL || '[email protected]';
    
    // Workflow name (auto-detected)
    const WORKFLOW_NAME = $workflow.name;
    
    // Projects root directory on your server
    const N8N_PROJECTS_DIR = $env.N8N_PROJECTS_DIR || '/files/n8n-projects-data';
    // projects-root-folder/
    //   └── Your-project-folder-name/
    //       ├── logs/
    //       ├── reports/
    //       ├── ...
    //       └── [other project files]
    
    // Project folder name for this backup workflow
    const PROJECT_FOLDER_NAME = "Workflow-backups";
    

    Then customize these parameters in the "Workflow Custom Configuration" section:

    // Local backup folder (must exist on your server)
    const BACKUP_FOLDER = $env.N8N_BACKUP_FOLDER || '/files/n8n-backups';
    
    // FTP backup folder (root path on your FTP server)
    const FTP_BACKUP_FOLDER = $env.N8N_FTP_BACKUP_FOLDER || '/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.

  2. Set Up Credentials:

    • Configure n8n API credentials for the "Fetch Workflows" node
    • Configure SMTP credentials for email notifications
    • Optional: Configure FTP credentials if you want to enable off-site backups
  3. Configure Backup Folder:

    • Ensure the backup folder path exists on your server
    • Verify proper write permissions for the n8n process
    • If running in Docker, ensure volume mapping is correctly configured
  4. Customize Email Settings:

    • Update the "Send email" node with your recipient email address or your "N8N_ADMIN_EMAIL" environment value
    • Adjust email subject and body text as needed

Enabling FTP Upload (Optional):

By default, FTP upload nodes are disabled for easier setup. To enable off-site FTP backups:

  1. Simply activate these 4 nodes (no other changes needed):

    • "Upload Credentials To FTP"
    • "FTP Logger (credentials)"
    • "Upload Workflows To FTP"
    • "FTP Logger (workflows)"
  2. Configure FTP credentials in the two upload nodes

  3. The workflow will automatically handle FTP operations and include upload status in reports

Requirements

  • n8n API credentials (for workflow fetching)
  • SMTP server configuration (for email notifications)
  • Adequate disk space for local backup storage
  • Proper file system permissions for backup folder access
  • Docker environment with volume mapping (if running n8n in Docker)
  • Optional: FTP server access and credentials (for off-site backups)

Good to know

  • Security: Credentials are exported using n8n's secure backup format - actual credential values are not exposed in plain text
  • Timezone Handling: All timestamps respect configured timezone settings (defaults to Europe/Paris, configurable in Init node)
  • File Naming: Automatic sanitization ensures backup files work across different operating systems (removes forbidden characters, limits length to 180 characters)
  • FTP Upload: Disabled by default for easier setup - simply activate 4 nodes to enable off-site backups without any code changes
  • Connection Resilience: FTP operations include error handling for timeout and connection issues without failing the entire backup
  • Graceful Degradation: If FTP nodes are disabled, the workflow completes successfully with local backups only and indicates FTP status in logs
  • Error Handling: Comprehensive error catching with detailed logging and email notifications
  • Dual Logging: Creates both JSON logs (for programmatic parsing) and plain text logs (for human readability)
  • Storage: Individual workflow JSON files allow for selective restore and easier version control integration
  • Scalability: Handles any number of workflows efficiently with detailed progress tracking

This automated backup workflow saves your n8n data to both local disk and FTP server. To restore your backups, use:

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Backup Summary

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 7 - Write Backup Log

Type / Role
n8n-nodes-base.readWriteFile - readWriteFile
Config choices
Version 1

Block 8 - Send email

Type / Role
n8n-nodes-base.emailSend - emailSend
Config choices
Version 2.1

Block 9 - Write Email Log

Type / Role
n8n-nodes-base.readWriteFile - readWriteFile
Config choices
Version 1

Block 10 - Create Date Folder

Type / Role
n8n-nodes-base.executeCommand - executeCommand
Config choices
Version 1

Block 11 - Init

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 12 - Daily Backup

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 13 - Convert to File

Type / Role
n8n-nodes-base.convertToFile - convertToFile
Config choices
Version 1.1

Block 14 - Fetch Workflows

Type / Role
n8n-nodes-base.n8n - n8n
Config choices
Version 1

Block 15 - Clean Filename

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 16 - Write Each Workflow To Disk

Type / Role
n8n-nodes-base.readWriteFile - readWriteFile
Config choices
Version 1

Block 17 - ERROR: Backup Summary

Type / Role
n8n-nodes-base.stopAndError - stopAndError
Config choices
Version 1

Block 18 - ERROR: Clean Filename

Type / Role
n8n-nodes-base.stopAndError - stopAndError
Config choices
Version 1

Block 19 - Read/Write Files from Disk

Type / Role
n8n-nodes-base.readWriteFile - readWriteFile
Config choices
Version 1

Block 20 - List Credential Files

Type / Role
n8n-nodes-base.executeCommand - executeCommand
Config choices
Version 1

Block 21 - Output Credential Items

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 22 - Aggregate

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 23 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 24 - Upload Credentials To FTP

Type / Role
n8n-nodes-base.ftp - ftp
Config choices
Version 1

Showing the first 24 of 28 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Complete backup solution for n8n workflows & credentials (local/FTP)
Complexity advanced
Nodes 28
Categories DevOps
Author Florent
Published 01 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/9151/9151.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Complete backup solution for n8n workflows & credentials (local/FTP) do?

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...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your DevOps use case.