{
  "manifest_version": "1.0.0",
  "template": {
    "id": "29ee6a02-abf3-4e83-ab14-2b9dd81fd070",
    "slug": "magpie-ai-gateway",
    "name": "Magpie AI Gateway",
    "description": "Magpie AI gateway + Web UI, one HTTPS domain and persistent storage",
    "url": "https://railway.com/deploy/magpie-ai-gateway",
    "upstream": {
      "repo_url": "https://github.com/norberia/magpie-railway"
    }
  },
  "services": [
    {
      "name": "magpie-railway",
      "source": {
        "repo": "https://github.com/norberia/magpie-railway"
      },
      "needs_volume": true,
      "volume_mount_path": "/config",
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "magpie-railway",
      "description": "Public HTTP port for the Railway adapter. Keep the default 8080.",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "MAGPIE_ADDR",
      "service": "magpie-railway",
      "description": "Internal Magpie gateway listening address. Keep 0.0.0.0:3425.",
      "secret": false,
      "strategy": "default",
      "default": "0.0.0.0:3425"
    },
    {
      "key": "MAGPIE_WEB_KEY",
      "service": "magpie-railway",
      "description": "Automatically generated management key. After deployment, read this value in Railway Variables and open https://YOUR-DOMAIN/?k=YOUR-WEB-KEY. Keep it private. Model API clients use separate Gateway Keys.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "MAGPIE_WEB_URL",
      "service": "magpie-railway",
      "description": "Public HTTPS address of the management UI, derived automatically from the Railway domain.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "RAILWAY_RUN_UID",
      "service": "magpie-railway",
      "description": "Run as UID 0 so Magpie can write to the root-owned Railway Volume mounted at /config. Keep the default.",
      "secret": false,
      "strategy": "default",
      "default": "0"
    },
    {
      "key": "MAGPIE_PUBLIC_URL",
      "service": "magpie-railway",
      "description": "Public gateway base URL, derived automatically from the Railway domain with /gateway appended. OpenAI clients append /v1.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "magpie-ai-gateway"
      }
    },
    "cli": "railway deploy --template magpie-ai-gateway",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "29ee6a02-abf3-4e83-ab14-2b9dd81fd070",
            "serializedConfig": {
              "services": {
                "ec9e5b96-e3d7-40b9-b7f4-2f68165d2e9d": {
                  "name": "magpie-railway",
                  "deploy": {
                    "healthcheckPath": "/healthz",
                    "restartPolicyMaxRetries": 5
                  },
                  "source": {
                    "repo": "norberia/magpie-railway"
                  },
                  "variables": {
                    "PORT": {
                      "description": "Public HTTP port for the Railway adapter. Keep the default 8080.",
                      "defaultValue": "8080"
                    },
                    "MAGPIE_ADDR": {
                      "description": "Internal Magpie gateway listening address. Keep 0.0.0.0:3425.",
                      "defaultValue": "0.0.0.0:3425"
                    },
                    "MAGPIE_WEB_KEY": {
                      "description": "Automatically generated management key. After deployment, read this value in Railway Variables and open https://YOUR-DOMAIN/?k=YOUR-WEB-KEY. Keep it private. Model API clients use separate Gateway Keys.",
                      "defaultValue": "{{MAGPIE_WEB_KEY}}"
                    },
                    "MAGPIE_WEB_URL": {
                      "description": "Public HTTPS address of the management UI, derived automatically from the Railway domain.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "RAILWAY_RUN_UID": {
                      "description": "Run as UID 0 so Magpie can write to the root-owned Railway Volume mounted at /config. Keep the default.",
                      "defaultValue": "0"
                    },
                    "MAGPIE_PUBLIC_URL": {
                      "description": "Public gateway base URL, derived automatically from the Railway domain with /gateway appended. OpenAI clients append /v1.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}/gateway"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:8080": {
                        "port": 8080
                      }
                    }
                  },
                  "volumeMounts": {
                    "ec9e5b96-e3d7-40b9-b7f4-2f68165d2e9d": {
                      "mountPath": "/config"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "magpie-railway",
      "method": "GET",
      "path": "/healthz",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 1,
    "needs_volume": true
  },
  "generated_at": "2026-10-12T04:14:37.344Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-10-12T03:35:12.768Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_70f8ee2f69854f53a56f",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 109,
    "typical_build_seconds": 30,
    "typical_start_seconds": 0,
    "slowest_service": "magpie-railway"
  }
}
