{
  "manifest_version": "1.0.0",
  "template": {
    "id": "ee0602e6-38ad-4384-a026-581c32736ac8",
    "slug": "openfga-authorization",
    "name": "OpenFGA",
    "description": "OpenFGA: Zanzibar-style fine-grained auth engine, backed by Postgres",
    "url": "https://railway.com/deploy/openfga-authorization",
    "upstream": {
      "repo_url": "https://github.com/gridalpha/openfga-railway"
    }
  },
  "services": [
    {
      "name": "Postgres",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    },
    {
      "name": "openfga",
      "source": {
        "repo": "https://github.com/gridalpha/openfga-railway"
      },
      "needs_volume": false,
      "tcp_ports": [
        8081
      ],
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Cluster location on the volume",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Data panel alias, not read by the server",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Data panel alias, not read by the server",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "Data panel alias, not read by the server",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "Data panel alias, not read by the server",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Data panel alias, not read by the server",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Database created on first boot",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "Private connection string",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "Superuser created on first boot",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "SSL_CERT_DAYS",
      "service": "Postgres",
      "description": "SSL certificate expiry in days",
      "secret": false,
      "strategy": "default",
      "default": "820"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Superuser password",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Clean shutdown window",
      "secret": false,
      "strategy": "default",
      "default": "60"
    },
    {
      "key": "PORT",
      "service": "openfga",
      "description": "HTTP port Railway routes and probes",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "OPENFGA_LOG_LEVEL",
      "service": "openfga",
      "description": "Log verbosity",
      "secret": false,
      "strategy": "default",
      "default": "info"
    },
    {
      "key": "OPENFGA_LOG_FORMAT",
      "service": "openfga",
      "description": "Structured logs for Railway",
      "secret": false,
      "strategy": "default",
      "default": "json"
    },
    {
      "key": "OPENFGA_AUTHN_METHOD",
      "service": "openfga",
      "description": "Bearer API key authentication",
      "secret": false,
      "strategy": "default",
      "default": "preshared"
    },
    {
      "key": "OPENFGA_DATASTORE_URI",
      "service": "openfga",
      "description": "Private Postgres connection string",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "OPENFGA_METRICS_ENABLED",
      "service": "openfga",
      "description": "Prometheus endpoint on 2112",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "OPENFGA_DATASTORE_ENGINE",
      "service": "openfga",
      "description": "Persistent datastore backend",
      "secret": false,
      "strategy": "default",
      "default": "postgres"
    },
    {
      "key": "OPENFGA_PLAYGROUND_ENABLED",
      "service": "openfga",
      "description": "Deprecated playground stays off",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "OPENFGA_AUTHN_PRESHARED_KEYS",
      "service": "openfga",
      "description": "Accepted API keys, comma separated",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "OPENFGA_DATASTORE_MAX_OPEN_CONNS",
      "service": "openfga",
      "description": "Connection pool ceiling",
      "secret": false,
      "strategy": "default",
      "default": "40"
    },
    {
      "key": "OPENFGA_DATASTORE_MIN_IDLE_CONNS",
      "service": "openfga",
      "description": "Idle pool floor, below min open",
      "secret": false,
      "strategy": "default",
      "default": "5"
    },
    {
      "key": "OPENFGA_DATASTORE_MIN_OPEN_CONNS",
      "service": "openfga",
      "description": "Warm connection baseline",
      "secret": false,
      "strategy": "default",
      "default": "10"
    },
    {
      "key": "OPENFGA_DATASTORE_METRICS_ENABLED",
      "service": "openfga",
      "description": "Database pool metrics",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "OPENFGA_DATASTORE_CONN_MAX_LIFETIME",
      "service": "openfga",
      "description": "Connection recycle interval",
      "secret": false,
      "strategy": "default",
      "default": "1h"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "openfga",
      "description": "Clean shutdown window",
      "secret": false,
      "strategy": "default",
      "default": "15"
    },
    {
      "key": "OPENFGA_DATASTORE_CONN_MAX_IDLE_TIME",
      "service": "openfga",
      "description": "Idle connection reaping delay",
      "secret": false,
      "strategy": "default",
      "default": "300s"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "openfga-authorization"
      }
    },
    "cli": "railway deploy --template openfga-authorization",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "ee0602e6-38ad-4384-a026-581c32736ac8",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "151e8d8b-637e-447c-ad05-3c93ae0439ba": {
                  "icon": "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/postgresql.svg",
                  "name": "Postgres",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Cluster location on the volume",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Data panel alias, not read by the server",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Data panel alias, not read by the server",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Data panel alias, not read by the server",
                      "defaultValue": "${{POSTGRES_USER}}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Data panel alias, not read by the server",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Data panel alias, not read by the server",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Database created on first boot",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "Private connection string",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Superuser created on first boot",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": false,
                      "description": "SSL certificate expiry in days",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Superuser password",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Clean shutdown window",
                      "defaultValue": "60"
                    }
                  },
                  "volumeMounts": {
                    "151e8d8b-637e-447c-ad05-3c93ae0439ba": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                },
                "f810c9dd-6688-42bf-8347-09314f1aa2fa": {
                  "icon": "https://raw.githubusercontent.com/openfga/openfga/main/openfga-logo.png",
                  "name": "openfga",
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/healthz",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "repo": "https://github.com/gridalpha/openfga-railway",
                    "rootDirectory": null
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "HTTP port Railway routes and probes",
                      "defaultValue": "8080"
                    },
                    "OPENFGA_LOG_LEVEL": {
                      "isOptional": false,
                      "description": "Log verbosity",
                      "defaultValue": "info"
                    },
                    "OPENFGA_LOG_FORMAT": {
                      "isOptional": false,
                      "description": "Structured logs for Railway",
                      "defaultValue": "json"
                    },
                    "OPENFGA_AUTHN_METHOD": {
                      "isOptional": false,
                      "description": "Bearer API key authentication",
                      "defaultValue": "preshared"
                    },
                    "OPENFGA_DATASTORE_URI": {
                      "isOptional": false,
                      "description": "Private Postgres connection string",
                      "defaultValue": "${{Postgres.DATABASE_URL}}"
                    },
                    "OPENFGA_METRICS_ENABLED": {
                      "isOptional": false,
                      "description": "Prometheus endpoint on 2112",
                      "defaultValue": "true"
                    },
                    "OPENFGA_DATASTORE_ENGINE": {
                      "isOptional": false,
                      "description": "Persistent datastore backend",
                      "defaultValue": "postgres"
                    },
                    "OPENFGA_PLAYGROUND_ENABLED": {
                      "isOptional": false,
                      "description": "Deprecated playground stays off",
                      "defaultValue": "false"
                    },
                    "OPENFGA_AUTHN_PRESHARED_KEYS": {
                      "isOptional": false,
                      "description": "Accepted API keys, comma separated",
                      "defaultValue": "{{OPENFGA_AUTHN_PRESHARED_KEYS}}"
                    },
                    "OPENFGA_DATASTORE_MAX_OPEN_CONNS": {
                      "isOptional": false,
                      "description": "Connection pool ceiling",
                      "defaultValue": "40"
                    },
                    "OPENFGA_DATASTORE_MIN_IDLE_CONNS": {
                      "isOptional": false,
                      "description": "Idle pool floor, below min open",
                      "defaultValue": "5"
                    },
                    "OPENFGA_DATASTORE_MIN_OPEN_CONNS": {
                      "isOptional": false,
                      "description": "Warm connection baseline",
                      "defaultValue": "10"
                    },
                    "OPENFGA_DATASTORE_METRICS_ENABLED": {
                      "isOptional": false,
                      "description": "Database pool metrics",
                      "defaultValue": "true"
                    },
                    "OPENFGA_DATASTORE_CONN_MAX_LIFETIME": {
                      "isOptional": false,
                      "description": "Connection recycle interval",
                      "defaultValue": "1h"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Clean shutdown window",
                      "defaultValue": "15"
                    },
                    "OPENFGA_DATASTORE_CONN_MAX_IDLE_TIME": {
                      "isOptional": false,
                      "description": "Idle connection reaping delay",
                      "defaultValue": "300s"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "8081": {}
                    },
                    "serviceDomains": {
                      "<hasDomain>:8080": {
                        "port": 8080
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "openfga",
      "method": "GET",
      "path": "/healthz",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 2,
    "needs_volume": true
  },
  "generated_at": "2026-09-22T22:14:50.114Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-09-21T19:49:57.579Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_099d7f59faa34d9f86c3",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 97,
    "typical_build_seconds": 18,
    "typical_start_seconds": 10,
    "slowest_service": "openfga"
  }
}
