This document describes the deployment architecture, configuration options, and security considerations for production deployments of the Prompt Optimizer system. It covers four primary deployment targets: Docker (with bundled MCP server), Vercel (web-only), Desktop applications (Electron), and Chrome Extension. For information about the development workflow and build system, see Development Workflow and Build System. For details about the MCP server integration and client configuration, see MCP Server Integration.
The system provides four distinct deployment pathways, each with specific build processes and configuration requirements.
Deployment Pipeline Diagram
Sources: README.md73-246 README_EN.md73-249 .github/workflows/release.yml1-670 .github/workflows/docker.yml1-71
Deployment Target Characteristics
| Target | Runtime Environment | Storage Backend | CORS Restrictions | Auto-Update |
|---|---|---|---|---|
| Vercel/Web | Browser (HTTPS) | IndexedDB via Dexie | Yes (HTTPS mixed content) | N/A (always latest) |
| Docker | Nginx + Node.js | JSON files (volume) | Yes (browser client) | N/A (image versioning) |
| Desktop | Electron (sandboxed renderer + Node.js main) | JSON files (userData) | No (main process bypass) | Yes (via electron-updater) |
| Extension | Chrome Extension (Manifest V3) | chrome.storage.local | Partially relaxed | Via Chrome Web Store |
Sources: README.md96-110 README_EN.md96-106 docker-compose.yml1-44
Docker deployment bundles both the web application and MCP server into a single container, using Nginx for HTTP routing and basic authentication.
Docker Container Internal Architecture
Sources: docker-compose.yml1-44 docs/user/mcp-server.md13-32 docs/user/mcp-server_en.md13-28
The docker-compose.yml file defines the service structure and environment variable mappings:
Key Configuration Elements:
linshen/prompt-optimizer:latest (Docker Hub) or registry.cn-guangzhou.aliyuncs.com/prompt-optimizer/prompt-optimizer:latest (Aliyun mirror)28081:80 (host:container) - Nginx internal port configurable via NGINX_PORT/) and MCP server (/mcp) endpointsno-new-privileges:true enforces container privilege restrictionsDocker deployment requires two categories of environment variables:
Web Application API Keys (used by frontend):
MCP Server Configuration:
Access Control (optional):
Sources: docker-compose.yml19-42 env.local.example1-147
The Docker build workflow pushes images to both Docker Hub and Aliyun Container Registry:
.github/workflows/docker.yml10-70
Build Process:
test.yml workflow completion (main/master branch)linux/amd64, linux/arm64)latestSources: .github/workflows/docker.yml1-71
Vercel deployment targets the web application only (no MCP server) and requires specific build configuration to handle the monorepo structure.
Vercel Build Configuration
Key Configuration Elements:
| Field | Purpose | Value |
|---|---|---|
buildCommand | Handles monorepo builds, copies web dist to extension package | Conditional pnpm build with dist copying |
outputDirectory | Specifies built static files location | packages/web/dist |
installCommand | Installs dependencies and Vercel analytics | pnpm install && pnpm i @vercel/analytics -w |
rewrites | SPA routing fallback | All routes → /index.html except /api/* |
github.silent | Suppresses verbose GitHub comments | true |
git.deploymentEnabled | Auto-deploys from main/master | {"main": true, "master": true} |
Deployment Triggers:
Sources: vercel.json1-32 README.md82-95 README_EN.md82-94
Environment Variables:
Vercel environment variables follow the same VITE_* prefix pattern as Docker but are configured through the Vercel dashboard or .env files:
Sources: vercel.json24-32 README.md89-95 docs/user/deployment/vercel.md1-95
Desktop applications are built and released via GitHub Actions when a version tag is pushed. The workflow supports Windows, macOS (Intel + Apple Silicon), and Linux platforms.
Release Workflow Architecture
Sources: .github/workflows/release.yml1-670
Before building, the workflow dynamically modifies packages/desktop/package.json to inject version, repository URL, and publish configuration:
.github/workflows/release.yml44-114
Configuration Steps:
v prefix)repository.url to current GitHub repository${{ github.repository }}build.publish for electron-updater:
Sources: .github/workflows/release.yml44-241
All build artifacts follow a consistent naming pattern:
PromptOptimizer-{version}-{os}-{arch}.{ext}
Examples:
PromptOptimizer-1.4.0-win-x64.exePromptOptimizer-1.4.0-darwin-x64.dmgPromptOptimizer-1.4.0-darwin-arm64.dmgPromptOptimizer-1.4.0-linux-x86_64.AppImagePortable Versions (ZIP archives):
PromptOptimizer-1.4.0-win-x64.zipPromptOptimizer-1.4.0-darwin-arm64.zipPromptOptimizer-1.4.0-linux-x64.zipSources: .github/workflows/release.yml39-50 README.md97-100
Desktop installers (.exe, .dmg, .AppImage) support automatic updates via electron-updater. The workflow generates update manifest files (.yml) alongside each build:
Manifest Files:
latest.yml (Windows)latest-mac.yml (macOS)latest-linux.yml (Linux)Update Mechanism:
Requirements:
GH_TOKEN secret must be configured (read-only GitHub token)private: false in publish config)Sources: .github/workflows/release.yml98-122 .github/workflows/release.yml246-249
The create-release job automatically generates comprehensive release notes:
.github/workflows/release.yml477-651
Release Notes Include:
Sources: .github/workflows/release.yml477-670
The system uses a centralized environment variable mapping defined in packages/core/src/services/model/defaults.ts.
packages/core/src/services/model/defaults.ts7-21
Standard Providers:
VITE_OPENAI_API_KEYVITE_GEMINI_API_KEYVITE_ANTHROPIC_API_KEYVITE_DEEPSEEK_API_KEYVITE_SILICONFLOW_API_KEYVITE_ZHIPU_API_KEYVITE_DASHSCOPE_API_KEYVITE_OPENROUTER_API_KEYVITE_MODELSCOPE_API_KEYCustom Provider (single instance):
Sources: packages/core/src/services/model/defaults.ts7-96
The system supports unlimited custom models via suffix pattern:
Requirements:
KEY, BASE_URL, MODEL) must be presentqwen3 → "Qwen3")Dynamic Model Generation:
packages/core/src/services/model/model-utils.ts1-149 contains the logic to scan environment variables and generate TextModelConfig instances for each detected custom model.
Sources: env.local.example42-71 packages/core/src/services/model/defaults.ts98-115
MCP server requires additional environment variables when deployed standalone or in Docker:
Provider Selection Logic:
packages/mcp-server/src/config/models.ts12-66
The setupDefaultModel function:
defaultModels from core (includes all enabled providers)MCP_DEFAULT_MODEL_PROVIDER against:
custom_qwen3)openai)mcp-default model key in ModelManagerSources: packages/mcp-server/src/config/models.ts1-69 env.local.example72-91
The env.local.example file serves as the canonical reference for all environment variables:
Sections:
Sources: env.local.example1-147
The system implements different security models depending on the deployment target, with CORS restrictions being the primary architectural concern.
Security Model by Platform
Sources: README.md350-408 README_EN.md350-410
Problem Statement:
The system is a pure frontend application that makes direct API calls to LLM providers. Browsers enforce CORS (Cross-Origin Resource Sharing) policies that block many API endpoints.
CORS Issues by Scenario:
| Scenario | Issue | Solution |
|---|---|---|
| Online Web (HTTPS) | Cannot call local HTTP APIs (Ollama) due to mixed content policy | Use Desktop app or deploy via HTTP (Docker) |
| Web/Extension | Cannot call CORS-restricted commercial APIs (Nvidia DS API, Volcano API) | Use Desktop app or API proxy service (OneAPI/NewAPI) |
| Vercel/Docker Web | Browser still enforces CORS regardless of server deployment | Desktop app bypasses entirely via Node.js |
Desktop Application CORS Bypass:
Desktop applications run core services in the Electron main process, which has full Node.js capabilities:
User Action (Renderer)
↓ IPC call via contextBridge
Main Process (Node.js)
↓ Direct HTTP request (no CORS)
LLM API
↓ Response
Main Process
↓ IPC response
Renderer (Update UI)
Electron Proxy Classes:
ElectronLLMProxy: Proxies LLMService calls from renderer to mainElectronModelManagerProxy: Proxies ModelManager operationselectronAPI exposed via contextBridgeSources: README.md361-379 README_EN.md361-382
Docker deployment supports optional HTTP Basic Authentication for web access:
Nginx Configuration:
/mcpMCP Route Exception:
docs/user/mcp-server.md169-183 describes the authentication exemption:
This was added in v1.4.0+ to fix 401 errors when MCP clients (Claude Desktop) attempted to connect.
Sources: docker-compose.yml39-42 docs/user/mcp-server.md169-183 docs/user/mcp-server_en.md186-203
Desktop applications enforce strict context isolation for security:
Architecture:
contextBridge APISecurity Guarantees:
electronAPIExposed APIs (via contextBridge):
Sources: README.md102-105 README_EN.md102-105
For Maximum Security:
For Team/Production Use:
ACCESS_PASSWORD setFor Public Demo/Testing:
Sources: README.md366-379 README_EN.md366-382 docs/user/deployment/vercel.md1-95
Refresh this wiki