This document provides an overview of how the shared @prompt-optimizer/core and @prompt-optimizer/ui libraries are packaged and deployed across different platforms. It covers the build system, platform-specific packages, and architectural differences between web, browser extension, desktop, and MCP server implementations.
For details about development workflow and build commands, see Development Workflow and Build System. For deployment configuration specifics, see Deployment and Configuration.
The Prompt Optimizer codebase supports four distinct platform implementations from a single monorepo:
| Platform | Package | Primary Use Case | Deployment Target |
|---|---|---|---|
| Web Application | @prompt-optimizer/web | Browser-based usage, Vercel/static hosting | Static files |
| Browser Extension | @prompt-optimizer/extension | Chrome/Edge extension with popup interface | Chrome Web Store |
| Desktop Application | @prompt-optimizer/desktop | Native app without CORS limitations | Electron installers (.exe, .dmg, .AppImage) |
| MCP Server | @prompt-optimizer/mcp-server | Programmatic API access via Model Context Protocol | Docker container, Node.js runtime |
All platforms share the same core business logic (@prompt-optimizer/core) and UI components (@prompt-optimizer/ui), ensuring feature parity and reducing maintenance overhead.
Sources: README.md73-156 package.json1-107
The build system enforces a strict dependency order defined in package.json12-19:
pnpm build:core compiles TypeScript to CommonJS and ESM formats using tsuppnpm build:ui bundles Vue components and styles using Vitepnpm build:parallel builds web and extension in parallelpnpm build:desktop first builds web, then copies web/dist to desktop/web-dist, finally packages with electron-builderSources: package.json12-26 packages/core/package.json16-17 packages/ui/package.json24-27
Dependency patterns:
Web: Depends on both @prompt-optimizer/ui (for components) and implicitly on @prompt-optimizer/core (via UI's dependency). Uses Dexie for IndexedDB storage. packages/web/package.json15-18
Extension: Depends only on @prompt-optimizer/ui. Nearly identical to web but adds Chrome extension manifest.json with service_worker background script. packages/extension/package.json13-17 packages/extension/public/manifest.json1-34
Desktop: Direct dependency on @prompt-optimizer/core only for main process services. Bundles the compiled web application for the renderer process. Uses electron-log, electron-updater, and FileStorage for persistence. packages/desktop/package.json24-30
MCP Server: Depends only on @prompt-optimizer/core for LLM and prompt services. Adds @modelcontextprotocol/sdk and express for HTTP transport. No UI dependencies. packages/mcp-server/package.json28-34
Sources: packages/web/package.json1-36 packages/extension/package.json1-37 packages/desktop/package.json1-99 packages/mcp-server/package.json1-53
packages/web)The web package is a minimal wrapper that instantiates PromptOptimizerApp from @prompt-optimizer/ui:
src/main.ts creates the Vue app and mounts itDexie (IndexedDB) via PreferenceService from coreConfiguration is injected via Vite environment variables with VITE_ prefix (e.g., VITE_OPENAI_API_KEY).
Key limitation: Subject to browser CORS restrictions when calling AI APIs directly.
Sources: packages/web/package.json1-36 README.md73-80
packages/extension)Chrome extension implementation with popup interface:
service_worker handles extension lifecycle packages/extension/public/manifest.json20-23__MSG_extName__ syntax for i18n in manifest packages/extension/public/manifest.json4-6'self' packages/extension/public/manifest.json27-29The extension is functionally identical to the web app but packaged for distribution via Chrome Web Store.
Sources: packages/extension/public/manifest.json1-34 packages/extension/package.json1-37 README.md107-110
packages/desktop)Electron-based native application with the most complex build process:
Build configuration in packages/desktop/package.json32-91:
.exe, .dmg, .AppImage) and archive (.zip) formatsx64 and arm64 packages/desktop/package.json62-74Key advantages:
electron-updaterSources: packages/desktop/package.json1-99 packages/desktop/package.json11-16 README.md96-106
packages/mcp-server)Headless Node.js server implementing Model Context Protocol for programmatic access:
@modelcontextprotocol/sdk for MCP server creation/mcp path in Docker deployments docker-compose.yml11-13dist/start.cjs initializes HTTP transport with configurable port packages/mcp-server/package.json9optimize-user-promptoptimize-system-promptiterate-promptConfiguration via environment variables with MCP_ prefix:
MCP_DEFAULT_MODEL_PROVIDER: Sets default LLM provider (openai, gemini, deepseek, etc.)MCP_LOG_LEVEL: Controls logging verbosityMCP_DEFAULT_LANGUAGE: Sets i18n locale for templates docker-compose.yml33-35Sources: packages/mcp-server/package.json1-53 docker-compose.yml31-35 README.md182-246
Static hosting with environment variable injection:
packages/web/dist vercel.json3/index.html vercel.json10-13VITE_VERCEL_DEPLOYMENT=true vercel.json24-31Sources: vercel.json1-32 README.md82-95
Multi-service container combining web UI and MCP server:
:80/) and MCP (:80/mcp) docker-compose.yml11generate-auth.sh script docker/generate-auth.sh1-46VITE_* and MCP_* variables docker-compose.yml23-35Sources: docker-compose.yml1-44 docker/generate-auth.sh1-46 README.md112-156
Electron app packaged for native installation:
.exe installer (NSIS) + .zip portable packages/desktop/package.json52-57.dmg installer + .zip archive, both architectures packages/desktop/package.json59-77.AppImage + .zip packages/desktop/package.json79-86Sources: packages/desktop/package.json32-91 README.md96-106
Different platforms use different storage backends:
| Platform | Storage Implementation | Location |
|---|---|---|
| Web/Extension | Dexie (IndexedDB) | Browser storage |
| Desktop | FileStorage (JSON files) | app.getPath('userData') |
| MCP Server | In-memory (stateless) | N/A |
The PreferenceService from @prompt-optimizer/core provides a unified interface, abstracting the underlying storage mechanism.
| Platform | CORS Restrictions | Local Model Support |
|---|---|---|
| Web | Yes (browser policy) | Limited (mixed content blocks HTTPS→HTTP) |
| Extension | Partial (some APIs blocked) | Limited |
| Desktop | No (native app) | Full support |
| MCP Server | No (server-side) | Full support |
This is the primary reason desktop is recommended for users running local models like Ollama.
Sources: README.md354-409
All platforms support runtime configuration via environment variables:
VITE_* variables at build timeprocess.envThe desktop app additionally supports .env file loading via dotenv package for local development.
Sources: packages/desktop/package.json26 README.md248-290
For detailed implementation information about each platform:
Sources: package.json1-107 README.md1-472
Refresh this wiki