This document summarizes the improvements made to StellarKit API's environment configuration documentation for new developers.
Location: .env.example
Improvements:
- ✅ Comprehensive STELLAR_NETWORK documentation with clear testnet vs mainnet comparison
- ✅ Network passphrases included for reference ("Test SDF Network" for testnet, "Public Global Stellar Network" for mainnet)
- ✅ Horizon URLs explicitly listed for both networks
- ✅ Critical production warning emphasizing the need to set STELLAR_NETWORK=mainnet before production
- ✅ Horizon endpoint explanation with link to official docs
- ✅ Horizon status page link for uptime monitoring
- ✅ Clear "leave blank" guidance for HORIZON_URL with explanation of when to override
- ✅ Organized with visual headers for easy scanning
- ✅ Security notes about private key management
Before:
# Stellar Network — use "testnet" or "mainnet"
STELLAR_NETWORK=testnet
# Horizon server URL (optional override)
# Testnet default: https://horizon-testnet.stellar.org
# Mainnet default: https://horizon.stellar.org
HORIZON_URL=After:
# ============================================================================
# STELLAR NETWORK CONFIGURATION
# ============================================================================
# Read more: https://developers.stellar.org/docs/learn/networks
#
# STELLAR_NETWORK - Which Stellar network to connect to. This determines:
# • Which Horizon server is used to fetch blockchain data
# • Whether testnet-only endpoints (like Friendbot) are available
# • Account balances, transaction history, and asset metadata
#
# IMPORTANT: Do NOT confuse STELLAR_NETWORK with the network passphrase.
# This variable controls which PUBLIC network you connect to.
#
# Available values: "testnet" or "mainnet"
#
# TESTNET: "Test SDF Network ; September 2015"
# • Free, experimental network for development and testing
# • Account balances and transactions reset periodically
# • Friendbot endpoint available to fund test accounts
# • Connect via: https://horizon-testnet.stellar.org
# • Use this for development, QA, and feature testing
# • NEVER use real money or production private keys on testnet
#
# MAINNET: "Public Global Stellar Network ; September 2015"
# • Production network where real transactions and value occur
# • Data is persistent; accounts and balances never reset
# • Friendbot is NOT available (use real funds to create accounts)
# • Connect via: https://horizon.stellar.org
# • Use only when deployed to production
# • ALWAYS use with secure key management and proper monitoring
#
# ⚠️ CRITICAL: Set this to "mainnet" explicitly before production deployment.
# Leaving this as "testnet" in production will use test data and may block
# real transactions from being signed or submitted.
#
STELLAR_NETWORK=testnet
# ============================================================================
# HORIZON SERVER URL (Optional Override)
# ============================================================================
# Read more: https://developers.stellar.org/docs/data/apis/horizon
#
# HORIZON_URL - Override the Horizon API endpoint. When left empty, the server
# automatically selects the correct public Horizon server based on STELLAR_NETWORK.
#
# Leave this blank in most cases unless you need to:
# • Use a private/custom Horizon instance
# • Point to a load balancer or proxy
# • Connect to a staging or development Horizon server
#
# Default behavior (when HORIZON_URL is empty):
# • If STELLAR_NETWORK=testnet → uses https://horizon-testnet.stellar.org
# • If STELLAR_NETWORK=mainnet → uses https://horizon.stellar.org
#
# Horizon is the REST API layer that allows this application to:
# • Query account balances and transaction history
# • Stream live ledger updates and account changes
# • Estimate transaction fees from current network conditions
# • Look up assets, liquidity pools, and order book data
#
# Official Horizon endpoints:
# Testnet: https://horizon-testnet.stellar.org
# Mainnet: https://horizon.stellar.org
#
# Check Horizon uptime and status:
# https://stellar.statuspage.io
#
HORIZON_URL=Purpose: Comprehensive guide for developers new to Stellar
Contents:
- Quick reference table (environment, network, Horizon URL, use case)
- Detailed explanation of STELLAR_NETWORK variable
- Testnet vs Mainnet comparison with characteristics
- Network passphrases and their purpose
- Environment-specific configuration patterns
- Detailed Horizon documentation (what it is, what it does, endpoints)
- Setup examples for development, staging, and production
- Network switching instructions with verification checklist
- Common mistakes and solutions
- Network-specific features and considerations
- Troubleshooting guide with common errors
- References to official Stellar documentation
Use case: For developers who want to understand the full context of network configuration
Purpose: Quick lookup guide for common values and configurations
Contents:
- Network selection command examples
- Horizon endpoints table with status links
- Network passphrases for testnet, mainnet, futurenet, standalone
- Account creation methods and costs
- Key Stellar values (stroops, fees, balances, etc.)
- Common Stellar account examples
- Quick API check commands
- Configuration template ready to copy
- Deployment checklist
- Useful links to external resources
- Glossary of Stellar terms
- Network behavior comparison (testnet vs mainnet)
Use case: For developers who need quick reference information without reading extensive documentation
Testnet:
- Network ID:
Test SDF Network ; September 2015 - Horizon URL:
https://horizon-testnet.stellar.org - Purpose: Development and testing
- Data persistence: No (resets periodically)
Mainnet:
- Network ID:
Public Global Stellar Network ; September 2015 - Horizon URL:
https://horizon.stellar.org - Purpose: Production with real value
- Data persistence: Yes (permanent)
All documentation emphasizes:
⚠️ SettingSTELLAR_NETWORK=mainnetexplicitly before production- 🔒 Secure key management requirements for mainnet
⚠️ Risk of leaving testnet setting in production (blocks real transactions)- 📋 Testing thoroughly on testnet first before mainnet
- Difference between networks: Why testnet and mainnet exist, when to use each
- How to configure: Setting environment variables correctly
- How to switch: Moving from testnet to mainnet safely
- What Horizon is: Understanding the API bridge to Stellar
- When to override: When HORIZON_URL should be customized
- Security considerations: Private key management and network-specific practices
✅ Clear comments above STELLAR_NETWORK
- Multiple paragraphs explaining purpose, values, and considerations
✅ Clear comments above HORIZON_URL
- Documentation of optional nature, when to override, default behavior
✅ Both testnet and mainnet values shown
- Examples for each network with URLs
- Network passphrases included
✅ Link to Stellar docs for Horizon endpoints
https://developers.stellar.org/docs/data/apis/horizonin.env.examplehttps://developers.stellar.org/docs/learn/networksfor network docs- Status page:
https://stellar.statuspage.io
✅ New developers can easily understand which values to use
- Side-by-side comparison tables
- Use case guidance
- Common patterns for development, staging, production
✅ File remains valid as environment template
- All variables properly formatted for
.envusage - Can be copied directly to
.envfile
- Production deployment checklist
- Critical warnings about production configuration
- Links to official Stellar documentation
- Complete setup examples for each environment
- Verification checklist after network switch
- Troubleshooting section with common errors
- Security best practices
- Quick lookup tables
- Command examples for common tasks
- Deployment checklist
- Glossary of Stellar terminology
- Links to useful resources
- Copy
.env.exampleto.env - Read the inline comments in
.env.example - Check
docs/network-quick-reference.mdfor configuration template
- Read
docs/environment-configuration.mdfor comprehensive guide - Review examples for their specific use case (development, staging, production)
- Bookmark
docs/network-quick-reference.mdfor quick reference
- Follow the deployment checklist in
docs/network-quick-reference.md - Review production considerations in
docs/environment-configuration.md - Set
STELLAR_NETWORK=mainnetexplicitly - Use secure key management practices
To verify new developers can understand the configuration:
-
Read
.env.examplecomments - Are testnet/mainnet clearly explained? ✅ Yes - Each has detailed bullet points explaining characteristics -
Find the Horizon URLs - Can you locate them in the config? ✅ Yes - Listed in comments for both testnet and mainnet
-
Understand when to use testnet vs mainnet - Is it obvious? ✅ Yes - Clear separation with use cases and warnings
-
Know how to switch between networks - Is the process clear? ✅ Yes -
docs/environment-configuration.mdsection "Switching Between Networks" -
Understand what Horizon is - Is its purpose explained? ✅ Yes - Multiple places explain Horizon and what it does
| File | Type | Status | Description |
|---|---|---|---|
.env.example |
Modified | ✅ | Enhanced with comprehensive documentation |
docs/environment-configuration.md |
Created | ✅ | Full configuration guide with examples |
docs/network-quick-reference.md |
Created | ✅ | Quick reference with lookup tables |
NETWORK_CONFIG_IMPROVEMENTS.md |
Created | ✅ | This summary document |
- Add to README.md - Link to
docs/environment-configuration.mdin the Configuration section - Create onboarding checklist - Reference these docs in CONTRIBUTING.md
- Add to CI/CD - Validate that STELLAR_NETWORK is set to mainnet before production deployment
- Monitor production - Alert if STELLAR_NETWORK=testnet detected in production
- Collect feedback - Ask developers if these docs answered their network configuration questions