The TipStream frontend requires specific environment variables to function correctly. All environment variables must be prefixed with VITE_ to be exposed to the client bundle.
- Description: Stacks network to connect to
- Required: Yes
- Valid values:
mainnet,testnet,devnet - Example:
VITE_NETWORK=mainnet
- Description: Base URL of your deployed application
- Required: Yes
- Format: Must be a valid HTTP or HTTPS URL
- Usage: Used for canonical links, Open Graph metadata, and sharing features
- Examples:
- Production:
VITE_APP_URL=https://tipstream.example.com - Preview:
VITE_APP_URL=https://preview-branch.vercel.app - Local:
VITE_APP_URL=http://localhost:5173
- Production:
- Description: Custom Hiro API endpoint
- Required: No
- Default behavior: Automatically set based on
VITE_NETWORK- mainnet:
https://api.hiro.so - testnet:
https://api.testnet.hiro.so - devnet:
http://localhost:3999
- mainnet:
Located at src/config/contracts.js, this file contains:
CONTRACT_ADDRESS: Stacks address of the deployed contractCONTRACT_NAME: Name of the deployed contract- Network configuration
- API endpoint URLs
- Contract function names
The contract address and name are validated at startup to ensure they match expected formats.
The application validates configuration on startup before rendering. If validation fails:
- Errors are logged to the browser console
- A visible error message appears in the UI
- Application initialization is blocked
Configuration is validated in CI/CD pipelines using:
npm run validate:configThis script checks:
- Required environment variables are set
- Network value is valid
- URLs are properly formatted
- Contract address matches Stacks format
- Contract name follows naming conventions
-
Copy
.env.exampleto.env.local:cp .env.example .env.local
-
Edit
.env.localwith your values:VITE_NETWORK=devnet VITE_APP_URL=http://localhost:5173
-
Start the development server:
npm run dev
Set environment variables in your deployment platform:
VITE_NETWORK=testnet
VITE_APP_URL=https://your-preview-url.vercel.appSet environment variables in your deployment platform:
VITE_NETWORK=mainnet
VITE_APP_URL=https://your-production-domain.comIf you see "Configuration validation failed" in the console:
- Check that all required environment variables are set
- Verify
VITE_NETWORKis one of: mainnet, testnet, devnet - Ensure
VITE_APP_URLis a valid URL with http:// or https:// - Confirm
CONTRACT_ADDRESSin contracts.js matches Stacks address format - Verify
CONTRACT_NAMEin contracts.js uses lowercase letters, numbers, and hyphens only
If you see network mismatch warnings:
- Check that the Stacks API URL matches your selected network
- mainnet should use
https://api.hiro.so - testnet should use
https://api.testnet.hiro.so - devnet should use
http://localhost:3999
Environment variables not prefixed with VITE_ are not accessible in the frontend. Always use the VITE_ prefix.
Before deploying:
- Set
VITE_NETWORKto correct network - Set
VITE_APP_URLto deployment URL - Verify
CONTRACT_ADDRESSmatches deployed contract - Verify
CONTRACT_NAMEmatches deployed contract - Run
npm run validate:configlocally - Confirm CI validation passes
- Test configuration in preview environment
- Verify network matches contract deployment network