Environment
Every VITE_* variable, what happens when it is empty, and the dev proxy table.
Env is read in src/config/env.ts. Values per mode live in .env.development, .env.staging,
.env.production.
Variables
| Var | Purpose |
|---|---|
VITE_API_BASE_URL | BFF origin. Empty = same-origin (the /v1 dev proxy, the reverse proxy in prod). Set only when the BFF is on another host; lib/ws.ts derives the WS origin from it. |
VITE_WALLETCONNECT_PROJECT_ID | Reown project id (public — ships in the bundle). Used by both the EVM connector and the Canton WalletConnectAdapter. |
VITE_AUTH0_DOMAIN / VITE_AUTH0_CLIENT_ID | Auth0 tenant for Mail sign-in. Both empty = Mail tab renders Unavailable and no Auth0Provider mounts. |
VITE_PUBLIC_POSTHOG_PROJECT_TOKEN | PostHog project token (public) |
VITE_PUBLIC_POSTHOG_HOST | PostHog ingest host (reverse-proxied) |
VITE_WALLET_GATEWAY_URL | Canton wallet gateway (:5003 in dev) |
VITE_LEDGER_API_URL | Canton ledger API (:7575 in dev) |
VITE_NETWORK_ID | devnet (staging) / mainnet (production) |
VITE_LOOP_NETWORK | Network the 5N Loop session opens on, independent of VITE_NETWORK_ID. |
VITE_SIGN_MESSAGE_ENCODING | base64 (default) or raw — how the CIP-0103 wallet expects the signMessage payload. |
VITE_LOOP_NETWORK defaults to mainnet on purpose — Loop accounts live there, so a devnet
build must still connect Loop to mainnet or the wallet has no account to offer. The consequence:
the party id that comes back is a mainnet party, and a devnet engine will not know it.
VITE_SIGN_MESSAGE_ENCODING exists because wallets disagree. Most extensions atob() a base64
payload; the Splice reference signer signs the literal text (raw). Getting it wrong produces a
valid-looking signature over the wrong bytes — the engine rejects with no useful message.
Dev proxy
vite.config.ts proxies so the front end runs against a local stack with no CORS friction:
| Path | Target | Note |
|---|---|---|
/v1 | :4000 | BFF REST and WebSocket (ws: true) |
/healthz, /readyz | :4000 | BFF health |
/api/json-rpc | :5003 | Canton wallet gateway |
/v2 | :7575 | Canton ledger API |
Build modes
npm run build # mode resolved from the branch
npm run build:staging # explicit devnet
npm run build:production # explicit mainnet
BRANCH=main npm run build # simulate a production branch locally| Branch | Mode | Network |
|---|---|---|
next, main | production | mainnet |
develop, PR previews, everything else | staging | devnet |
The mode is derived from CF_PAGES_BRANCH, not from a local .env. A local npm run build
without BRANCH set produces a staging bundle — which is the right default, but surprising
if you were expecting to reproduce a production artifact.