n8n-gitops
A GitOps CLI tool for n8n Community Edition that brings version control and collaborative workflow development to n8n.
n8n is a fair-code workflow automation platform (like Zapier/Make.com but self-hosted) that connects 400+ services and apps. n8n-gitops adds the Git integration that's missing from the Community Edition.
Featuresβ
- π Mirror Mode Export: Always keeps local repository in perfect sync with n8n
- π¦ Code Externalization: Store Python/JavaScript code in separate files
- π Credential Documentation: Auto-generate documentation of workflow credential dependencies
- π·οΈ Git-Based Deployment: Deploy specific tags/branches/commits
- β Validation: Validate workflows and manifests before deployment
- π Active State Management: Control workflow activation via API endpoints
- π§Ή Clean Deployments: Replace workflows with clean state

Quick Startβ
# Install from PyPI
pip install n8n-gitops
# Or install with uv (faster)
uv pip install n8n-gitops
# Create project
n8n-gitops create-project my-n8n-project
cd my-n8n-project
# Configure authentication
cp .n8n-auth.example .n8n-auth
# Edit .n8n-auth with your credentials
# Export workflows
n8n-gitops export
# Commit to Git
git init
git add .
git commit -m "Initial export"
git tag v1.0.0
# Deploy
n8n-gitops deploy --git-ref v1.0.0
Core Guidesβ
- Getting Started - Installation and quick start
- Authentication - Configure API credentials
- Export - Mirror workflows from n8n
- Deployment - Deploy workflows to n8n
- Code Externalization - Store code in separate files
- Manifest File - Workflow configuration format
- n8n Enterprise Git Comparison - Decide between n8n-gitops and Enterprise Git
- Commands Reference - All CLI commands
- GitOps Principles - How n8n-gitops aligns with GitOps principles
Key Conceptsβ
Mirror Modeβ
Export always mirrors your n8n instance:
n8n-gitops export
- β Exports ALL workflows
- ποΈ Deletes local workflows not in n8n
- ποΈ Deletes orphaned script files
- π Updates manifest to match remote
Code Externalizationβ
Store code in separate files instead of inline JSON (controlled by externalize_code in n8n/manifests/workflows.yaml, default: true):
Workflow JSON:
{
"parameters": {
"pythonCode": "@@n8n-gitops:include scripts/my-workflow/process.py"
}
}
Script File:
def process(data):
return data.upper()
result = process(input)
Git-Based Deploymentβ
Deploy from any Git reference:
# Deploy from tag
n8n-gitops deploy --git-ref v1.0.0
# Deploy from branch
n8n-gitops deploy --git-ref main
# Deploy from commit
n8n-gitops deploy --git-ref abc123
Commandsβ
# Create project structure
n8n-gitops create-project <path>
# Export workflows (mirror mode)
n8n-gitops export
# Validate workflows
n8n-gitops validate [--strict]
# Deploy workflows
n8n-gitops deploy [--git-ref REF] [--dry-run] [--backup] [--prune]
# Rollback to previous version
n8n-gitops rollback --git-ref <ref>
See Commands Reference for complete documentation.
Example Workflowβ
# 1. Export from n8n
n8n-gitops export
# 2. Edit scripts
vim n8n/scripts/payment-processing/validate.py
# 3. Validate changes
n8n-gitops validate --strict
# 4. Commit to Git
git add .
git commit -m "Improve payment validation"
git tag v1.1.0
# 5. Deploy
n8n-gitops deploy --git-ref v1.1.0
Project Structureβ
my-n8n-project/
βββ n8n/
β βββ workflows/ # Workflow JSON files
β βββ scripts/ # Externalized code
β β βββ my-workflow/
β β βββ process.py
β β βββ transform.js
β βββ credentials.yaml # Credential documentation (auto-generated)
β βββ manifests/
β βββ workflows.yaml # Workflow manifest
β βββ env.schema.json # Environment schema
βββ .gitignore
βββ .n8n-auth.example # Auth config template
Developmentβ
# Clone the repository
git clone https://github.com/n8n-gitops/n8n-gitops.git
cd n8n-gitops
# Install with uv (recommended)
uv sync --dev
# Or with pip
pip install -e ".[dev]"
# Run tests
uv run pytest -v # with uv
# or
pytest -v # with pip
Requirementsβ
- Python 3.10+
- Git
- n8n instance with API access
Licenseβ
MIT
Contributingβ
Contributions are welcome! Please feel free to submit a Pull Request.