Using n8n snapshots for backups that restore
I run n8n on a few homelab servers. I treat backups like hygiene, not an afterthought. The point is simple: if I cannot restore it, it is not a backup.
Overview of n8n backup patterns
Backups stop mistakes becoming disasters. A broken workflow can halt processes, leak data, or trigger duplicate jobs. Workflows change often. Credentials change less often, but when they break the impact is higher. Treat workflows and credentials as separate assets.
Pick at least two complementary tactics.
-
Export workflows and credentials via the CLI.
npx n8n export:workflow --backup --output ./repo/workflows/ npx n8n export:credentials --backup --output ./repo/credentials/These exports produce JSON you can commit to Git or push to remote storage. The n8n docs cover export and import commands and options for the CLI, which I use as the base of scripted backups. n8n export/import docs
-
Database backups. If you self-host with Postgres or MySQL, schedule regular dumps. A daily Postgres dump with
pg_dumpsaved to a timestamped file works fine. Keep at least 7 days of rotation on-site and longer offsite. -
File system snapshots. If n8n runs in Docker on a VM, take VM-level snapshots or filesystem snapshots before heavy changes. That captures the app state and any runtime files.
-
Git-based versioning for workflows. Commit exported JSON into a repo with a clear folder structure. Tag releases before making risky edits. Use automated workflows to push exports to GitHub or a private repo.
Some platforms use the term snapshot for VM or storage-level copies. n8n itself does not have first-class workflow version snapshots in the UI for all installs, so I combine CLI exports with DB backups and platform snapshots. CrateDB-backed solutions and managed services may support incremental snapshot repositories and restoration workflows; I use the CrateDB blog post on automated snapshot management when I need incremental table-level backups for stateful services. CrateDB snapshot workflow example
Example restore path:
- Restore the database dump to a test instance.
- Import workflows and credentials from JSON using the CLI or the UI import.
- Run a smoke test for a few critical workflows.
- If tests pass, swap production pointers or deploy changes.
Test restores on a separate host when possible. Restores uncover gaps in the restore steps and missing secrets.
Best practices for using n8n snapshots
Backups mean nothing until you restore. Test a full restore once a month. Keep a checklist.
- Pick three critical workflows.
- Restore the DB and import those workflow JSON files.
- Run the workflows with test data.
- Check credentials and webhook endpoints.
I record timings. If a full restore takes more than the maintenance window, the plan needs changing. I time restores in the lab and write the steps down. That reduces panic if something breaks late at night.
Practical schedules:
- Export workflows and credentials daily at 02:00.
- Database dump daily at 03:00 with 7-day rotation.
- Weekly full snapshot stored offsite for 90 days.
- Monthly long-term archive kept for compliance reasons when necessary.
Offsite copies protect against hardware failure and local disasters. I prefer using multiple destinations:
- Git hosting for workflow JSON. Private repo, branch protection, and organisation secrets kept out of the repo. Use automation to update a single path per day.
- Cloud object storage for database dumps. S3-compatible buckets with lifecycle rules to expire old files.
- Encrypted archives for credentials backups. Never store plaintext secrets in Git. Use an encrypted file or a secrets manager export that is itself backed up.
Use an n8n workflow template that exports workflows and pushes them to Google Drive or GitHub. n8n’s workflow templates include examples for GitHub and Google Drive pushes. Automate cleanup of old snapshots in the same workflow. If your instance runs in a VM provider, automate provider-level snapshots and tie them to the same retention policy.
The n8n docs and community forums contain export/import guides, CLI references and user scripts. The docs list the CLI commands for export and import that I rely on when scripting backups. n8n export/import docs The n8n blog and community templates also show workflows to push exports to Git or cloud storage, and examples for automating snapshot lifecycles for databases. CrateDB snapshot workflow example
Concrete tips from my lab:
- Keep credentials out of version control. Export credentials separately and encrypt them with a passphrase stored in a secure vault.
- Name backup files with ISO timestamps. For example,
workflows-2025-11-09T02:00Z.json. - Test restores to a throwaway host, not production.
- Automate deletion of stale snapshots. Old files cost money and clutter restores.
- Document the restore procedure in plain steps. Copy-paste commands that actually work.
Takeaways:
- Treat workflows, credentials and the database as distinct assets when you design n8n backups.
- Use CLI exports plus DB dumps plus VM or storage snapshots for layered protection.
- Automate daily exports and monthly full snapshots, and run a monthly restore test.
- Keep one copy offsite and encrypt credentials before storing them.
- Document the restore steps and time a dry run so you know the real effort.
Set the scripts. Run a restore. If the restore works, the backups are doing their job.




