{
  "manifest_version": "1.0.0",
  "template": {
    "id": "634a20c1-af76-491f-89bc-74a753c922da",
    "slug": "prompt-optimizer",
    "name": "Prompt Optimizer | Open Source PromptPerfect Alternative",
    "description": "AI prompt optimizer web app and MCP server, password and token protected",
    "url": "https://railway.com/deploy/prompt-optimizer",
    "upstream": {
      "image": "linshen/prompt-optimizer:2.11.10"
    }
  },
  "services": [
    {
      "name": "prompt-optimizer",
      "source": {
        "image": "linshen/prompt-optimizer:2.11.10"
      },
      "needs_volume": false,
      "http": true
    }
  ],
  "required_inputs": [
    {
      "key": "PORT",
      "service": "prompt-optimizer",
      "description": "Port nginx listens on inside the container. Railway routes the public domain here; leave as is.",
      "secret": false,
      "strategy": "default",
      "default": "80"
    },
    {
      "key": "MCP_LOG_LEVEL",
      "service": "prompt-optimizer",
      "description": "MCP server log level: debug, info, warn or error.",
      "secret": false,
      "strategy": "default",
      "default": "info"
    },
    {
      "key": "MCP_AUTH_TOKEN",
      "service": "prompt-optimizer",
      "description": "Bearer token required on /mcp. MCP clients send it as 'Authorization: Bearer' followed by this value. Letters and digits only; an empty value rejects every MCP request.",
      "secret": true,
      "strategy": "generate",
      "generate": "random_base64_32"
    },
    {
      "key": "ACCESS_PASSWORD",
      "service": "prompt-optimizer",
      "description": "Password for the web app. It also protects /config.js, which carries every VITE_* key below in plain text. Change it and redeploy to rotate.",
      "secret": true,
      "strategy": "generate",
      "generate": "strong_password"
    },
    {
      "key": "ACCESS_USERNAME",
      "service": "prompt-optimizer",
      "description": "Username for the web app's password prompt.",
      "secret": false,
      "strategy": "default",
      "default": "admin"
    },
    {
      "key": "MCP_DEFAULT_LANGUAGE",
      "service": "prompt-optimizer",
      "description": "Language of the MCP server's built-in optimisation templates: en or zh.",
      "secret": false,
      "strategy": "default",
      "default": "en"
    }
  ],
  "deploy": {
    "mcp": {
      "server": "railway",
      "tool": "deploy_template",
      "args": {
        "template_code": "prompt-optimizer"
      }
    },
    "cli": "railway deploy --template prompt-optimizer",
    "api": {
      "method": "POST",
      "path": "/graphql/v2",
      "body": {
        "query": "mutation templateDeploy($input: TemplateDeployV2Input!) { templateDeployV2(input: $input) { projectId workflowId } }",
        "variables": {
          "input": {
            "templateId": "634a20c1-af76-491f-89bc-74a753c922da",
            "serializedConfig": {
              "buckets": {},
              "services": {
                "029f8595-414c-4e51-a639-c0bf909b98fb": {
                  "icon": "https://cdn.jsdelivr.net/gh/linshenkx/prompt-optimizer@v2.11.10/images/logo/1024-1024.svg",
                  "name": "prompt-optimizer",
                  "deploy": {
                    "startCommand": "sh -c 'C=/etc/nginx/http.d/default.conf; A=/etc/nginx/http.d/00-mcp-token.conf; T=$(printf %s \"$MCP_AUTH_TOKEN\" | tr -cd \"A-Za-z0-9\"); printf \"%s\\n\" \"map \\$request_method:\\$http_authorization \\$mcp_token_denied {\" \"    default 1;\" \"    \\\"~^OPTIONS:\\\" 0;\" > $A; [ -n \"$T\" ] && printf \"    \\\"~^[A-Z]+:Bearer %s\\$\\\" 0;\\n\" \"$T\" >> $A; printf \"%s\\n\" \"}\" >> $A; grep -q mcp_token_denied $C || sed -i -e \"s|^    location /mcp {\\$|&\\n        if (\\$mcp_token_denied) { return 401; }|\" -e \"s|^    location = /healthz {\\$|    location = /livez {\\n        auth_basic off;\\n        default_type text/plain;\\n        return 200 ok;\\n    }\\n\\n&|\" $C; grep -q \"if (\\$mcp_token_denied)\" $C && grep -q \"location = /livez\" $C || { echo \"prompt-optimizer: nginx.conf did not match, refusing to start with /mcp unauthenticated\"; exit 1; }; [ -n \"$T\" ] || echo \"prompt-optimizer: MCP_AUTH_TOKEN is empty, /mcp will answer 401 to everything\"; exec sh /start-services.sh'",
                    "healthcheckPath": "/livez",
                    "restartPolicyType": "ON_FAILURE",
                    "restartPolicyMaxRetries": 2
                  },
                  "source": {
                    "image": "linshen/prompt-optimizer:2.11.10"
                  },
                  "variables": {
                    "PORT": {
                      "isOptional": false,
                      "description": "Port nginx listens on inside the container. Railway routes the public domain here; leave as is.",
                      "defaultValue": "80"
                    },
                    "MCP_LOG_LEVEL": {
                      "isOptional": false,
                      "description": "MCP server log level: debug, info, warn or error.",
                      "defaultValue": "info"
                    },
                    "MCP_AUTH_TOKEN": {
                      "isOptional": false,
                      "description": "Bearer token required on /mcp. MCP clients send it as 'Authorization: Bearer' followed by this value. Letters and digits only; an empty value rejects every MCP request.",
                      "defaultValue": "{{MCP_AUTH_TOKEN}}"
                    },
                    "ACCESS_PASSWORD": {
                      "isOptional": false,
                      "description": "Password for the web app. It also protects /config.js, which carries every VITE_* key below in plain text. Change it and redeploy to rotate.",
                      "defaultValue": "{{ACCESS_PASSWORD}}"
                    },
                    "ACCESS_USERNAME": {
                      "isOptional": false,
                      "description": "Username for the web app's password prompt.",
                      "defaultValue": "admin"
                    },
                    "VITE_CUSTOM_API_KEY": {
                      "isOptional": true,
                      "description": "API key for any OpenAI-compatible endpoint (Ollama, vLLM, LiteLLM, Azure…). Use with the two variables below.",
                      "defaultValue": ""
                    },
                    "VITE_GEMINI_API_KEY": {
                      "isOptional": true,
                      "description": "Google Gemini API key. Pre-configures the web app and enables the MCP server.",
                      "defaultValue": ""
                    },
                    "VITE_OPENAI_API_KEY": {
                      "isOptional": true,
                      "description": "OpenAI API key. Pre-configures the web app for everyone who knows the password, and enables the MCP server.",
                      "defaultValue": ""
                    },
                    "MCP_DEFAULT_LANGUAGE": {
                      "isOptional": false,
                      "description": "Language of the MCP server's built-in optimisation templates: en or zh.",
                      "defaultValue": "en"
                    },
                    "VITE_CUSTOM_API_MODEL": {
                      "isOptional": true,
                      "description": "Model name to use on the OpenAI-compatible endpoint.",
                      "defaultValue": ""
                    },
                    "VITE_DEEPSEEK_API_KEY": {
                      "isOptional": true,
                      "description": "DeepSeek API key. Pre-configures the web app and enables the MCP server.",
                      "defaultValue": ""
                    },
                    "VITE_ANTHROPIC_API_KEY": {
                      "isOptional": true,
                      "description": "Anthropic API key. Pre-configures the web app and enables the MCP server.",
                      "defaultValue": ""
                    },
                    "VITE_OPENROUTER_API_KEY": {
                      "isOptional": true,
                      "description": "OpenRouter API key. Pre-configures the web app and enables the MCP server.",
                      "defaultValue": ""
                    },
                    "VITE_CUSTOM_API_BASE_URL": {
                      "isOptional": true,
                      "description": "Base URL of the OpenAI-compatible endpoint, e.g. https://api.example.com/v1.",
                      "defaultValue": ""
                    },
                    "MCP_DEFAULT_MODEL_PROVIDER": {
                      "isOptional": true,
                      "description": "Which configured provider the MCP server uses when several keys are set: openai, anthropic, gemini, deepseek, openrouter or custom. Empty picks the first.",
                      "defaultValue": ""
                    }
                  },
                  "networking": {
                    "serviceDomains": {
                      "<hasDomain>:80": {
                        "port": 80
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "post_deploy": {
    "healthcheck": {
      "service": "prompt-optimizer",
      "method": "GET",
      "path": "/livez",
      "expect_status": 200
    }
  },
  "resources": {
    "expected_services": 1,
    "needs_volume": false
  },
  "generated_at": "2026-10-06T04:14:42.626Z",
  "generator_version": "0.1.0",
  "status": "validated",
  "validated_at": "2026-10-05T17:21:52.799Z",
  "success_rate_30d": 1,
  "validation": {
    "last_run_id": "run_0eb08533f6a34f388796",
    "checks": [
      {
        "name": "workflow_completed",
        "passed": true
      },
      {
        "name": "all_services_deployed",
        "passed": true
      },
      {
        "name": "healthcheck",
        "passed": true
      },
      {
        "name": "stays_up",
        "passed": true
      }
    ],
    "typical_ready_seconds": 79,
    "typical_build_seconds": 0,
    "typical_start_seconds": 10,
    "slowest_service": "prompt-optimizer"
  }
}
