API service variables
Create a.env file in services/api/ based on .env.example.
Environment mode
Environment mode for the application.
production- Use mainnet-compatible anchor domainsstaging- Use testnet-compatible mappings
Stellar network
Stellar Horizon API endpoint.Testnet:
https://horizon-testnet.stellar.orgMainnet: https://horizon.stellar.orgStellar network passphrase.Testnet:
Test SDF Network ; September 2015Mainnet: Public Global Stellar Network ; September 2015Stellar account secret key for escrow operations. Optional for diagnostics.
Anchor discovery and sync
URL to a machine-readable anchor directory export (JSON/CSV format).Example:
Mode for discovering anchors:
directory- Use the directory URLhorizon- Discover from Horizon API (recommended for production)
Enable fallback to Horizon discovery if directory fails.
Comma-separated list of allowed anchor domains for additional security filtering.
Require SEP-10 (Stellar Web Authentication) support for anchors.
Require valid signing keys in stellar.toml.
Require SEP-24 or SEP-31 support for anchors.
Number of consecutive 404 errors on stellar.toml before auto-disabling an anchor.
Supabase database
Your Supabase project URL.Example:
https://your-project.supabase.coSupabase service role key for admin operations.
Application settings
Base URL for the API service.
Origin URL for the web application (used for CORS).
Comma-separated list of allowed CORS origins.
Foreign exchange rate provider API URL.
Fallback exchange rate if the FX provider is unavailable.
Maximum number of routes to return in comparison endpoint.
Security secrets (production)
Secret for encrypting execution state tokens (production only).
Use a strong random string of at least 32 characters.
Secret for validating anchor callback requests (production only).
Secret for protecting cron endpoints (production only).
SEP-24 and SEP-31 settings
Base URL for SEP-24 callbacks. Defaults to API_BASE_URL if not set.
URL parameter name for SEP-24 callback URLs.
Domain for SEP-10 client attribution (production only).Example:
app.yourdomain.comWeb service variables
Create a.env.local file in services/web/ based on .env.example.
All frontend environment variables must be prefixed with
NEXT_PUBLIC_ to be accessible in the browser.Environment mode for the frontend.
production- Expect Freighter on mainnetstaging- Expect Freighter on testnet
Base URL for the API service.Local:
http://localhost:3001Production: Your deployed API URL (e.g., https://api.yourdomain.com)Base URL for the web application.Local:
http://localhost:3000Production: Your deployed web URL (e.g., https://app.yourdomain.com)Optional explicit network passphrase override. Usually inherited from
NEXT_PUBLIC_POP_ENV.Environment file examples
Security best practices
Frontend vs Backend secrets
- Never expose service-role keys as
NEXT_PUBLIC_*variables - Never expose private keys or signing secrets to the frontend
- Frontend should only call backend REST endpoints