VITE_. These are bundled into the client-side JavaScript at build time by Vite.
Creating the .env file
Create a.env file in the heirloom-app/ directory. This file is read by npm run dev, npm run build, and npm run build:dev.
Variable reference
| Variable | Description | Default (testnet) |
|---|---|---|
VITE_NETWORK | Stacks network to connect to. Accepts testnet or mainnet. Passed to @stacks/connect and @stacks/transactions. | testnet |
VITE_CONTRACT_ADDRESS | Deployer’s Stacks principal address. Combined with VITE_CONTRACT_NAME to form the full contract identifier. | STZJWVYSKRYV1XBGS8BZ4F81E32RHBREQSE5WAJM |
VITE_CONTRACT_NAME | Name of the deployed contract. Update this whenever you deploy a new contract version. | heirloom-vault-v10 |
VITE_SBTC_CONTRACT | Full contract identifier for the sBTC SIP-010 token (address.contract-name). | ST1F7QA2MDF17S807EPA36TSS8AMEFY4KA9TVGWXT.sbtc-token |
VITE_USDCX_CONTRACT | Full contract identifier for the USDCx SIP-010 token (address.contract-name). | ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.usdcx |
How Vite handles environment variables
Vite exposes any variable prefixed withVITE_ to client-side code via import.meta.env:
VITE_ prefix are available to the Node.js build process only and are not included in the browser bundle.
All
VITE_* variables are inlined as string literals at build time. They are not fetched at runtime. If you change an environment variable, you must rebuild the frontend for the change to take effect.Testnet configuration
For development against the current testnet deployment:Mainnet configuration
For a mainnet deployment, update the network, contract address, and contract name. The sBTC and USDCx contract addresses will differ on mainnet — replace them with the canonical mainnet token contracts.Using Vercel environment variables
For production deployments on Vercel, set environment variables in the Vercel dashboard under Settings → Environment Variables rather than using a.env file. The variable names and values are identical to the local .env format.