Date: November 25, 2025 Status: ✅ Fully Implemented
The Mentat Protocol web application now clearly indicates when it's running on a testnet (devnet, testnet, or localnet) vs mainnet. This ensures users always know which network they're interacting with and prevents confusion about whether real funds are being used.
Network configuration is controlled via .env file in apps/web/:
# Solana Network Configuration
# Options: mainnet-beta | testnet | devnet | localnet
VITE_SOLANA_NETWORK=devnet
# Optional: Custom RPC URL (overrides default)
# VITE_SOLANA_RPC_URL=https://api.devnet.solana.com| Network | Type | Color | Default RPC |
|---|---|---|---|
| mainnet-beta | Production | Green (#14F195) | https://api.mainnet-beta.solana.com |
| testnet | Test | Red (#FF6B6B) | https://api.testnet.solana.com |
| devnet | Test | Orange (#FFA500) | https://api.devnet.solana.com |
| localnet | Test | Purple (#9B59B6) | http://localhost:8899 |
Location: Top right of header, next to wallet button Appearance:
- Only visible on testnets (devnet, testnet, localnet)
- Color-coded badge with network name
- Pulsing animation for attention
- Warning emoji (
⚠️ ) for emphasis
Component: src/components/NetworkIndicator.vue
<!-- Example on devnet -->
<div class="network-indicator" style="--network-color: #FFA500">
⚠️ DEVNET
</div>Location: Above header, spans full width Appearance:
- Sticky banner at top of page
- Color matches network type
- Shows network name and helpful message
- Only visible on testnets
Component: src/components/TestnetBanner.vue
<!-- Example message -->
🧪 Devnet Environment: This is a test network. No real funds are used.
You can get free test SOL from a faucet.Location: Inside "Connect Wallet" modal, next to title Appearance:
- Small badge showing network name
- Color-coded to match network
- Only visible on testnets
Component: Updated in src/components/wallet/WalletModal.vue
apps/web/src/
├── config/
│ └── network.ts # Network configuration & helpers
├── components/
│ ├── NetworkIndicator.vue # Header network badge
│ └── TestnetBanner.vue # Top banner for testnets
apps/web/
├── .env.example # Added network config vars
├── src/
│ ├── components/
│ │ ├── AppHeader.vue # Added NetworkIndicator
│ │ └── wallet/
│ │ └── WalletModal.vue # Added network badge
│ ├── layouts/
│ │ └── DefaultLayout.vue # Added TestnetBanner
│ └── composables/
│ └── useSolana.ts # Uses CURRENT_NETWORK
Key exports:
// Current network (from environment)
export const CURRENT_NETWORK: NetworkConfig;
// All available networks
export const AVAILABLE_NETWORKS: Record<NetworkType, NetworkConfig>;
// Helper functions
export function getNetworkBadgeText(network: NetworkConfig): string;
export function isTestnetEnvironment(): boolean;NetworkConfig interface:
interface NetworkConfig {
name: string; // e.g., "devnet"
displayName: string; // e.g., "Devnet"
type: NetworkType; // mainnet-beta | testnet | devnet | localnet
endpoint: string; // RPC URL
isTestnet: boolean; // true for all except mainnet-beta
color: string; // Hex color for UI
}Import network config:
import { CURRENT_NETWORK } from '@/config/network';
const network = CURRENT_NETWORK;Conditional rendering:
<template>
<div v-if="network.isTestnet" class="testnet-indicator">
{{ network.displayName }}
</div>
</template>Dynamic styling:
<div :style="{ '--network-color': network.color }">
<!-- Color will be used in CSS via var(--network-color) -->
</div>-
Edit
.envfile:# Change network VITE_SOLANA_NETWORK=testnet -
Restart dev server:
npm run dev
-
Verify in browser:
- Banner shows "TESTNET" with red color
- Header shows testnet badge
- Wallet modal shows testnet badge
-
Set environment variable during build:
VITE_SOLANA_NETWORK=mainnet-beta npm run build
-
Verify that no testnet indicators appear:
- No banner
- No network badge in header
- No badge in wallet modal
If you want to use a custom RPC (e.g., paid RPC service):
# In .env
VITE_SOLANA_NETWORK=mainnet-beta
VITE_SOLANA_RPC_URL=https://my-custom-rpc.com- Network badge appears in header next to wallet button
- Banner spans full width at top
- Wallet modal shows badge next to title
- Network badge appears in mobile nav menu
- Banner text adjusts to smaller font
- Wallet modal badge scales down
Mainnet (No indicators shown):
- Users see normal UI without network badges
Devnet (Orange):
- Badge: Orange gradient (#FFA500)
- Banner: Orange gradient background
- Message: Helpful for developers
Testnet (Red):
- Badge: Red gradient (#FF6B6B)
- Banner: Red gradient background
- Message: Warning about test environment
Localnet (Purple):
- Badge: Purple gradient (#9B59B6)
- Banner: Purple gradient background
- Message: Local development indicator
Network Indicator Badge:
- Gentle pulse animation (2s cycle)
- Opacity: 1 → 0.8 → 1
Banner:
- Sticky positioning (stays visible on scroll)
- Smooth color gradients
- Devnet: Orange banner and badges visible
- Testnet: Red banner and badges visible
- Mainnet-beta: No banners or badges
- Localnet: Purple banner and badges visible
- Change
VITE_SOLANA_NETWORKin.env - Restart dev server
- Verify UI updates correctly
- Check responsive behavior on mobile
- Test wallet connection on each network
- Verify RPC endpoint is correct
- Chrome/Chromium
- Firefox
- Safari (macOS)
- Mobile browsers (iOS Safari, Chrome Mobile)
Edit src/config/network.ts:
export const AVAILABLE_NETWORKS: Record<NetworkType, NetworkConfig> = {
devnet: {
// ...
color: '#YOUR_COLOR', // Change to your preferred color
},
};Edit src/components/TestnetBanner.vue:
<p class="testnet-banner__text">
<strong>{{ network.displayName }} Environment:</strong>
Your custom message here
</p>To let users switch networks in the UI:
<select v-model="selectedNetwork" @change="switchNetwork">
<option value="devnet">Devnet</option>
<option value="testnet">Testnet</option>
<option value="mainnet-beta">Mainnet</option>
</select>Note: This requires page reload to take effect (environment variable).
| Network | Use Case | SOL Source | Speed | Stability |
|---|---|---|---|---|
| Devnet | Active development, testing | Faucet (free) | Fast | Medium |
| Testnet | Pre-production testing | Faucet (free) | Medium | Medium |
| Localnet | Local development, debugging | Genesis (free) | Very Fast | High |
| Mainnet | Production, real users | Purchase | Fast | High |
- Localnet: Initial development and testing
- Devnet: Integration testing with other services
- Testnet: Final testing before production
- Mainnet: Production deployment
The app validates the network environment:
- ✅ Users always see which network they're on
- ✅ No accidental mainnet transactions during testing
- ✅ Clear visual distinction between test and production
- Never deploy to mainnet with testnet indicators
- Always verify
VITE_SOLANA_NETWORKbefore deployment - Test thoroughly on testnets before mainnet
- Use environment-specific
.envfiles
Problem: Testnet banner doesn't appear Solutions:
- Check
.envhasVITE_SOLANA_NETWORKset correctly - Restart dev server after changing
.env - Clear browser cache and reload
- Verify
CURRENT_NETWORK.isTestnet === true
Problem: Colors don't match expected network Solutions:
- Check
VITE_SOLANA_NETWORKmatches expected value - Verify
src/config/network.tscolor values - Check CSS custom property
--network-coloris applied - Inspect element in browser DevTools
Problem: App still uses default RPC Solutions:
- Verify
VITE_SOLANA_RPC_URLis set in.env - Check RPC URL is valid and accessible
- Test RPC endpoint:
curl https://your-rpc-url - Check browser console for connection errors
- Wallet Integration:
docs/WALLET-INTEGRATION-IMPLEMENTATION.md - Authentication Flow:
docs/AUTH-FLOW-CLARIFICATION.md - Environment Setup:
apps/web/.env.example
The network configuration system provides:
- ✅ Clear visual indicators for testnet environments
- ✅ Flexible configuration via environment variables
- ✅ Responsive design for all screen sizes
- ✅ Production-safe (no indicators on mainnet)
- ✅ Developer-friendly (easy to switch networks)
Users will always know which network they're using, preventing confusion and potential mistakes with real funds.
Last Updated: November 25, 2025 Status: ✅ Production Ready Dev Server: Running at http://localhost:5173 with network indicators