Skip to main content

n8n-sync

PyPI version Python License: MIT Tests

Git-friendly version control for n8n Community Edition workflows.

n8n Enterprise has Source Control at €667/mo. Community Edition has nothing. n8n-sync fills that gap — a CLI that makes your n8n workflows first-class Git citizens.

Quick start

pip install n8n-sync
n8n-sync init          # configure your n8n instance
n8n-sync pull          # export workflows to normalized files
git add workflows && git commit -m "snapshot"
n8n-sync diff --check  # CI-ready: exits 1 on drift, 0 if in-sync
n8n-sync push --dry-run  # preview changes before applying
n8n-sync push            # apply changes to remote

Commands

Command Description
n8n-sync init Interactive setup — creates .n8n-sync.yml config
n8n-sync pull Export all workflows to normalized JSON files
n8n-sync push Create/update workflows on remote instance
n8n-sync diff Show semantic differences between local and remote
n8n-sync status List all workflows with drift detection

Key flags

  • --dry-run — preview push without writing
  • --check — exit 1 on drift (CI-friendly), 0 if in-sync, 2 on error
  • --instance <name> — target a specific configured instance
  • --config <path> — use a custom config file

Why n8n-sync?

Without version control, self-hosted n8n workflows are a black box:

  • ❌ No history of changes
  • ❌ No way to review modifications before they go live
  • ❌ No CI/CD integration
  • ❌ Credentials break when copying between instances
  • ❌ Cannot rollback a broken workflow

n8n-sync fixes all of this:

  • ✅ Readable Git diffs — YAML frontmatter + sorted JSON
  • ✅ Credential mapping — staging → production without manual fixes
  • ✅ CI integration — diff --check exits 1 on drift
  • ✅ Drift detection — know instantly if someone changed a workflow in the UI
  • ✅ Dry-run push — preview before applying
  • ✅ No Enterprise required — works with any Community Edition instance

Configuration

Create .n8n-sync.yml in your project root:

instances:
  staging:
    url: https://n8n-staging.example.com
    api_key: ${N8N_STAGING_KEY}
  production:
    url: https://n8n.example.com
    api_key: ${N8N_PRODUCTION_KEY}
    credentials:
      "Staging DB": "Production DB"
      "Staging API": "Production API"

workflows_dir: workflows

API keys use ${ENV_VAR} placeholders — never commit literal keys. Set environment variables:

export N8N_STAGING_KEY='your-staging-api-key'
export N8N_PRODUCTION_KEY='your-production-api-key'

CI/CD integration

Use diff --check in your pipeline to catch drift:

# .github/workflows/n8n-drift.yml
name: n8n workflow drift check
on: [push, pull_request]
jobs:
  drift:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: pip install n8n-sync
      - run: n8n-sync diff --instance production --check
        env:
          N8N_PRODUCTION_KEY: ${{ secrets.N8N_PRODUCTION_KEY }}

Workflow file format

Files use YAML frontmatter + normalized JSON for readable diffs:

---
name: Send Daily Report
active: true
tags: [reporting, daily]
lastModified: "2024-10-18T12:00:00.000Z"
---
{
  "nodes": [...],
  "connections": {...},
  "settings": {}
}

Node IDs, workflow IDs, and credential IDs are stripped. Credential names are preserved for mapping. JSON keys and nodes are sorted for stable diffs.

Requirements

  • Python 3.10+
  • n8n Community Edition with API enabled
  • n8n API key with workflow read/write permissions

Install

pip install n8n-sync

For development:

git clone https://github.com/badwalx/n8n-sync.git
cd n8n-sync
pip install -e '.[dev]'
pytest

License

MIT — see LICENSE.

Metadata

Release files for n8n-sync 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for n8n-sync 0.1.1
File Size Uploaded
n8n_sync-0.1.1.tar.gz 16.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for n8n-sync 0.1.1
File Interpreter ABI Platform
n8n_sync-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.3 kB

Release files / n8n_sync-0.1.1.tar.gz

Download URL n8n_sync-0.1.1.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
061082fc1d5fd23c17ad0d39b6c06372ac9b7634c1285e82c029b1d151c56846
BLAKE2b-256 checksum
How to use checksums
4c048160f92e10adb0029f62e13063abcff34ab2402fcba7e2101ef72a0c621c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / n8n_sync-0.1.1-py3-none-any.whl

Download URL n8n_sync-0.1.1-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66c62d8dc172dcea154e064c5651148bbdfee6d970c654d0f52f3c2e806b104f
BLAKE2b-256 checksum
How to use checksums
5e019ee905311f32b47aa5a3e6120dba2493fdb4b8033383c36dadbcda319424
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release history Release notifications | RSS feed

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page