Skip to content

Frontend Variables

Frontend configuration is public in the browser. Do not put passwords, API keys, or other secrets in these values.

Configuration Methods

ENV

For CLI deployment, add the variables to frontend/.env.prod. For Worker Assets or Page Functions deployment, use frontend/.env.pages.local. For the GitHub Actions Deploy Frontend workflow, put the same content in the FRONTEND_ENV repository secret. The Deploy Frontend with page function workflow does not read this secret.

ini
VITE_API_BASE=https://temp-email-api.example.com
VITE_DEFAULT_LANG=en

See CLI Deployment and GitHub Actions Deployment for complete steps.

index.html

When using a prebuilt frontend ZIP, edit app-config in index.html. Field names do not use the VITE_ prefix:

html
<script id="app-config" type="application/json">
{
  "API_BASE": "https://temp-email-api.example.com",
  "DEFAULT_LANG": "en"
}
</script>

Fields set in app-config override ENV build values. Omitted fields, or a missing app-config tag, continue to use ENV build values. See Manual ZIP Deployment for complete steps.

Variable Reference

No frontend variable is required for every deployment method. VITE_API_BASE is required only when the frontend and backend are deployed separately and the browser must request the Worker domain directly. Leave it empty for same-origin deployments such as Worker Assets or Page Functions.

ENV Variableapp-config FieldRequiredTypeDefaultDescription
VITE_API_BASEAPI_BASEDepends on deploymentTextEmptyBackend API root URL beginning with https:// and without a trailing /; an empty value uses the same-origin API
VITE_DEFAULT_LANGDEFAULT_LANGNoTextzhDefault language: zh, en, es, pt-BR, ja, or de
VITE_CF_WEB_ANALY_TOKENCF_WEB_ANALY_TOKENNoTextEmptyCloudflare Web Analytics Token
VITE_IS_TELEGRAMIS_TELEGRAMNoBooleanfalseWhether to enable Telegram Mini App; see Telegram Configuration
VITE_GOOGLE_AD_CLIENTGOOGLE_AD_CLIENTNoTextEmptyGoogle AdSense Client ID; see Google Ads Configuration
VITE_GOOGLE_AD_SLOTGOOGLE_AD_SLOTNoTextEmptyGoogle AdSense Slot ID; see Google Ads Configuration

Based on MIT license