{
  "manifest_version": "1.0.0",
  "template": {
    "id": "23d09fc7-9307-4323-97f6-fb3cf65a4cb8",
    "slug": "unorouter",
    "name": "Unorouter",
    "description": "Self-hosted AI gateway + storefront. One key for 100+ AI providers.",
    "url": "https://railway.com/deploy/unorouter",
    "upstream": {
      "image": "ghcr.io/unorouter/unorouter:latest"
    }
  },
  "services": [
    {
      "name": "storefront",
      "source": {
        "image": "ghcr.io/unorouter/unorouter:latest"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": true
    },
    {
      "name": "gateway",
      "source": {
        "image": "ghcr.io/unorouter/new-api:latest"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "storefront",
      "description": "HTTP port the storefront listens on. Railway maps this to the service's public domain.",
      "secret": false,
      "strategy": "default",
      "default": "3000"
    },
    {
      "key": "HOSTNAME",
      "service": "storefront",
      "description": "Bind address. The distroless image reads this at runtime — keep 0.0.0.0 so Railway can reach the server.",
      "secret": false,
      "strategy": "default",
      "default": "0.0.0.0"
    },
    {
      "key": "SESSION_SECRET",
      "service": "storefront",
      "description": "REQUIRED — random string (min 32 chars) used to seal the storefront's iron-session cookies. Auto-generated.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "NEXT_PUBLIC_URL",
      "service": "storefront",
      "description": "Public origin of THIS storefront — used for absolute links, sitemap and canonical URLs, and cookie scoping. Auto-filled from the service's public domain.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "RAILWAY_RUN_UID",
      "service": "storefront",
      "description": "REQUIRED — run the container as root (uid 0). This is a distroless nonroot image (uid 65532) but Railway mounts the SQLite volume at /data root-owned, so a non-root process cannot create storefront.db and /api/ops/health reports db: fail. Setting 0 makes every fresh install boot cleanly.",
      "secret": false,
      "strategy": "default",
      "default": "0"
    },
    {
      "key": "INTERNAL_API_URL",
      "service": "storefront",
      "description": "Server-side routes proxy dashboard/billing/model calls to the gateway over Railway's private network. Auto-wired to the gateway service's private domain — do not edit.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "TURSO_DATABASE_URL",
      "service": "storefront",
      "description": "libSQL/SQLite file on the mounted volume that holds public model-tester rankings. Chat and per-device state live in the visitor's browser, not here.",
      "secret": false,
      "strategy": "default",
      "default": "file:/data/storefront.db"
    },
    {
      "key": "NEXT_PUBLIC_API_URL",
      "service": "storefront",
      "description": "Origin the browser bundle shows in API docs and uses for direct browser→gateway calls (OAuth buttons, token endpoints, chat rooms). Auto-filled from this service's public domain. The storefront's own /api/* proxy (which injects your gateway key) is served same-origin, so browser chat traffic never needs to reach the gateway directly.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "NEXT_PUBLIC_APP_NAME",
      "service": "storefront",
      "description": "Brand name shown in the header, titles and SEO metadata. Change to your own name.",
      "secret": false,
      "strategy": "default",
      "default": "UnoRouter"
    },
    {
      "key": "NEXT_PUBLIC_CARDS_URL",
      "service": "storefront",
      "description": "Origin of the gift-card store page. Auto-filled from this service's public domain.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "NEXT_PUBLIC_SUPPORT_EMAIL",
      "service": "storefront",
      "description": "Support contact shown in the footer and help links. Change to your own address.",
      "secret": false,
      "strategy": "default",
      "default": "support@example.com"
    },
    {
      "key": "TZ",
      "service": "gateway",
      "description": "Timezone for usage-log timestamps. Keep UTC so log filtering matches the dashboard.",
      "secret": false,
      "strategy": "default",
      "default": "UTC"
    },
    {
      "key": "PORT",
      "service": "gateway",
      "description": "HTTP port the gateway listens on. Railway maps this to the service's public domain.",
      "secret": false,
      "strategy": "default",
      "default": "3000"
    },
    {
      "key": "SESSION_SECRET",
      "service": "gateway",
      "description": "REQUIRED — random string used to sign gateway sessions and OAuth state. This placeholder auto-generates one. Changing it logs all users out.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "FRONTEND_BASE_URL",
      "service": "gateway",
      "description": "Absolute base used for callback and share URLs. Auto-filled from this service's public domain. On a single-replica deploy the gateway is the master node and serves its own bundled web UI, so this only matters if you add replicas.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "unorouter"
      }
    },
    "cli": "railway deploy --template unorouter",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "23d09fc7-9307-4323-97f6-fb3cf65a4cb8",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "0d90327c-eaa4-40be-a89c-f6443171fd2c": {
                  "icon": null,
                  "name": "storefront",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/api/ops/health",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/unorouter/unorouter:latest"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "HTTP port the storefront listens on. Railway maps this to the service's public domain.",
                      "defaultValue": "3000"
                    },
                    "HOSTNAME": {
                      "isOptional": false,
                      "description": "Bind address. The distroless image reads this at runtime — keep 0.0.0.0 so Railway can reach the server.",
                      "defaultValue": "0.0.0.0"
                    },
                    "SESSION_SECRET": {
                      "isOptional": false,
                      "description": "REQUIRED — random string (min 32 chars) used to seal the storefront's iron-session cookies. Auto-generated.",
                      "defaultValue": "{{SESSION_SECRET}}"
                    },
                    "NEXT_PUBLIC_URL": {
                      "isOptional": false,
                      "description": "Public origin of THIS storefront — used for absolute links, sitemap and canonical URLs, and cookie scoping. Auto-filled from the service's public domain.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "RAILWAY_RUN_UID": {
                      "description": "REQUIRED — run the container as root (uid 0). This is a distroless nonroot image (uid 65532) but Railway mounts the SQLite volume at /data root-owned, so a non-root process cannot create storefront.db and /api/ops/health reports db: fail. Setting 0 makes every fresh install boot cleanly.",
                      "defaultValue": "0"
                    },
                    "INTERNAL_API_URL": {
                      "isOptional": false,
                      "description": "Server-side routes proxy dashboard/billing/model calls to the gateway over Railway's private network. Auto-wired to the gateway service's private domain — do not edit.",
                      "defaultValue": "http://${{gateway.RAILWAY_PRIVATE_DOMAIN}}:3000"
                    },
                    "TURSO_DATABASE_URL": {
                      "isOptional": false,
                      "description": "libSQL/SQLite file on the mounted volume that holds public model-tester rankings. Chat and per-device state live in the visitor's browser, not here.",
                      "defaultValue": "file:/data/storefront.db"
                    },
                    "NEXT_PUBLIC_API_URL": {
                      "description": "Origin the browser bundle shows in API docs and uses for direct browser→gateway calls (OAuth buttons, token endpoints, chat rooms). Auto-filled from this service's public domain. The storefront's own /api/* proxy (which injects your gateway key) is served same-origin, so browser chat traffic never needs to reach the gateway directly.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "NEXT_PUBLIC_APP_NAME": {
                      "description": "Brand name shown in the header, titles and SEO metadata. Change to your own name.",
                      "defaultValue": "UnoRouter"
                    },
                    "NEXT_PUBLIC_CARDS_URL": {
                      "description": "Origin of the gift-card store page. Auto-filled from this service's public domain.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "NEXT_PUBLIC_SUPPORT_EMAIL": {
                      "description": "Support contact shown in the footer and help links. Change to your own address.",
                      "defaultValue": "support@example.com"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:3000": {
                        "port": 3000
                      }
                    }
                  },
                  "volumeMounts": {
                    "0d90327c-eaa4-40be-a89c-f6443171fd2c": {
                      "mountPath": "/data"
                    }
                  }
                },
                "520d61ce-6508-4d4e-8eb8-ebd8491a7eb0": {
                  "icon": null,
                  "name": "gateway",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/api/status",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/unorouter/new-api:latest"
                  },
                  "variables": {
                    "TZ": {
                      "isOptional": false,
                      "description": "Timezone for usage-log timestamps. Keep UTC so log filtering matches the dashboard.",
                      "defaultValue": "UTC"
                    },
                    "PORT": {
                      "isOptional": false,
                      "description": "HTTP port the gateway listens on. Railway maps this to the service's public domain.",
                      "defaultValue": "3000"
                    },
                    "SQL_DSN": {
                      "isOptional": true,
                      "description": "Optional — external MySQL/PostgreSQL connection string. Leave empty to use the bundled SQLite database on the mounted volume (recommended for Railway: zero config).",
                      "defaultValue": ""
                    },
                    "SESSION_SECRET": {
                      "isOptional": false,
                      "description": "REQUIRED — random string used to sign gateway sessions and OAuth state. This placeholder auto-generates one. Changing it logs all users out.",
                      "defaultValue": "{{SESSION_SECRET}}"
                    },
                    "FRONTEND_BASE_URL": {
                      "isOptional": false,
                      "description": "Absolute base used for callback and share URLs. Auto-filled from this service's public domain. On a single-replica deploy the gateway is the master node and serves its own bundled web UI, so this only matters if you add replicas.",
                      "defaultValue": "https://${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "REDIS_CONN_STRING": {
                      "isOptional": true,
                      "description": "Optional — Redis connection string (redis://:password@host:6379) for multi-node caching. Leave empty on a single-replica deploy; the in-memory cache is used instead.",
                      "defaultValue": ""
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:3000": {
                        "port": 3000
                      }
                    }
                  },
                  "volumeMounts": {
                    "520d61ce-6508-4d4e-8eb8-ebd8491a7eb0": {
                      "mountPath": "/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "storefront",
      "method": "GET",
      "path": "/api/ops/health",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-17T10:14:36.166Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-17T08:26:10.312Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_b57379790e2548e792da",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 38,
    "typical_build_seconds": 0,
    "typical_start_seconds": 10,
    "slowest_service": "storefront"
  }
}
