{
  "manifest_version": "1.0.0",
  "template": {
    "id": "0f11ec4e-73ab-4a9b-ac58-2c43d2f56adf",
    "slug": "spicedb-relationship-authorization",
    "name": "SpiceDB relationship authorization",
    "description": "Durable relationship-based authorization with PostgreSQL.",
    "url": "https://railway.com/deploy/spicedb-relationship-authorization",
    "upstream": {
      "image": "caddy:2.11.4-alpine@sha256:5f5c8640aae01df9654968d946d8f1a56c497f1dd5c5cda4cf95ab7c14d58648"
    }
  },
  "status": "unvalidated",
  "validated_at": null,
  "success_rate_30d": null,
  "services": [
    {
      "name": "SpiceDB Gateway",
      "source": {
        "image": "caddy:2.11.4-alpine@sha256:5f5c8640aae01df9654968d946d8f1a56c497f1dd5c5cda4cf95ab7c14d58648"
      },
      "needs_volume": false,
      "http": true
    },
    {
      "name": "SpiceDB",
      "source": {
        "image": "authzed/spicedb:v1.56.0-debug@sha256:e88fb064b4301ca058ebb83f11f7250d58f411635bf476b6196941c297bb1470"
      },
      "needs_volume": false,
      "http": false
    },
    {
      "name": "Postgres",
      "source": {
        "image": "postgres:16-alpine@sha256:57c72fd2a128e416c7fcc499958864df5301e940bca0a56f58fddf30ffc07777"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "SpiceDB Gateway",
      "description": "Provide a value for PORT.",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "UPSTREAM",
      "service": "SpiceDB Gateway",
      "description": "Private SpiceDB REST endpoint.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "SPICEDB_KEY",
      "service": "SpiceDB Gateway",
      "description": "Private key used only by the dependency-aware health probe.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "GATEWAY_CONFIG",
      "service": "SpiceDB Gateway",
      "description": "Caddy REST proxy and database-aware health-check configuration.",
      "secret": false,
      "strategy": "default",
      "default": ":8080 {\n  handle /healthz {\n    method POST\n    rewrite * /v1/schema/read\n    reverse_proxy http://__UPSTREAM__ {\n      header_up Authorization \"Bearer __SPICEDB_KEY__\"\n      header_up Content-Type \"application/json\"\n      @healthy status 200 404\n      handle_response @healthy {\n        respond \"OK\" 200\n      }\n    }\n  }\n  handle {\n    reverse_proxy http://__UPSTREAM__\n  }\n}"
    },
    {
      "key": "PORT",
      "service": "SpiceDB",
      "description": "Provide a value for PORT.",
      "secret": false,
      "strategy": "default",
      "default": "8443"
    },
    {
      "key": "SPICEDB_HTTP_ADDR",
      "service": "SpiceDB",
      "description": "Provide a value for SPICEDB_HTTP_ADDR.",
      "secret": false,
      "strategy": "default",
      "default": ":8443"
    },
    {
      "key": "SPICEDB_HTTP_ENABLED",
      "service": "SpiceDB",
      "description": "Enables the REST gateway on port 8443.",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "SPICEDB_DATASTORE_ENGINE",
      "service": "SpiceDB",
      "description": "Provide a value for SPICEDB_DATASTORE_ENGINE.",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SPICEDB_DATASTORE_CONN_URI",
      "service": "SpiceDB",
      "description": "Private PostgreSQL connection used by migrations and SpiceDB.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "SPICEDB_GRPC_PRESHARED_KEY",
      "service": "SpiceDB",
      "description": "Generated administrator bearer key for REST and gRPC clients.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "SPICEDB_SKIP_RELEASE_CHECK",
      "service": "SpiceDB",
      "description": "Provide a value for SPICEDB_SKIP_RELEASE_CHECK.",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "SPICEDB_TELEMETRY_ENDPOINT",
      "service": "SpiceDB",
      "description": "Empty by default to disable upstream telemetry.",
      "secret": false,
      "strategy": "ask_user"
    },
    {
      "key": "SPICEDB_DATASTORE_CONN_POOL_READ_MAX_OPEN",
      "service": "SpiceDB",
      "description": "Provide a value for SPICEDB_DATASTORE_CONN_POOL_READ_MAX_OPEN.",
      "secret": false,
      "strategy": "default",
      "default": "10"
    },
    {
      "key": "SPICEDB_DATASTORE_CONN_POOL_READ_MIN_OPEN",
      "service": "SpiceDB",
      "description": "Provide a value for SPICEDB_DATASTORE_CONN_POOL_READ_MIN_OPEN.",
      "secret": false,
      "strategy": "default",
      "default": "2"
    },
    {
      "key": "SPICEDB_DATASTORE_CONN_POOL_WRITE_MAX_OPEN",
      "service": "SpiceDB",
      "description": "Provide a value for SPICEDB_DATASTORE_CONN_POOL_WRITE_MAX_OPEN.",
      "secret": false,
      "strategy": "default",
      "default": "5"
    },
    {
      "key": "SPICEDB_DATASTORE_CONN_POOL_WRITE_MIN_OPEN",
      "service": "SpiceDB",
      "description": "Provide a value for SPICEDB_DATASTORE_CONN_POOL_WRITE_MIN_OPEN.",
      "secret": false,
      "strategy": "default",
      "default": "2"
    },
    {
      "key": "PORT",
      "service": "Postgres",
      "description": "Provide a value for PORT.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Database subdirectory inside the Railway volume.",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Provide a value for POSTGRES_DB.",
      "secret": false,
      "strategy": "default",
      "default": "spicedb"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "Provide a value for POSTGRES_USER.",
      "secret": false,
      "strategy": "default",
      "default": "spicedb"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Generated PostgreSQL password.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "POSTGRES_INITDB_ARGS",
      "service": "Postgres",
      "description": "Enables commit timestamps for the SpiceDB Watch API.",
      "secret": false,
      "strategy": "default",
      "default": "-c track_commit_timestamp=on"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "spicedb-relationship-authorization"
      }
    },
    "cli": "railway deploy --template spicedb-relationship-authorization",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "0f11ec4e-73ab-4a9b-ac58-2c43d2f56adf",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "26dfc035-d387-425e-816f-fd54f6d11ea5": {
                  "icon": null,
                  "name": "SpiceDB Gateway",
                  "deploy": {
                    "startCommand": "/bin/sh -ec 'printf \"%s\\n\" \"$GATEWAY_CONFIG\" | sed -e \"s|__UPSTREAM__|$UPSTREAM|g\" -e \"s|__SPICEDB_KEY__|$SPICEDB_KEY|g\" >/tmp/Caddyfile; exec caddy run --config /tmp/Caddyfile --adapter caddyfile'",
                    "healthcheckPath": "/healthz",
                    "preDeployCommand": null,
                    "restartPolicyType": "ON_FAILURE",
                    "healthcheckTimeout": 300,
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "caddy:2.11.4-alpine@sha256:5f5c8640aae01df9654968d946d8f1a56c497f1dd5c5cda4cf95ab7c14d58648"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "8080"
                    },
                    "UPSTREAM": {
                      "isOptional": false,
                      "description": "Private SpiceDB REST endpoint.",
                      "defaultValue": "${{SpiceDB.RAILWAY_PRIVATE_DOMAIN}}:8443"
                    },
                    "SPICEDB_KEY": {
                      "isOptional": false,
                      "description": "Private key used only by the dependency-aware health probe.",
                      "defaultValue": "${{SpiceDB.SPICEDB_GRPC_PRESHARED_KEY}}"
                    },
                    "GATEWAY_CONFIG": {
                      "isOptional": false,
                      "description": "Caddy REST proxy and database-aware health-check configuration.",
                      "defaultValue": ":8080 {\n  handle /healthz {\n    method POST\n    rewrite * /v1/schema/read\n    reverse_proxy http://__UPSTREAM__ {\n      header_up Authorization \"Bearer __SPICEDB_KEY__\"\n      header_up Content-Type \"application/json\"\n      @healthy status 200 404\n      handle_response @healthy {\n        respond \"OK\" 200\n      }\n    }\n  }\n  handle {\n    reverse_proxy http://__UPSTREAM__\n  }\n}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {
                        "port": 8080
                      }
                    }
                  }
                },
                "312031cd-05d8-46b6-9cee-79e168b843c3": {
                  "icon": null,
                  "name": "SpiceDB",
                  "deploy": {
                    "startCommand": "spicedb serve",
                    "healthcheckPath": null,
                    "preDeployCommand": [
                      "spicedb datastore migrate head"
                    ],
                    "restartPolicyType": "ON_FAILURE",
                    "healthcheckTimeout": null,
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "authzed/spicedb:v1.56.0-debug@sha256:e88fb064b4301ca058ebb83f11f7250d58f411635bf476b6196941c297bb1470"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "8443"
                    },
                    "SPICEDB_HTTP_ADDR": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": ":8443"
                    },
                    "SPICEDB_HTTP_ENABLED": {
                      "isOptional": false,
                      "description": "Enables the REST gateway on port 8443.",
                      "defaultValue": "true"
                    },
                    "SPICEDB_DATASTORE_ENGINE": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "postgres"
                    },
                    "SPICEDB_DATASTORE_CONN_URI": {
                      "isOptional": false,
                      "description": "Private PostgreSQL connection used by migrations and SpiceDB.",
                      "defaultValue": "postgres://${{Postgres.POSTGRES_USER}}:${{Postgres.POSTGRES_PASSWORD}}@${{Postgres.RAILWAY_PRIVATE_DOMAIN}}:5432/${{Postgres.POSTGRES_DB}}?sslmode=disable"
                    },
                    "SPICEDB_GRPC_PRESHARED_KEY": {
                      "isOptional": false,
                      "description": "Generated administrator bearer key for REST and gRPC clients.",
                      "defaultValue": "{{SPICEDB_GRPC_PRESHARED_KEY}}"
                    },
                    "SPICEDB_SKIP_RELEASE_CHECK": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "true"
                    },
                    "SPICEDB_TELEMETRY_ENDPOINT": {
                      "isOptional": false,
                      "description": "Empty by default to disable upstream telemetry.",
                      "defaultValue": "{{SPICEDB_TELEMETRY_ENDPOINT}}"
                    },
                    "SPICEDB_DATASTORE_CONN_POOL_READ_MAX_OPEN": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "10"
                    },
                    "SPICEDB_DATASTORE_CONN_POOL_READ_MIN_OPEN": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "2"
                    },
                    "SPICEDB_DATASTORE_CONN_POOL_WRITE_MAX_OPEN": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "5"
                    },
                    "SPICEDB_DATASTORE_CONN_POOL_WRITE_MIN_OPEN": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "2"
                    }
                  }
                },
                "bdcc09c5-3883-43c5-813e-0af5eb8ad45e": {
                  "icon": null,
                  "name": "Postgres",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "preDeployCommand": null,
                    "restartPolicyType": "ON_FAILURE",
                    "healthcheckTimeout": null,
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "postgres:16-alpine@sha256:57c72fd2a128e416c7fcc499958864df5301e940bca0a56f58fddf30ffc07777"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "5432"
                    },
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Database subdirectory inside the Railway volume.",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "spicedb"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "",
                      "defaultValue": "spicedb"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Generated PostgreSQL password.",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_INITDB_ARGS": {
                      "isOptional": false,
                      "description": "Enables commit timestamps for the SpiceDB Watch API.",
                      "defaultValue": "-c track_commit_timestamp=on"
                    }
                  },
                  "volumeMounts": {
                    "bdcc09c5-3883-43c5-813e-0af5eb8ad45e": {
                      "sizeMB": 5000,
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "SpiceDB Gateway",
      "method": "GET",
      "path": "/healthz",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 3,
    "needs_volume": true
  },
  "generated_at": "2026-09-11T04:14:34.944Z",
  "generator_version": "0.1.0"
}
