{
  "manifest_version": "1.0.0",
  "template": {
    "id": "eb108c97-f7c7-4013-a4ed-3976a78fa6f7",
    "slug": "sub2api-gateway",
    "name": "Sub2API | Claude, Codex & Gemini Subscriptions as One API Gateway",
    "description": "Sub2API: share Claude, Codex and Gemini subscriptions as one API gateway",
    "url": "https://railway.com/deploy/sub2api-gateway",
    "upstream": {
      "image": "weishaw/sub2api:0.2.19"
    }
  },
  "status": "unvalidated",
  "validated_at": null,
  "success_rate_30d": null,
  "services": [
    {
      "name": "Sub2API",
      "source": {
        "image": "weishaw/sub2api:0.2.19"
      },
      "needs_volume": true,
      "volume_mount_path": "/app/data",
      "http": true
    },
    {
      "name": "Redis",
      "source": {
        "image": "redis:8.10.2-alpine"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "http": false
    },
    {
      "name": "Postgres",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "http": false
    }
  ],
  "required_inputs": [
    {
      "key": "TZ",
      "service": "Sub2API",
      "description": "Time zone for usage stats and logs, e.g. Europe/Berlin",
      "secret": false,
      "strategy": "default",
      "default": "UTC"
    },
    {
      "key": "PORT",
      "service": "Sub2API",
      "description": "Railway routing port - leave as is",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "RUN_MODE",
      "service": "Sub2API",
      "description": "standard: full billing and quotas; simple: personal use without balances",
      "secret": false,
      "strategy": "default",
      "default": "standard"
    },
    {
      "key": "AUTO_SETUP",
      "service": "Sub2API",
      "description": "Configure from these variables instead of the setup wizard - leave as is",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "JWT_SECRET",
      "service": "Sub2API",
      "description": "Signs login sessions - auto-generated",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "REDIS_HOST",
      "service": "Sub2API",
      "description": "Redis host - leave as is",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDIS_PORT",
      "service": "Sub2API",
      "description": "Redis port - leave as is",
      "secret": false,
      "strategy": "default",
      "default": "6379"
    },
    {
      "key": "ADMIN_EMAIL",
      "service": "Sub2API",
      "description": "Admin login email, created on first boot so the setup page is never open to strangers",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_domain"
    },
    {
      "key": "SERVER_HOST",
      "service": "Sub2API",
      "description": "Listen address - leave as is",
      "secret": false,
      "strategy": "default",
      "default": "0.0.0.0"
    },
    {
      "key": "SERVER_MODE",
      "service": "Sub2API",
      "description": "Gin mode - leave as is",
      "secret": false,
      "strategy": "default",
      "default": "release"
    },
    {
      "key": "SERVER_PORT",
      "service": "Sub2API",
      "description": "Port Sub2API listens on - leave as is",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "DATABASE_HOST",
      "service": "Sub2API",
      "description": "Postgres host - leave as is",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "DATABASE_PORT",
      "service": "Sub2API",
      "description": "Postgres port - leave as is",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "DATABASE_USER",
      "service": "Sub2API",
      "description": "Postgres user - leave as is",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "ADMIN_PASSWORD",
      "service": "Sub2API",
      "description": "Admin password, set on first boot only - copy it from here to log in, then change it in Sub2API",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "Sub2API",
      "description": "Redis password - leave as is",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DATABASE_DBNAME",
      "service": "Sub2API",
      "description": "Postgres database - leave as is",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DATABASE_SSLMODE",
      "service": "Sub2API",
      "description": "Private network, no TLS needed - leave as is",
      "secret": false,
      "strategy": "default",
      "default": "disable"
    },
    {
      "key": "DATABASE_PASSWORD",
      "service": "Sub2API",
      "description": "Postgres password - leave as is",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "TOTP_ENCRYPTION_KEY",
      "service": "Sub2API",
      "description": "Encrypts 2FA and payment secrets (64 hex chars) - auto-generated; never change it",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "Redis",
      "description": "Auto-generated Redis password",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Data subdirectory - keeps Postgres happy on Railway volumes",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Database name",
      "secret": false,
      "strategy": "default",
      "default": "sub2api"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "Database user",
      "secret": false,
      "strategy": "default",
      "default": "sub2api"
    },
    {
      "key": "POSTGRES_PASSWORD",
      "service": "Postgres",
      "description": "Auto-generated database password",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Time for Postgres to shut down cleanly on redeploy",
      "secret": false,
      "strategy": "default",
      "default": "60"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "sub2api-gateway"
      }
    },
    "cli": "railway deploy --template sub2api-gateway",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "eb108c97-f7c7-4013-a4ed-3976a78fa6f7",
            "serializedConfig": {
              "services": {
                "02357357-78b7-4c4f-9d5f-e75c9bd3dc9d": {
                  "icon": "https://raw.githubusercontent.com/two-workspaces/sub2api/main/icon.svg",
                  "name": "Sub2API",
                  "build": {},
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": "/health",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "weishaw/sub2api:0.2.19"
                  },
                  "variables": {
                    "TZ": {
                      "isOptional": false,
                      "description": "Time zone for usage stats and logs, e.g. Europe/Berlin",
                      "defaultValue": "UTC"
                    },
                    "PORT": {
                      "isOptional": false,
                      "description": "Railway routing port - leave as is",
                      "defaultValue": "8080"
                    },
                    "RUN_MODE": {
                      "isOptional": false,
                      "description": "standard: full billing and quotas; simple: personal use without balances",
                      "defaultValue": "standard"
                    },
                    "AUTO_SETUP": {
                      "isOptional": false,
                      "description": "Configure from these variables instead of the setup wizard - leave as is",
                      "defaultValue": "true"
                    },
                    "JWT_SECRET": {
                      "isOptional": false,
                      "description": "Signs login sessions - auto-generated",
                      "defaultValue": "{{JWT_SECRET}}"
                    },
                    "REDIS_HOST": {
                      "isOptional": false,
                      "description": "Redis host - leave as is",
                      "defaultValue": "${{Redis.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "REDIS_PORT": {
                      "isOptional": false,
                      "description": "Redis port - leave as is",
                      "defaultValue": "6379"
                    },
                    "ADMIN_EMAIL": {
                      "isOptional": false,
                      "description": "Admin login email, created on first boot so the setup page is never open to strangers",
                      "defaultValue": "admin@${{RAILWAY_PUBLIC_DOMAIN}}"
                    },
                    "SERVER_HOST": {
                      "isOptional": false,
                      "description": "Listen address - leave as is",
                      "defaultValue": "0.0.0.0"
                    },
                    "SERVER_MODE": {
                      "isOptional": false,
                      "description": "Gin mode - leave as is",
                      "defaultValue": "release"
                    },
                    "SERVER_PORT": {
                      "isOptional": false,
                      "description": "Port Sub2API listens on - leave as is",
                      "defaultValue": "8080"
                    },
                    "DATABASE_HOST": {
                      "isOptional": false,
                      "description": "Postgres host - leave as is",
                      "defaultValue": "${{Postgres.RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "DATABASE_PORT": {
                      "isOptional": false,
                      "description": "Postgres port - leave as is",
                      "defaultValue": "5432"
                    },
                    "DATABASE_USER": {
                      "isOptional": false,
                      "description": "Postgres user - leave as is",
                      "defaultValue": "${{Postgres.POSTGRES_USER}}"
                    },
                    "ADMIN_PASSWORD": {
                      "isOptional": false,
                      "description": "Admin password, set on first boot only - copy it from here to log in, then change it in Sub2API",
                      "defaultValue": "{{ADMIN_PASSWORD}}"
                    },
                    "REDIS_PASSWORD": {
                      "isOptional": false,
                      "description": "Redis password - leave as is",
                      "defaultValue": "${{Redis.REDIS_PASSWORD}}"
                    },
                    "DATABASE_DBNAME": {
                      "isOptional": false,
                      "description": "Postgres database - leave as is",
                      "defaultValue": "${{Postgres.POSTGRES_DB}}"
                    },
                    "DATABASE_SSLMODE": {
                      "isOptional": false,
                      "description": "Private network, no TLS needed - leave as is",
                      "defaultValue": "disable"
                    },
                    "DATABASE_PASSWORD": {
                      "isOptional": false,
                      "description": "Postgres password - leave as is",
                      "defaultValue": "${{Postgres.POSTGRES_PASSWORD}}"
                    },
                    "TOTP_ENCRYPTION_KEY": {
                      "isOptional": false,
                      "description": "Encrypts 2FA and payment secrets (64 hex chars) - auto-generated; never change it",
                      "defaultValue": "{{TOTP_ENCRYPTION_KEY}}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>": {}
                    }
                  },
                  "volumeMounts": {
                    "a4c0a90b-2c27-40d9-9dd3-8ffb9042f7c0": {
                      "mountPath": "/app/data"
                    }
                  }
                },
                "7b089e31-d499-4b51-b7bf-7a5375e56097": {
                  "icon": "https://devicons.railway.app/i/redis.svg",
                  "name": "Redis",
                  "build": {},
                  "deploy": {
                    "startCommand": "/bin/sh -c \"rm -rf /data/lost+found && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --maxmemory-policy noeviction --appendonly yes --dir /data\"",
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "redis:8.10.2-alpine"
                  },
                  "variables": {
                    "REDIS_PASSWORD": {
                      "isOptional": false,
                      "description": "Auto-generated Redis password",
                      "defaultValue": "{{REDIS_PASSWORD}}"
                    }
                  },
                  "networking": {
                    "serviceDomains": {}
                  },
                  "volumeMounts": {
                    "a6bb68ce-4d7a-4e63-9abe-dd4f58b3059c": {
                      "mountPath": "/data"
                    }
                  }
                },
                "86ac8552-3ab1-4fb6-a122-79c660807e10": {
                  "icon": "https://devicons.railway.app/i/postgresql.svg",
                  "name": "Postgres",
                  "build": {},
                  "deploy": {
                    "startCommand": null,
                    "healthcheckPath": null,
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 10
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ssl:18"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Data subdirectory - keeps Postgres happy on Railway volumes",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Database name",
                      "defaultValue": "sub2api"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "Database user",
                      "defaultValue": "sub2api"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Auto-generated database password",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Time for Postgres to shut down cleanly on redeploy",
                      "defaultValue": "60"
                    }
                  },
                  "networking": {
                    "serviceDomains": {}
                  },
                  "volumeMounts": {
                    "f21b63c0-e096-4bfa-84de-c6fa9e9403bb": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "Sub2API",
      "method": "GET",
      "path": "/health",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 3,
    "needs_volume": true
  },
  "generated_at": "2026-11-07T16:15:10.050Z",
  "generator_version": "0.1.0"
}
