MuseMVP
MuseMVP-Docs
Configuration

Environment Variables

Configure local bindings, production inputs, OAuth, email, payments, and deployment secrets.

Separate local and deployment configuration

Flare does not consume the same environment variables as the Next.js starters. Configure the process that actually needs each value.

LocationConsumerPurpose
apps/web/.dev.varsLocal Vite / Wrangler runtimeLocal APP_URL, auth secret, optional integration keys
Root .envThe muse CLIDeployment account, production origin, authentication and integration secrets
packages/cli/src/target-resources.tsDeployment plannerWorker, D1, R2, queue, and dead-letter queue names

The CLI loads root .env even for init. This does not automatically expose it to the local Vite runtime or make init a remote deployment command. Init creates or preserves the local auth secret and initializes local D1.

Prepare production inputs

Copy the committed example from the repository root:

cp .env.example .env

Replace every placeholder with values for your own account:

CLOUDFLARE_ACCOUNT_ID=your-account-id
CLOUDFLARE_API_TOKEN=your-deployment-token
APP_URL=https://app.your-domain.com
AUTH_SECRET=replace-with-a-random-secret-at-least-32-characters
MAIL_FROM=Your Product <[email protected]>
ADMIN_EMAIL=[email protected]

CLOUDFLARE_API_TOKEN is a deployment management credential, not an application API key. Keep it out of frontend variables, published excerpts, and browser bundles. Use at least 32 characters for AUTH_SECRET. Preserve an existing production value when moving machines or upgrading so that sessions remain valid.

APP_URL must be a single HTTPS origin without a path, query, fragment, credentials, or port. The CLI can derive a Workers subdomain when omitted; explicitly set the final origin for a custom domain so callbacks and Origin checks agree. ADMIN_EMAIL promotes a matching account only after registration and email verification; it does not seed a production user.

Understand precedence

Existing process variables win over root .env. Root .env wins over defaults from .muse/<target>.secrets.json. If an edit appears ineffective, check whether the terminal or CI already defines that key; avoid dumping all environment values.

Do not commit .env, .dev.vars, deployment state, or generated target configuration. A fresh Git checkout does not restore production credentials. Transfer required values through a secure channel when moving machines.

Enable integrations deliberately

IntegrationVariablesAdditional setup
GoogleGOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRETRegister /api/auth/callback/google
GitHubGITHUB_CLIENT_ID / GITHUB_CLIENT_SECRETRegister /api/auth/callback/github
TurnstileTURNSTILE_SITE_KEY / TURNSTILE_SECRETAllow the domain; keep the secret server-side
StripeSTRIPE_SECRET_KEY / STRIPE_WEBHOOK_SECRETPrice mappings and signed webhooks
CreemCREEM_API_KEY / CREEM_WEBHOOK_SECRETProduct mappings and signed webhooks
DodoDODO_API_KEY / DODO_WEBHOOK_SECRETMatching environment, product IDs, and webhooks
WaffoWAFFO_MERCHANT_ID / WAFFO_PRIVATE_KEYOne-line private key with \n escapes, product and signature setup

Payment secrets alone do not enable checkout. Enable gateways and map products in packages/config. Email, AI, D1, R2, and Queues also require Worker bindings; an API token cannot replace a binding.

Verify and troubleshoot

pnpm muse:doctor --target production --json
pnpm muse:deploy --target production --plan --json

Resolve doctor blockers first. Review the account, target names, migrations, and creation actions in the plan. Plan mode does not create resources.

  • Missing OAuth button: provide both values for that provider and inspect the public configuration from /api/public/auth.
  • Production login fails: compare APP_URL, the browser origin, the production auth secret, and registered callback URLs.
  • Local values stay stale: check process precedence and restart the development server.
  • Workers Builds cannot find values: configure encrypted build environment variables; remote builds do not read your local .env.

Continue with deployment and payments.

Auf dieser Seite