Secure your critical n8n workflow assets with this robust, scheduled automation. It backs up all active n8n templates to GitHub and automatically handles deletion synchronization.
Download this n8n workflow template and start using it instantly.
Maintaining reliable backups of your crucial business automation logic is essential. This advanced n8n workflow addresses the challenge of managing both active and deleted workflow definitions by synchronizing them with a GitHub repository.
Unlike simple backups, this n8n template doesn't just save new files; it performs a deep comparison of existing backups and current active n8n workflow versions. By using a specialized Code n8n node to canonicalize and compare the JSON structure, it only commits changes if the workflow logic has genuinely been altered, saving API calls and maintaining a clean history. Furthermore, it checks the GitHub repository against the list of active n8n workflows, automatically issuing a file deletion command for any workflows that have been removed from your n8n instance. This ensures your GitHub backup repository perfectly mirrors your active n8n system.
This n8n workflow operates in a recursive loop structure, optimized to handle many workflows efficiently:
Schedule Trigger or manually via the On clicking 'execute' n8n trigger.Globals n8n node sets the target GitHub repository owner and name. The workflow then fetches all active n8n workflows (Get many workflows) and lists all current files in the GitHub repository (List files).Execute Workflow) called via the Execute Workflow Trigger to process each item (active workflow or existing GitHub file) individually, which helps reduce memory usage during large operations.Get file data).isDiffOrNew Code n8n node performs a deep comparison between the current active n8n workflow JSON and the backed-up GitHub version. It determines the status: 'new', 'different', or 'same'.Switch node directs the flow to either Create new file (for new n8n templates), Edit existing file (for updated n8n templates), or does nothing (Same file - Do nothing).isDeleted Code n8n node checks if its ID exists in the list of active n8n workflows.Delete a file GitHub n8n node executes, removing the corresponding backup file from the repository, completing the synchronization.To deploy this specialized n8n template, follow these steps:
Globals n8n node (ID: e6675677) and update the values:repo.owner: Your GitHub username (e.g., john-doe).repo.name: The name of your GitHub repository designated for n8n workflow backups (e.g., n8n-backup).Schedule Trigger, but you can execute it manually once to test the initial sync. Schedule Trigger: The primary n8n trigger, configured to initiate the backup process daily at 7 AM.
n8n Node (Get many workflows): Retrieves a list of all active n8n workflows from the running instance, providing the data necessary for backup and deletion checks. It uses the required n8n API credential.
GitHub Node (List files, Get file data, Create/Edit/Delete file): This critical n8n node interacts with the GitHub API. It lists existing backups, fetches file content for comparison, and performs the necessary file operations (creating new backups, updating changed n8n templates, or deleting retired workflows).
Code Node (isDiffOrNew): Contains custom JavaScript logic. It is responsible for decoding Base64 content from GitHub, ordering JSON keys to ensure deterministic comparison, and comparing the current active n8n workflow against the backup to accurately determine if a file is 'new', 'same', or 'different'.
Code Node (isDeleted): Checks if a file listed in the GitHub repository corresponds to an active n8n workflow ID. If the ID is missing, the n8n template flags it for deletion synchronization.
Execute Workflow Node: Crucial for the recursive design, this n8n node executes the workflow logic per item, optimizing performance and memory usage for synchronizing large numbers of n8n templates.
Secure your installation using this n8n workflow. Automatically export all decrypted n8n credentials using the Execute Command n8n node and store the backup safely in Google Drive.

Learn how to use this robust n8n workflow template to automatically back up all your active n8n workflows daily to a dedicated GitHub repository using the internal n8n API node.

Use this comprehensive n8n workflow to automatically manage and refresh Zalo OA OAuth tokens. Securely cache tokens using n8n static data for reliable, persistent API access.

Automate AI video generation using this powerful n8n workflow. Fetches ideas from Google Sheets, uses GPT-4 for prompt engineering, and generates videos via Fal AI VEO3 model. A reliable n8n template.

Use this n8n workflow to automatically remove backgrounds from images uploaded to Google Drive using the Photoroom API. Configure output size, padding, and background color seamlessly with this n8n template.








































