Use a separate Cloudflare Pages project (or preview deployments), Partykit project or dev host, and optionally a second Discord application so production players and URL mappings stay untouched.
cp .env.deploy.example .env.deploy.staging
# Fill staging-only values (Pages project name, Partykit host, Discord client id if using a second app).Deploy using the staging file:
DEPLOY_ENV_FILE=.env.deploy.staging node scripts/deploy.mjs allOn Windows PowerShell:
$env:DEPLOY_ENV_FILE=".env.deploy.staging"; node scripts/deploy.mjs allscripts/deploy.mjs reads DEPLOY_ENV_FILE when set; default remains .env.deploy.
| Variable | Notes |
|---|---|
CF_PAGES_PROJECT_NAME |
Different from production Pages project |
VITE_PARTYKIT_HOST |
Staging Partykit hostname (or dev party) |
VITE_DISCORD_CLIENT_ID |
Optional second Discord app for Activity testing |
VITE_DISCORD_TOKEN_URL |
Staging Worker /api/token URL if not same-origin |
| Worker / Partykit secrets | Match the staging Discord app and Partykit project |
- Either create a duplicate application for staging, or map Activity URL prefixes to a preview Pages hostname (e.g.
*.pages.devdeployment). - Keep production mappings on the production app only.
Set VITE_PLAUSIBLE_DOMAIN in staging builds to a test domain or leave unset to avoid polluting production stats. See .env.example for Plausible keys.
- Never commit
.env.deploy.staging(gitignored via.env.*). - Commit
.env.deploy.staging.exampleas a template only (no secrets).