{
  "manifest_version": "1.0.0",
  "template": {
    "id": "d2cbd8d8-1538-47da-8ea4-3c97694a64e8",
    "slug": "sub2api-railway-template",
    "name": "sub2api-railway-template",
    "description": "Subscription to API Conversion Platform",
    "url": "https://railway.com/deploy/sub2api-railway-template",
    "upstream": {
      "image": "weishaw/sub2api:latest"
    }
  },
  "status": "unvalidated",
  "validated_at": null,
  "success_rate_30d": null,
  "services": [
    {
      "name": "Redis",
      "source": {
        "image": "redis:8.2.1"
      },
      "needs_volume": true,
      "volume_mount_path": "/data",
      "tcp_ports": [
        6379
      ],
      "http": false
    },
    {
      "name": "Postgres",
      "source": {
        "image": "ghcr.io/railwayapp-templates/postgres-ssl:17"
      },
      "needs_volume": true,
      "volume_mount_path": "/var/lib/postgresql/data",
      "tcp_ports": [
        5432
      ],
      "http": false
    },
    {
      "name": "weishaw/sub2api:latest",
      "source": {
        "image": "weishaw/sub2api:latest"
      },
      "needs_volume": false,
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "REDISHOST",
      "service": "Redis",
      "description": "Provide a value for REDISHOST.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "REDISPORT",
      "service": "Redis",
      "description": "Provide a value for REDISPORT.",
      "secret": false,
      "strategy": "default",
      "default": "6379"
    },
    {
      "key": "REDISUSER",
      "service": "Redis",
      "description": "Provide a value for REDISUSER.",
      "secret": false,
      "strategy": "default",
      "default": "default"
    },
    {
      "key": "REDIS_URL",
      "service": "Redis",
      "description": "Connection string for connecting to redis using the private network",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDISPASSWORD",
      "service": "Redis",
      "description": "Provide a value for REDISPASSWORD.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "Redis",
      "description": "Provide a value for REDIS_PASSWORD.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "REDIS_PUBLIC_URL",
      "service": "Redis",
      "description": "Connection string for connecting to redis externally",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATA",
      "service": "Postgres",
      "description": "Location where the database will be initialized",
      "secret": false,
      "strategy": "default",
      "default": "/var/lib/postgresql/data/pgdata"
    },
    {
      "key": "PGHOST",
      "service": "Postgres",
      "description": "Railway Private Domain Name.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "PGPORT",
      "service": "Postgres",
      "description": "Port to connect to Postgres.",
      "secret": false,
      "strategy": "default",
      "default": "5432"
    },
    {
      "key": "PGUSER",
      "service": "Postgres",
      "description": "Required variable for Data panel",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGDATABASE",
      "service": "Postgres",
      "description": "Required variable for the data panel.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "PGPASSWORD",
      "service": "Postgres",
      "description": "Required variable for Data panel",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "POSTGRES_DB",
      "service": "Postgres",
      "description": "Default database created when image is started.",
      "secret": false,
      "strategy": "default",
      "default": "railway"
    },
    {
      "key": "DATABASE_URL",
      "service": "Postgres",
      "description": "URL to connect to Postgres database.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "railway_private_domain"
    },
    {
      "key": "POSTGRES_USER",
      "service": "Postgres",
      "description": "User to connect to Postgres DB",
      "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": "Password to connect to DB",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "DATABASE_PUBLIC_URL",
      "service": "Postgres",
      "description": "Public URL to connect to Postgres database, used by the Data panel.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "RAILWAY_DEPLOYMENT_DRAINING_SECONDS",
      "service": "Postgres",
      "description": "Allow Postgres to cleanly shut down",
      "secret": false,
      "strategy": "default",
      "default": "60"
    },
    {
      "key": "TZ",
      "service": "weishaw/sub2api:latest",
      "description": "-----------------------------------------------------------------------------",
      "secret": false,
      "strategy": "default",
      "default": "Asia/Shanghai"
    },
    {
      "key": "REDIS_DB",
      "service": "weishaw/sub2api:latest",
      "description": "-----------------------------------------------------------------------------",
      "secret": false,
      "strategy": "default",
      "default": "0"
    },
    {
      "key": "RUN_MODE",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for RUN_MODE.",
      "secret": false,
      "strategy": "default",
      "default": "standard"
    },
    {
      "key": "AUTO_SETUP",
      "service": "weishaw/sub2api:latest",
      "description": "The port Sub2API listens on (Railway will automatically route traffic here)",
      "secret": false,
      "strategy": "default",
      "default": "true"
    },
    {
      "key": "JWT_SECRET",
      "service": "weishaw/sub2api:latest",
      "description": "Encryption key for 2FA/TOTP",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "REDIS_HOST",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for REDIS_HOST.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDIS_PORT",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for REDIS_PORT.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "ADMIN_EMAIL",
      "service": "weishaw/sub2api:latest",
      "description": "Auto-generates a secure 16-character password for the admin account",
      "secret": false,
      "strategy": "ask_user"
    },
    {
      "key": "SERVER_HOST",
      "service": "weishaw/sub2api:latest",
      "description": "Run mode: standard (full SaaS features) or simple (personal/internal use)",
      "secret": false,
      "strategy": "default",
      "default": "0.0.0.0"
    },
    {
      "key": "SERVER_MODE",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for SERVER_MODE.",
      "secret": false,
      "strategy": "default",
      "default": "release"
    },
    {
      "key": "SERVER_PORT",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for SERVER_PORT.",
      "secret": false,
      "strategy": "default",
      "default": "8080"
    },
    {
      "key": "DATABASE_HOST",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for DATABASE_HOST.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DATABASE_PORT",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for DATABASE_PORT.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DATABASE_USER",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for DATABASE_USER.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "ADMIN_PASSWORD",
      "service": "weishaw/sub2api:latest",
      "description": "-----------------------------------------------------------------------------",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "REDIS_PASSWORD",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for REDIS_PASSWORD.",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "DATABASE_DBNAME",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for DATABASE_DBNAME.",
      "secret": false,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "REDIS_POOL_SIZE",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for REDIS_POOL_SIZE.",
      "secret": false,
      "strategy": "default",
      "default": "1024"
    },
    {
      "key": "DATABASE_SSLMODE",
      "service": "weishaw/sub2api:latest",
      "description": "-----------------------------------------------------------------------------",
      "secret": false,
      "strategy": "default",
      "default": "disable"
    },
    {
      "key": "DATABASE_PASSWORD",
      "service": "weishaw/sub2api:latest",
      "description": "Optional: Connection Pool Tuning (Uncomment to adjust)",
      "secret": true,
      "strategy": "railway_provided",
      "railway_source": "reference_variable"
    },
    {
      "key": "TOTP_ENCRYPTION_KEY",
      "service": "weishaw/sub2api:latest",
      "description": "# Generate a secure key: openssl rand -hex 32",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "REDIS_MIN_IDLE_CONNS",
      "service": "weishaw/sub2api:latest",
      "description": "Optional: Security Allowlist (Uncomment to enable)",
      "secret": false,
      "strategy": "default",
      "default": "10"
    },
    {
      "key": "DATABASE_MAX_IDLE_CONNS",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for DATABASE_MAX_IDLE_CONNS.",
      "secret": false,
      "strategy": "default",
      "default": "10"
    },
    {
      "key": "DATABASE_MAX_OPEN_CONNS",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for DATABASE_MAX_OPEN_CONNS.",
      "secret": false,
      "strategy": "default",
      "default": "50"
    },
    {
      "key": "SECURITY_URL_ALLOWLIST_ENABLED",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for SECURITY_URL_ALLOWLIST_ENABLED.",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "SECURITY_URL_ALLOWLIST_ALLOW_INSECURE_HTTP",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for SECURITY_URL_ALLOWLIST_ALLOW_INSECURE_HTTP.",
      "secret": false,
      "strategy": "default",
      "default": "false"
    },
    {
      "key": "SECURITY_URL_ALLOWLIST_ALLOW_PRIVATE_HOSTS",
      "service": "weishaw/sub2api:latest",
      "description": "Provide a value for SECURITY_URL_ALLOWLIST_ALLOW_PRIVATE_HOSTS.",
      "secret": false,
      "strategy": "default",
      "default": "false"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "sub2api-railway-template"
      }
    },
    "cli": "railway deploy --template sub2api-railway-template",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "d2cbd8d8-1538-47da-8ea4-3c97694a64e8",
            "serializedConfig": {
              "services": {
                "bb302130-ea81-45fa-9b54-1848890a71b0": {
                  "icon": "https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg",
                  "name": "Redis",
                  "deploy": {
                    "startCommand": "/bin/sh -c \"rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH\""
                  },
                  "source": {
                    "image": "redis:8.2.1"
                  },
                  "variables": {
                    "REDISHOST": {
                      "isOptional": false,
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "REDISPORT": {
                      "isOptional": false,
                      "defaultValue": "6379"
                    },
                    "REDISUSER": {
                      "isOptional": false,
                      "defaultValue": "default"
                    },
                    "REDIS_URL": {
                      "isOptional": false,
                      "description": "Connection string for connecting to redis using the private network",
                      "defaultValue": "redis://${{ REDISUSER }}:${{ REDIS_PASSWORD }}@${{ REDISHOST }}:${{ REDISPORT }}"
                    },
                    "REDISPASSWORD": {
                      "isOptional": false,
                      "defaultValue": "${{REDIS_PASSWORD}}"
                    },
                    "REDIS_PASSWORD": {
                      "isOptional": false,
                      "defaultValue": "{{REDIS_PASSWORD}}"
                    },
                    "REDIS_PUBLIC_URL": {
                      "description": "Connection string for connecting to redis externally",
                      "defaultValue": "redis://default:${{ REDIS_PASSWORD }}@${{ RAILWAY_TCP_PROXY_DOMAIN }}:${{ RAILWAY_TCP_PROXY_PORT }}"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "6379": {}
                    }
                  },
                  "volumeMounts": {
                    "bb302130-ea81-45fa-9b54-1848890a71b0": {
                      "mountPath": "/data"
                    }
                  },
                  "haTemplateCode": "redis-ha",
                  "haConversionConfig": {
                    "edge": {
                      "label": "Reverse Proxies",
                      "options": [
                        1,
                        2
                      ],
                      "nodeLabel": "HAProxy",
                      "description": "HAProxy instances routing writes to the primary",
                      "defaultValue": 2
                    },
                    "replica": {
                      "label": "Redis Replicas",
                      "options": [
                        2,
                        3,
                        4,
                        5
                      ],
                      "nodeLabel": "Redis",
                      "description": "Nodes running Redis + colocated Sentinel",
                      "defaultValue": 2
                    },
                    "internal": null,
                    "description": "This will convert your Redis instance to an HA cluster with Sentinel failover and HAProxy routing to the primary."
                  }
                },
                "c9e69c12-a9ad-445b-bf95-f96db1c19428": {
                  "icon": "https://devicons.railway.app/i/postgresql.svg",
                  "name": "Postgres",
                  "build": {},
                  "deploy": {
                    "requiredMountPath": "/var/lib/postgresql/data"
                  },
                  "source": {
                    "image": "ghcr.io/railwayapp-templates/postgres-ssl:17"
                  },
                  "variables": {
                    "PGDATA": {
                      "isOptional": false,
                      "description": "Location where the database will be initialized",
                      "defaultValue": "/var/lib/postgresql/data/pgdata"
                    },
                    "PGHOST": {
                      "isOptional": false,
                      "description": "Railway Private Domain Name.",
                      "defaultValue": "${{RAILWAY_PRIVATE_DOMAIN}}"
                    },
                    "PGPORT": {
                      "isOptional": false,
                      "description": "Port to connect to Postgres.",
                      "defaultValue": "5432"
                    },
                    "PGUSER": {
                      "isOptional": false,
                      "description": "Required variable for Data panel",
                      "defaultValue": "${{ POSTGRES_USER }}"
                    },
                    "PGDATABASE": {
                      "isOptional": false,
                      "description": "Required variable for the data panel.",
                      "defaultValue": "${{POSTGRES_DB}}"
                    },
                    "PGPASSWORD": {
                      "isOptional": false,
                      "description": "Required variable for Data panel",
                      "defaultValue": "${{POSTGRES_PASSWORD}}"
                    },
                    "POSTGRES_DB": {
                      "isOptional": false,
                      "description": "Default database created when image is started.",
                      "defaultValue": "railway"
                    },
                    "DATABASE_URL": {
                      "isOptional": false,
                      "description": "URL to connect to Postgres database.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_PRIVATE_DOMAIN}}:5432/${{PGDATABASE}}"
                    },
                    "POSTGRES_USER": {
                      "isOptional": false,
                      "description": "User to connect to Postgres DB",
                      "defaultValue": "postgres"
                    },
                    "SSL_CERT_DAYS": {
                      "isOptional": true,
                      "description": "SSL certificate expiry in days.",
                      "defaultValue": "820"
                    },
                    "POSTGRES_PASSWORD": {
                      "isOptional": false,
                      "description": "Password to connect to DB",
                      "defaultValue": "{{POSTGRES_PASSWORD}}"
                    },
                    "DATABASE_PUBLIC_URL": {
                      "description": "Public URL to connect to Postgres database, used by the Data panel.",
                      "defaultValue": "postgresql://${{PGUSER}}:${{POSTGRES_PASSWORD}}@${{RAILWAY_TCP_PROXY_DOMAIN}}:${{RAILWAY_TCP_PROXY_PORT}}/${{PGDATABASE}}"
                    },
                    "RAILWAY_DEPLOYMENT_DRAINING_SECONDS": {
                      "isOptional": false,
                      "description": "Allow Postgres to cleanly shut down",
                      "defaultValue": "60"
                    }
                  },
                  "networking": {
                    "tcpProxies": {
                      "5432": {}
                    },
                    "serviceDomains": {}
                  },
                  "volumeMounts": {
                    "c9e69c12-a9ad-445b-bf95-f96db1c19428": {
                      "mountPath": "/var/lib/postgresql/data"
                    }
                  },
                  "haTemplateCode": "postgres-ha",
                  "haConversionConfig": {
                    "edge": {
                      "label": "Reverse Proxy",
                      "options": [
                        2,
                        3,
                        4,
                        5
                      ],
                      "nodeLabel": "HAProxy",
                      "description": "Routes traffic to the primary",
                      "defaultValue": 3
                    },
                    "replica": {
                      "label": "Replicas",
                      "options": [
                        2,
                        3,
                        4,
                        5,
                        6,
                        7
                      ],
                      "nodeLabel": "Postgres",
                      "description": "Streaming replicas for automatic failover",
                      "defaultValue": 2
                    },
                    "internal": {
                      "label": "Coordinator Nodes",
                      "options": [
                        3,
                        5,
                        7,
                        9
                      ],
                      "nodeLabel": "etcd",
                      "defaultValue": 3
                    },
                    "description": "This will convert your Postgres database to an HA cluster with Patroni failover and etcd consensus."
                  }
                },
                "d6953df8-8839-4313-8a31-bea9d61963c6": {
                  "name": "weishaw/sub2api:latest",
                  "deploy": {
                    "healthcheckPath": "/health"
                  },
                  "source": {
                    "image": "weishaw/sub2api:latest"
                  },
                  "variables": {
                    "TZ": {
                      "description": "-----------------------------------------------------------------------------",
                      "defaultValue": "Asia/Shanghai"
                    },
                    "REDIS_DB": {
                      "description": "-----------------------------------------------------------------------------",
                      "defaultValue": "0"
                    },
                    "RUN_MODE": {
                      "defaultValue": "standard"
                    },
                    "AUTO_SETUP": {
                      "description": "The port Sub2API listens on (Railway will automatically route traffic here)",
                      "defaultValue": "true"
                    },
                    "JWT_SECRET": {
                      "description": "Encryption key for 2FA/TOTP",
                      "defaultValue": "{{JWT_SECRET}}"
                    },
                    "REDIS_HOST": {
                      "defaultValue": "${{Redis.REDISHOST}}"
                    },
                    "REDIS_PORT": {
                      "defaultValue": "${{Redis.REDISPORT}}"
                    },
                    "ADMIN_EMAIL": {
                      "description": "Auto-generates a secure 16-character password for the admin account",
                      "defaultValue": "{{ADMIN_EMAIL}}"
                    },
                    "SERVER_HOST": {
                      "description": "Run mode: standard (full SaaS features) or simple (personal/internal use)",
                      "defaultValue": "0.0.0.0"
                    },
                    "SERVER_MODE": {
                      "defaultValue": "release"
                    },
                    "SERVER_PORT": {
                      "defaultValue": "8080"
                    },
                    "DATABASE_HOST": {
                      "defaultValue": "${{Postgres.PGHOST}}"
                    },
                    "DATABASE_PORT": {
                      "defaultValue": "${{Postgres.PGPORT}}"
                    },
                    "DATABASE_USER": {
                      "defaultValue": "${{Postgres.PGUSER}}"
                    },
                    "ADMIN_PASSWORD": {
                      "description": "-----------------------------------------------------------------------------",
                      "defaultValue": "{{ADMIN_PASSWORD}}"
                    },
                    "REDIS_PASSWORD": {
                      "defaultValue": "${{Redis.REDISPASSWORD}}"
                    },
                    "DATABASE_DBNAME": {
                      "defaultValue": "${{Postgres.PGDATABASE}}"
                    },
                    "REDIS_POOL_SIZE": {
                      "defaultValue": "1024"
                    },
                    "DATABASE_SSLMODE": {
                      "description": "-----------------------------------------------------------------------------",
                      "defaultValue": "disable"
                    },
                    "DATABASE_PASSWORD": {
                      "description": "Optional: Connection Pool Tuning (Uncomment to adjust)",
                      "defaultValue": "${{Postgres.PGPASSWORD}}"
                    },
                    "TOTP_ENCRYPTION_KEY": {
                      "description": "# Generate a secure key: openssl rand -hex 32",
                      "defaultValue": "{{TOTP_ENCRYPTION_KEY}}"
                    },
                    "REDIS_MIN_IDLE_CONNS": {
                      "description": "Optional: Security Allowlist (Uncomment to enable)",
                      "defaultValue": "10"
                    },
                    "DATABASE_MAX_IDLE_CONNS": {
                      "defaultValue": "10"
                    },
                    "DATABASE_MAX_OPEN_CONNS": {
                      "defaultValue": "50"
                    },
                    "SECURITY_URL_ALLOWLIST_ENABLED": {
                      "defaultValue": "false"
                    },
                    "SECURITY_URL_ALLOWLIST_ALLOW_INSECURE_HTTP": {
                      "defaultValue": "false"
                    },
                    "SECURITY_URL_ALLOWLIST_ALLOW_PRIVATE_HOSTS": {
                      "defaultValue": "false"
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:8080": {
                        "port": 8080
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "weishaw/sub2api:latest",
      "method": "GET",
      "path": "/health",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 3,
    "needs_volume": true
  },
  "generated_at": "2026-09-10T10:14:45.332Z",
  "generator_version": "0.1.0"
}
