---
title: "Deploy n8n Git Backups"
description: "export workflows to Git backups"
category: "Automation"
url: https://railway.com/deploy/n8n-git-backups
---

# Deploy n8n Git Backups

export workflows to Git backups

**[Deploy n8n Git Backups on Railway](https://railway.com/template/n8n-git-backups)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/n8n-git-backups/manifest.json

- **Creator:** onepush
- **Category:** Automation

## Template content

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:18

### n8n-worker

- **Image:** n8nio/n8n:2.36.8
- **Start command:** `n8n worker`
- **Health check:** /healthz

### n8n

- **Image:** n8nio/n8n:2.36.8
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host self hosted n8n Git Backups (Open-Source Workflow Backup) on Railway

Once you run more than a few n8n workflows, losing them to a bad edit or a crashed volume becomes real. This template sets up a cron-driven Git export pipeline that snapshots workflows and credentials to GitHub or GitLab, with queue-mode workers so heavy exports don't freeze your editor. You get version history and disaster recovery without manual JSON downloads.

Self-host n8n Git Backups on Railway in queue mode with an n8n editor, dedicated worker, PostgreSQL, and Redis Bull so webhooks and long workflows stay off the UI—flat infrastructure cost instead of per-task SaaS billing. Prefer the [cheapest n8n without queue mode](https://railway.com/deploy/n8n) when you do not need queue-mode workers.

## About Hosting n8n Git Backups open-source software on Railway (self hosted n8n template)

Most n8n admins discover the backup problem the hard way. You tweak a workflow at 11pm, it breaks the next morning, and there's no rollback because the Community Edition doesn't keep workflow history beyond a single undo buffer. Manual exports start out fine, then you forget for three weeks and the Git repo goes stale.

This Railway template treats workflow exports as infrastructure, not chores. An n8n instance inside the stack runs a scheduled workflow that hits the internal API, pulls every workflow and credential, serializes them to JSON, and pushes the result to a Git remote. Queue mode matters here: on a single-process n8n, exporting 200 workflows can block the editor for minutes. A dedicated worker keeps the editor responsive while the export runs in the background.

You also get Git-native review. Every export becomes a commit. Your team can see exactly what changed in an automation, roll back to any previous commit, and treat workflow changes with the same rigor as code changes. That's the gap this template fills.

## Why Deploy n8n Git Backups, the manual n8n export alternative on Railway (Railway Free Trial)

Manual n8n export works until it doesn't. You click Export, download a JSON, commit it somewhere, and repeat. The problem isn't mechanics—it's discipline. Nobody exports after every change, credentials are buried in a separate menu, and when you actually need the backup it's six weeks old and missing the workflow you're trying to recover.

This template replaces willpower with a cron schedule. The export runs on a timer, grabs credentials alongside workflows, and pushes to Git so you get a commit history showing who changed what and when. The Railway Free Trial lets you test the whole pipeline before spending a dollar. Spin up the stack, configure your Git remote, trigger the export once, and watch commits land. If the worker keeps your editor snappy, you've validated the approach. If not, you've lost fifteen minutes.

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying n8n Git Backups on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

### Railway vs Other Hosting Providers and VPS for n8n Git Backups self hosting

Running a queue-mode n8n stack with Postgres, Redis, and a scheduled backup workflow is different from a single app. A bare VPS forces you to wire all of that together yourself. Railway gives you managed services with environment variable injection and health checks built in.

| Provider | Setup time for queue-mode stack | Backup workflow complexity | Cost range for this stack |
|----------|-------------------------------|---------------------------|--------------------------|
| DigitalOcean | 1-2 hours (Droplet + Postgres + Redis manual setup) | High—you manage cron, Git auth, and worker process yourself | $18-$35/month |
| AWS | 3-4 hours (EC2 + RDS + ElastiCache + IAM) | High—plus VPC and security group configuration | $30-$60/month |
| Hetzner | 1-2 hours (CX line + manual Postgres/Redis) | Medium—solid hardware but you're still the sysadmin | $10-$25/month |
| Railway | 10-15 minutes (template deploys editor + worker + Postgres + Redis) | Low—env vars and volume config handled by the platform | $10-$25/month |

Hetzner wins on raw compute cost if you're comfortable running PostgreSQL and Redis yourself. But when the goal is a reliable backup pipeline rather than a server administration hobby, Railway's managed services and deployment speed are hard to argue with.

## Common Use Cases for hosted n8n Git Backups

The most common scenario is a solo operator or small team running n8n on a VPS who has been burned once. One bad edit or a container rebuild that wipes the volume, and a client-facing automation is gone. Git backup becomes the insurance policy.

Agencies managing n8n for multiple clients use this to keep each client's workflows and credentials in a separate repo or branch. They can show a commit history proving automations are versioned and recoverable.

Teams that treat automation as software use the export as a lightweight CI step. A developer changes a workflow in the editor, the cron export picks it up, and the resulting commit goes through PR review before merging. It's not full GitOps, but it's a practical middle ground.

Disaster recovery testing is another use. You can simulate a full instance loss by deploying fresh n8n, cloning the backup repo, and importing workflows and credentials. If restore works in the test, it'll work in the real emergency.

## Dependencies for n8n Git Backups Docker hosted on Railway

This stack isn't a single container—it's a small distributed system. The editor and worker share the same n8n image but run as separate Railway services with different commands. PostgreSQL stores workflow definitions and execution data. Redis handles the Bull queue that distributes export jobs from the editor to the worker. The volume at /home/node/.n8n persists n8n's internal state, including the encryption key that protects credentials. If that volume dies, your credentials become unreadable ciphertext even with JSON exports, because the key lives outside Git.

### Deployment Dependencies for Managed n8n Git Backups Service (Workflow Backup)

The Railway template provisions three services. The editor runs n8nio/n8n:2.36.8 with the standard start command on port 5678. The worker runs the same image but with the command `n8n worker`, no port exposure. PostgreSQL runs as a managed Railway database with DB_TYPE=postgresdb and EXECUTIONS_MODE=queue. Redis runs as a managed Railway cache service for the Bull queue. The volume mounts at /home/node/.n8n so state survives redeploys.

Environment variables that matter: WEBHOOK_URL tells n8n its public URL so webhook-triggered workflows still fire. N8N_PROXY_HOPS=1 accounts for Railway's reverse proxy. N8N_ENCRYPTION_KEY is the one you write down and never lose—it's the master key for all credentials. EXECUTIONS_DATA_PRUNE=true keeps execution history from bloating Postgres, because export jobs themselves generate execution records.

### Implementation Details for n8n Git Backups (Using n8n official docker image)

The export workflow runs inside n8n, which is a nice recursive property: you're using n8n to back up n8n. The workflow calls the internal API endpoint that lists all workflows, then iterates through each one fetching the full JSON definition. Credentials come through a separate endpoint, and yes, the export includes credential values encrypted with your encryption key—not plaintext. That means the Git repo contains encrypted credential blobs, which is what you want for a public or team-shared repo.

The Git push step uses n8n's built-in Git node or an HTTP request to the GitHub/GitLab API. A cron trigger fires the whole thing on whatever schedule you set—hourly for high-churn instances, daily for calmer ones. The queue-mode worker executes the export, so the editor stays responsive even when exporting hundreds of workflows. SQLite cannot run queue mode, which is why Postgres is non-negotiable here.

## How does n8n Git Backups compare against other workflow backup and versioning platforms

Most workflow backup options fall into three buckets: manual exports, DIY scripts, and managed cloud features. This template sits in the middle—automated like a script, but running inside the platform it's backing up, which gives it access to internal APIs that external scripts would need to authenticate against.

### n8n Git Backups vs manual n8n UI export (manual n8n UI export alternative)

Manual export wins on simplicity—it's built into the editor and requires zero setup. But it loses on consistency. The UI export grabs one workflow at a time, credentials are buried in a separate menu, and there's no scheduling. This template automates all of it, exports credentials alongside workflows, and produces a Git commit history that manual exports can't match. If you have two workflows and you remember to export them, manual is fine. If you have twenty, it isn't.

### n8n Git Backups vs GitHub Actions DIY scripts (GitHub Actions DIY scripts alternative)

A GitHub Actions script that hits the n8n API and commits the response is a solid approach. You get scheduled execution and Git history without running extra infrastructure. But the script lives outside n8n, which means it needs API tokens, network access to your instance, and someone who knows how to write and maintain it. This template keeps everything inside n8n—the schedule, the API calls, the Git push—so the backup pipeline is itself an n8n workflow you can inspect and modify in the same editor. GitHub Actions also can't easily back up credentials, because the credential export endpoint requires the encryption key context that an external script has to handle carefully.

### n8n Git B

## Similar templates

- [N8N Main + Worker](https://railway.com/deploy/n8n-main-worker) — Deploy and Host N8N with Inactive worker.
- [Evolution API with n8n](https://railway.com/deploy/evolution-api-with-n8n) — Automate WhatsApp workflows with Evolution API, n8n, and Postgres.
- [Postgres Backup](https://railway.com/deploy/postgres-s3-backups) — Cron-based PostgreSQL backup to bucket storage

Open this page in a browser: https://railway.com/deploy/n8n-git-backups
