Backup All n8n Workflows to GitHub Nightly
Your workflows ARE production code - they move leads, invoices, and alerts - but most instances have zero version control. One mis-click while editing and last month's working version is simply gone. This workflow calls n8n's own API nightly, pulls every workflow as JSON, and commits changed ones to a GitHub repo: full history, readable diffs, one-click restore by re-importing.
What this workflow does
- A Schedule Trigger runs nightly at 2am.
- An HTTP Request node calls your instance's /api/v1/workflows endpoint with an API key.
- A Code node turns each workflow into a pretty-printed JSON file item, named by its slug.
- A GitHub node creates or updates each file in your backup repo - unchanged files produce no noise commits.
Setup guide
- Import the JSON into n8n (Workflows > Import from File).
- Create an n8n API key (Settings > n8n API) and set it in the HTTP Request node's header auth credential.
- Set your instance URL in the HTTP Request node (e.g. https://your-n8n.example.com/api/v1/workflows).
- Create a private GitHub repo, connect GitHub with a token (repo scope), and set owner/repo in the GitHub node.
- Activate - tomorrow morning your repo contains every workflow as JSON.
Want this running 24/7?
Self-host n8n on a cheap VPS and this workflow runs around the clock for less than a coffee a month.
Get an n8n VPS from $5/monthFAQ
Want the workflows this one is a warm-up for?
The Mega Bundle packs both WorkflowForge Pro volumes — 32 production-grade workflows: automations (cart recovery, lead scoring, invoice extraction) and AI agents (support agent, calendar assistant, research agent), each with a setup guide. $39 for both, instant download.
Get the Mega Bundle →Need it customized for your exact process?
I build custom n8n automations and AI agents professionally: your tools, your edge cases, tested and documented.
Hire me on Fiverr →