/n8n-tutorials

How to back up n8n workflows?

Learn how to back up n8n workflows safely with simple steps and best practices to protect your automations and keep your data secure.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free consultation

How to back up n8n workflows?

The safest and most reliable way to back up n8n workflows is to back up the entire n8n data directory (often called .n8n) or, if you're using a database, back up the database itself. These locations contain every workflow, every credential, every execution, and all n8n settings. You can also export workflows manually from the UI, but that should be treated as a secondary/one‑off method, not a real backup strategy.

 

Two Real Production‑Safe Backup Methods

 

You really have only two proper sources of truth for backups:

  • File‑system backup when n8n uses the default SQLite mode.
  • Database backup when using Postgres/MySQL (recommended for production).

Everything else (like manually exporting JSON from the UI) is fine for quick copies but not reliable for restoring a full n8n installation.

 

1. Backing up n8n when using SQLite (default install)

 

In this mode n8n stores everything inside a folder called .n8n. If you're running via Docker, that folder is usually mounted as a volume. This folder contains:

  • database.sqlite — all workflows, credentials, tags, execution data
  • config files
  • binaryData folder if you store files inside executions

You simply copy this folder somewhere safe. That’s your backup.

A simple shell example:

// Backup the whole .n8n directory to a dated folder
cp -r /path/to/.n8n /backups/n8n-$(date +%F)/

To restore, you put the folder back in place and restart n8n. That’s it.

Important production note:
Make this copy while n8n is not actively writing (or stop the container briefly). SQLite is a single-file DB, and copying it during writes can corrupt backups.

 

2. Backing up n8n when using Postgres or MySQL (recommended in production)

 

In a more mature setup, the n8n application container is stateless and all workflow/credential/execution data lives entirely in the database. So the backup is simply your DB backup.

  • Postgres example
// Dump the entire n8n database
pg_dump -U n8n_user -h localhost n8n_db > n8n_backup.sql
  • MySQL example
// Dump MySQL/MariaDB n8n database
mysqldump -u n8n_user -p n8n_db > n8n_backup.sql

To restore, load that dump into a clean database and point your n8n instance to it.

If you have binaryData set to filesystem mode (not DB mode), also back up the folder you mapped for it.

 

3. Optional: Exporting workflows manually from the UI

 

This is okay for a one‑off copy or sharing a workflow with someone, but it is not a real backup strategy. It exports only the workflow JSON — not credentials, not tags, not execution data, not settings.

  • You can click into a workflow.
  • Open its menu (top-right).
  • Select Download or Export.

Use this only as a convenience, not for disaster recovery.

 

4. Where people often get confused

 

  • Backing up the Docker image is meaningless. All data lives outside the image.
  • Environment variables (like webhook URLs, queue settings, etc.) must be backed up separately, usually in your compose file or env file.
  • Credentials are stored encrypted in the DB. You don’t need to decrypt them to back them up — just back up the DB or .n8n folder.
  • Restoring a workflow JSON file will not restore the credentials it needs. Only DB or .n8n restores credentials.

 

5. What a healthy production backup strategy looks like

 

  • File-based n8n (SQLite): daily backup of the entire .n8n directory.
  • Database n8n (Postgres/MySQL): daily DB dump + folder backup for binaryData (if used).
  • Keep your docker-compose.yml or env file in git so you can recreate the environment.
  • Test restoration at least once — many teams never test and discover corruption too late.

 

If you follow these steps, your n8n installation becomes fully recoverable: workflows, credentials, executions, settings, everything. That's the same approach teams use in real production deployments.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022