Cloudflare is suitable for deploying the Prompt Optimizer Web frontend. The current Cloudflare Dashboard may import GitHub repositories through the Workers Static Assets flow instead of the older Pages form. Both can deploy the static frontend, but if your screen says "Create Worker" and shows a deploy command like npx wrangler deploy, use the Workers settings below.
Public-repository users can start with Cloudflare's official one-click deploy button:
This flow clones the source repository into your GitHub/GitLab account, then creates and deploys a Worker with Workers Builds. The repository root includes wrangler.jsonc, which tells Cloudflare Workers how to build the Web frontend, publish the packages/web/dist static assets, and use index.html fallback routing for the single-page application.
Important notes:
- Deploy to Cloudflare buttons require a public GitHub/GitLab source repository.
- If you want to use a private repository, or restrict the Cloudflare GitHub App to selected repositories manually, use the manual import flow below.
Manual import is useful for private repositories, organization repositories, stricter GitHub App access control, or cases where the one-click button does not fit your setup.
-
Fork the project to your GitHub account
- Visit the prompt-optimizer repository
- Click "Fork" in the top right corner
- After forking, you will have a copy of the repository under your own GitHub account
-
Import the repository into Cloudflare
- Log in to the Cloudflare Dashboard
- Open Workers & Pages
- Create an application from your GitHub/Git repository
- Choose your forked
prompt-optimizerrepository
-
Review Worker settings
If the screen says "Create Worker", most settings can stay at their defaults. The Worker name must match the
namefield in the rootwrangler.jsonc.Setting Recommended value Worker name Keep prompt-optimizerif it is auto-filled; otherwise change it toprompt-optimizerRoot directory / Path Keep the default, usually /or emptyBuild command Clear it; if Cloudflare auto-fills pnpm run build, delete it.wrangler.jsoncalready configures the build commandDeploy command Keep the default npx wrangler deployNon-production branch deploy command Keep the default npx wrangler versions upload -
Environment variables
You usually do not need to configure build environment variables manually. Cloudflare detects the
pnpmand Node.js versions from the repositorypackageManagerandenginesfields.If Cloudflare detects the wrong versions, add these build environment variables:
NODE_VERSION=22 PNPM_VERSION=10.6.1
Do not preconfigure model API keys for a public Cloudflare site. Every
VITE_*variable is bundled into the frontend build output, so visitors can download those values in the browser. For public sites, leave API keys out of the hosting platform and let users configure their own keys in the application UI.Only consider preconfigured
VITE_*model settings for controlled private deployments. Pair that with Cloudflare Access, and use keys that are rotatable, scoped, and cost-limited. -
Deploy
- Save the settings and start the deployment
- After deployment succeeds, Cloudflare Workers provides a
*.workers.devdomain; you can bind a custom domain later - Later, whenever your fork receives new commits, Cloudflare rebuilds and redeploys automatically
-
Sync upstream updates
- Open your forked repository on GitHub
- When GitHub shows that it is behind
linshenkx/prompt-optimizer, click Sync fork - Once the sync creates new commits in your fork, Cloudflare redeploys automatically
If your Cloudflare Dashboard still shows Create application -> Pages -> Connect to Git, you can use the Pages form:
| Setting | Recommended value |
|---|---|
| Framework preset | None or empty |
| Root directory | / or empty |
| Build command | pnpm -F @prompt-optimizer/core build && pnpm -F @prompt-optimizer/ui build && pnpm -F @prompt-optimizer/web build |
| Build output directory | packages/web/dist |
Cloudflare deployment does not use Vercel's ACCESS_PASSWORD, middleware.js, or api/auth.js. If you want restricted access, use Cloudflare Access:
- Open Cloudflare Zero Trust
- Create a Self-hosted application
- Bind it to your Workers or Pages domain
- Configure allowed emails, domains, identity providers, or other access policies
Requests will pass through Cloudflare Access before reaching the static site, without frontend code changes.
Cloudflare Web Analytics can be enabled from the Cloudflare dashboard, so you do not need a frontend dependency like @vercel/analytics.
Note that Prompt Optimizer currently uses hash routing. Cloudflare Web Analytics can track overall site visits and performance, but it will not automatically treat /#/xxx hash route changes as separate page views.
| Capability | Vercel | Cloudflare Workers / Pages |
|---|---|---|
| Web frontend deployment | Supported | Supported |
| Auto deploy after fork commits | Supported | Supported |
| Automatic upstream sync | Not supported; users sync their fork | Not supported; users sync their fork |
| Site access control | ACCESS_PASSWORD password page |
Use Cloudflare Access |
| Vercel Analytics | Supported | Not applicable; use Cloudflare Web Analytics |
Cloudflare build environment variables are included in the frontend build output only after a new deployment. After saving variables, redeploy from Deployments.
The Cloudflare dashboard may now import GitHub static sites through the Workers Static Assets flow. This project is a pure frontend static site. In the Workers flow, wrangler.jsonc owns both the build command and the packages/web/dist static asset directory, which serve the same roles as the Pages build command and build output directory fields.
If the deployment log says The Wrangler application detection logic has been run in the root of a workspace, Wrangler did not read the root wrangler.jsonc and tried to auto-detect an app from the monorepo root. Make sure the deployed commit includes wrangler.jsonc. If it still fails, set the deploy command to npx wrangler deploy --config wrangler.jsonc, and set the non-production branch deploy command to npx wrangler versions upload --config wrangler.jsonc.
Cloudflare deploys a pure frontend page. The browser still calls model services directly. If a model provider does not allow browser CORS requests, the Web version will fail. Use the desktop app or configure your own API relay service in that case.