{
  "$schema": "../_schema/adapter.schema.json",
  "name": "railway",
  "description": "Railway-hosted services. Push-to-main auto-deploy; production URL from a repo secret; deploys verified by curling the URL until it responds 2xx/3xx.",
  "deploy_trigger": "push_to_main",
  "production_url_from": "secret",
  "production_url_secret_key": "production_url_secret",
  "wait_for_deploy": "for i in $(seq 1 30); do HTTP_CODE=$(curl -s -o /dev/null -w \"%{http_code}\" \"${PROD_URL}/\" || echo \"000\"); if [ \"$HTTP_CODE\" -ge 200 ] && [ \"$HTTP_CODE\" -lt 400 ]; then echo \"Production is up (HTTP ${HTTP_CODE})\"; break; fi; echo \"Attempt ${i}/30: HTTP ${HTTP_CODE} — waiting 10s...\"; sleep 10; done",
  "required_secrets": [
    "DEVAUDIT_API_KEY"
  ],
  "config_keys": {
    "required": [
      "production_url_secret",
      "runner"
    ],
    "optional": [
      "database_service",
      "database_image",
      "database_port",
      "database_env"
    ],
    "defaults": {
      "runner": "ubuntu-latest"
    }
  },
  "runtime_contract": {
    "preferred_web_runtime": "compiled JavaScript or framework standalone output",
    "forbid_typescript_runtime": true,
    "prefer_standalone_output": true,
    "scheduler_placement": "scheduled and background jobs should run in a separate worker, cron, or function rather than inside the long-lived web process"
  },
  "notes": [
    "Railway auto-deploys on push to main; no explicit deploy step needed in CI.",
    "Production URL is set as a repo secret (name configured per-project via production_url_secret in sdlc-config.json).",
    "Test-time database services are declared per-project (database_service, database_image, database_port, database_env) so CI can spin up a matching container alongside the app container.",
    "For long-lived production web services on Railway, do not run tsx/ts-node in production; use compiled JS or a framework's standalone runtime output."
  ]
}
