{
  "manifest_version": "1.0.0",
  "template": {
    "id": "940691d5-6bc8-4992-8f1f-bca833d53920",
    "slug": "n8n-5",
    "name": "N8N",
    "description": "Deploy n8n with Postgres.",
    "url": "https://railway.com/deploy/n8n-5",
    "upstream": {
      "image": "n8nio/n8n:2.40.7"
    }
  },
  "services": [
    {
      "name": "Postgres",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    },
    {
      "name": "n8n",
      "source": {
        "image": "n8nio/n8n:2.40.7"
      },
      "needs_volume": true,
      "volume_mount_path": "/home/node/.n8n",
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Location where the database will be initialized.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Private hostname n8n connects to.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Port to connect to Postgres.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "Required by the Data panel.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "Required by the Data panel.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Required by the Data panel.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Database n8n stores workflows, credentials and executions in.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "Private connection string, for other services you add later.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "User to connect to Postgres.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "SSL certificate expiry in days.",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Password to connect to Postgres. Generated per deploy.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Lets Postgres shut down cleanly on redeploy.",
      "secret": false,
      "strategy": "default",
      "default": "60"
    },
    {
      "key": "PORT",
      "service": "n8n",
      "description": "Port n8n listens on. Railway's healthcheck and domain use it.",
      "secret": false,
      "strategy": "default",
      "default": "5678"
    },
    {
      "key": "DB_TYPE",
      "service": "n8n",
      "description": "Stores everything in Postgres instead of SQLite.",
      "secret": false,
      "strategy": "default",
      "default": "postgresdb"
    },
    {
      "key": "N8N_PROXY_HOPS",
      "service": "n8n",
      "description": "Proxy hops in front of n8n (Railway's edge adds two), so rate limits see real client IPs.",
      "secret": false,
      "strategy": "default",
      "default": "2"
    },
    {
      "key": "N8N_WEBHOOK_URL",
      "service": "n8n",
      "description": "Public base URL shown for webhook, form and MCP trigger URLs.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "RAILWAY_RUN_UID",
      "service": "n8n",
      "description": "Starts as root to chown the volume; n8n itself then runs as the node user.",
      "secret": false,
      "strategy": "default",
      "default": "0"
    },
    {
      "key": "GENERIC_TIMEZONE",
      "service": "n8n",
      "description": "Timezone for Schedule triggers and dates, e.g. Europe/Berlin.",
      "secret": false,
      "strategy": "default",
      "default": "UTC"
    },
    {
      "key": "DB_POSTGRESDB_HOST",
      "service": "n8n",
      "description": "Postgres host on the private network.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DB_POSTGRESDB_PORT",
      "service": "n8n",
      "description": "Postgres port.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DB_POSTGRESDB_USER",
      "service": "n8n",
      "description": "Postgres user.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "N8N_ENCRYPTION_KEY",
      "service": "n8n",
      "description": "Encrypts stored credentials. Generated per deploy; back it up.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "N8N_EDITOR_BASE_URL",
      "service": "n8n",
      "description": "Public URL of the editor, used in links, emails and OAuth redirects.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "DB_POSTGRESDB_DATABASE",
      "service": "n8n",
      "description": "Postgres database name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DB_POSTGRESDB_PASSWORD",
      "service": "n8n",
      "description": "Postgres password.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "EXECUTIONS_DATA_MAX_AGE",
      "service": "n8n",
      "description": "Hours to keep execution history before pruning (336 = 14 days).",
      "secret": false,
      "strategy": "default",
      "default": "336"
    },
    {
      "key": "EXECUTIONS_DATA_PRUNE_MAX_COUNT",
      "service": "n8n",
      "description": "Most executions to keep in history. 0 means no limit.",
      "secret": false,
      "strategy": "default",
      "default": "10000"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "n8n-5"
      }
    },
    "cli": "railway deploy --template n8n-5",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "940691d5-6bc8-4992-8f1f-bca833d53920",
            "serializedConfig": {
              "services": {
                "7304833b-1704-4cbf-9877-590c520d076e": {
                  "icon": "https://devicons.railway.com/i/postgresql.svg",
                  "name": "Postgres",
                  "deploy": {
                    "requiredMountPath": "/var/lib/postgresql/data"
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Location where the database will be initialized.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Private hostname n8n connects to.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Port to connect to Postgres.",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Required by the Data panel.",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Required by the Data panel.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Required by the Data panel.",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Database n8n stores workflows, credentials and executions in.",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Private connection string, for other services you add later.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "User to connect to Postgres.",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": true,
                      "description": "SSL certificate expiry in days.",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Password to connect to Postgres. Generated per deploy.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Lets Postgres shut down cleanly on redeploy.",
                      "defaultValue": "60"
                    }
                  },
                  "networking": {
                    "tcpProxies": {},
                    "serviceDomains": {}
                  },
                  "volumeMounts": {
                    "7304833b-1704-4cbf-9877-590c520d076e": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "f7a2ae76-7b6f-4380-a983-162ed6719b8f": {
                  "icon": "https://devicons.railway.com/i/n8n.svg",
                  "name": "n8n",
                  "deploy": {
                    "startCommand": "sh -c 'test \"$(stat -c %U /home/node/.n8n)\" = node || chown -R node:node /home/node/.n8n; export HOME=/home/node; exec su -p -s /bin/sh node -c \"exec /sbin/tini -- /docker-entrypoint.sh\"'",
                    "healthcheckPath": "/healthz/readiness",
                    "healthcheckTimeout": 600
                  },
                  "source": {
                    "image": "n8nio/n8n:2.40.7"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Port n8n listens on. Railway's healthcheck and domain use it.",
                      "defaultValue": "5678"
                    },
                    "DB_TYPE": {
                      "isOptional": false,
                      "description": "Stores everything in Postgres instead of SQLite.",
                      "defaultValue": "postgresdb"
                    },
                    "N8N_PROXY_HOPS": {
                      "isOptional": false,
                      "description": "Proxy hops in front of n8n (Railway's edge adds two), so rate limits see real client IPs.",
                      "defaultValue": "2"
                    },
                    "N8N_WEBHOOK_URL": {
                      "isOptional": false,
                      "description": "Public base URL shown for webhook, form and MCP trigger URLs.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "RAILWAY_RUN_UID": {
                      "isOptional": false,
                      "description": "Starts as root to chown the volume; n8n itself then runs as the node user.",
                      "defaultValue": "0"
                    },
                    "GENERIC_TIMEZONE": {
                      "isOptional": false,
                      "description": "Timezone for Schedule triggers and dates, e.g. Europe/Berlin.",
                      "defaultValue": "UTC"
                    },
                    "DB_POSTGRESDB_HOST": {
                      "isOptional": false,
                      "description": "Postgres host on the private network.",
                      "defaultValue": "${{Postgres.PGHOST}}"
                    },
                    "DB_POSTGRESDB_PORT": {
                      "isOptional": false,
                      "description": "Postgres port.",
                      "defaultValue": "${{Postgres.PGPORT}}"
                    },
                    "DB_POSTGRESDB_USER": {
                      "isOptional": false,
                      "description": "Postgres user.",
                      "defaultValue": "${{Postgres.PGUSER}}"
                    },
                    "N8N_ENCRYPTION_KEY": {
                      "isOptional": false,
                      "description": "Encrypts stored credentials. Generated per deploy; back it up.",
                      "defaultValue": "{{N8N_ENCRYPTION_KEY}}"
                    },
                    "N8N_EDITOR_BASE_URL": {
                      "isOptional": false,
                      "description": "Public URL of the editor, used in links, emails and OAuth redirects.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "DB_POSTGRESDB_DATABASE": {
                      "isOptional": false,
                      "description": "Postgres database name.",
                      "defaultValue": "${{Postgres.PGDATABASE}}"
                    },
                    "DB_POSTGRESDB_PASSWORD": {
                      "isOptional": false,
                      "description": "Postgres password.",
                      "defaultValue": "${{Postgres.PGPASSWORD}}"
                    },
                    "EXECUTIONS_DATA_MAX_AGE": {
                      "isOptional": false,
                      "description": "Hours to keep execution history before pruning (336 = 14 days).",
                      "defaultValue": "336"
                    },
                    "EXECUTIONS_DATA_PRUNE_MAX_COUNT": {
                      "isOptional": false,
                      "description": "Most executions to keep in history. 0 means no limit.",
                      "defaultValue": "10000"
                    }
                  },
                  "networking": {
                    "tcpProxies": {},
                    "serviceDomains": {
                      "<hasDomain>": {
                        "port": 5678
                      }
                    }
                  },
                  "volumeMounts": {
                    "f7a2ae76-7b6f-4380-a983-162ed6719b8f": {
                      "mountPath": "/home/node/.n8n"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "n8n",
      "method": "GET",
      "path": "/healthz/readiness",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-25T16:14:54.488Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-25T12:44:38.545Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_e18a4b67e36147ccae62",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 101,
    "typical_build_seconds": 0,
    "typical_start_seconds": 42,
    "slowest_service": "n8n"
  }
}
