{
  "manifest_version": "1.0.0",
  "template": {
    "id": "9f1eb458-7928-468c-9450-2c9b64c376bf",
    "slug": "factorio",
    "name": "Factorio",
    "description": "Self-hosted Factorio server — persistent saves, RCON, playit.gg UDP tunnel",
    "url": "https://railway.com/deploy/factorio",
    "upstream": {
      "repo_url": "https://github.com/INAPP-Mobile/factorio"
    }
  },
  "services": [
    {
      "name": "factorio",
      "source": {
        "repo": "https://github.com/INAPP-Mobile/factorio"
      },
      "needs_volume": true,
      "volume_mount_path": "/factorio",
      "http": true
    },
    {
      "name": "playit",
      "source": {
        "image": "ghcr.io/playit-cloud/playit-agent:1.0.8"
      },
      "needs_volume": false,
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "LOAD_LATEST_SAVE",
      "service": "factorio",
      "description": "If true (default), the server loads the most recent save in /factorio/saves. Set to false to require an explicit SAVE_NAME.",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "GENERATE_NEW_SAVE",
      "service": "factorio",
      "description": "If true, creates a new save named after SAVE_NAME on boot. Requires SAVE_NAME to be set. The new save persists in the volume.",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "UPDATE_MODS_ON_START",
      "service": "factorio",
      "description": "If true, runs docker-update-mods.sh on every boot to re-download mod versions listed in /factorio/mods/mod-list.json.",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "SECRET_KEY",
      "service": "playit",
      "description": "REQUIRED. Playit.gg agent secret key. Create a free account at playit.gg, then Account → Agents → Add Agent → copy the secret key. After deploy, configure the tunnel in the playit.gg dashboard: type UDP, local address factorio.railway.internal, local port 8080.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "factorio"
      }
    },
    "cli": "railway deploy --template factorio",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "9f1eb458-7928-468c-9450-2c9b64c376bf",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "89974f53-7d23-4819-baa4-3e09bd789e86": {
                  "icon": null,
                  "name": "factorio",
                  "deploy": {
                    "startCommand": "/usr/local/bin/railway-entrypoint.sh",
                    "healthcheckPath": "/",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "repo": "https://github.com/INAPP-Mobile/factorio",
                    "rootDirectory": null
                  },
                  "variables": {
                    "SAVE_NAME": {
                      "isOptional": true,
                      "description": "Specific save to load (without .zip). Empty = most recent save (when LOAD_LATEST_SAVE=true) or server refuses to start (when LOAD_LATEST_SAVE=false).",
                      "defaultValue": ""
                    },
                    "LOAD_LATEST_SAVE": {
                      "isOptional": false,
                      "description": "If true (default), the server loads the most recent save in /factorio/saves. Set to false to require an explicit SAVE_NAME.",
                      "defaultValue": "true"
                    },
                    "GENERATE_NEW_SAVE": {
                      "isOptional": false,
                      "description": "If true, creates a new save named after SAVE_NAME on boot. Requires SAVE_NAME to be set. The new save persists in the volume.",
                      "defaultValue": "false"
                    },
                    "UPDATE_MODS_ON_START": {
                      "isOptional": false,
                      "description": "If true, runs docker-update-mods.sh on every boot to re-download mod versions listed in /factorio/mods/mod-list.json.",
                      "defaultValue": "false"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:8080": {
                        "port": 8080
                      }
                    }
                  },
                  "volumeMounts": {
                    "89974f53-7d23-4819-baa4-3e09bd789e86": {
                      "mountPath": "/factorio"
                    }
                  }
                },
                "bb502d1c-b5e2-4e72-aeeb-a6409e5bec14": {
                  "name": "playit",
                  "source": {
                    "image": "ghcr.io/playit-cloud/playit-agent:1.0.8"
                  },
                  "variables": {
                    "SECRET_KEY": {
                      "description": "REQUIRED. Playit.gg agent secret key. Create a free account at playit.gg, then Account → Agents → Add Agent → copy the secret key. After deploy, configure the tunnel in the playit.gg dashboard: type UDP, local address factorio.railway.internal, local port 8080.",
                      "defaultValue": "{{SECRET_KEY}}"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "factorio",
      "method": "GET",
      "path": "/",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-24T04:14:44.625Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-22T07:27:34.613Z",
  "success_rate_30d": 0.8571,
  "validation": {
    "last_run_id": "run_ee1c0d68f7224b67ba41",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 129,
    "typical_build_seconds": 26,
    "typical_start_seconds": 10,
    "slowest_service": "factorio"
  }
}
