Configuration Files
StellarStack uses separate environment files for different components:apps/api/.env- API server configurationapps/web/.env- Web panel configuration.env- Docker Compose configuration (when using Docker)
Environment variables in
.env.example files serve as templates. Copy them to .env and customize for your installation.Required Variables
These variables are required for StellarStack to function:Database Connection
PostgreSQL connection string in the format:Example:
Authentication Secret
Secret key used to sign session tokens. Must be at least 32 characters.Generate a secure secret:Example:
Production Required Variables
These variables are required for production deployments:Frontend URL
The public URL where your web panel is hosted. Used for CORS, redirects, and OAuth callbacks.Example:
Do not include a trailing slash. Use
https:// for production deployments with SSL.API URL
The public URL where your API server is hosted.Example:
Security Secrets
Secret used to sign file download tokens. Minimum 32 characters.Generate:
32-byte hexadecimal key for AES-256-CBC encryption. Used to encrypt sensitive data at rest.Generate:Example:
Secret for signing JWT tokens. Minimum 32 characters.Generate:
Optional Variables
OAuth Configuration
Enable login with Google, GitHub, or Discord by configuring OAuth providers:Google OAuth
Google OAuth 2.0 client ID. Get from Google Cloud Console.
Google OAuth 2.0 client secret.
Create OAuth credentials
- Go to Google Cloud Console
- Create a new project or select existing
- Navigate to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
GitHub OAuth
GitHub OAuth App client ID. Get from GitHub Developer Settings.
GitHub OAuth App client secret.
Create OAuth App
- Go to GitHub Developer Settings
- Click New OAuth App
- Fill in application details
Discord OAuth
Discord Application client ID. Get from Discord Developer Portal.
Discord Application client secret.
Create application
- Go to Discord Developer Portal
- Click New Application
- Name your application
Cloudflare Turnstile (CAPTCHA)
Protect your login page with Cloudflare Turnstile:Turnstile site key (public). Configured in
apps/web/.env.Get from Cloudflare Dashboard.Turnstile secret key. Configured in both
apps/api/.env and apps/web/.env.Create Turnstile site
- Go to Cloudflare Dashboard
- Navigate to Turnstile
- Click Add Site
- Configure domain and widget type
If Turnstile keys are not configured, the CAPTCHA will not be displayed on the login page.
Configuration Examples
Development Environment
apps/api/.env:Production Environment
apps/api/.env:Applying Configuration Changes
After modifying environment variables:- Development
- Production (Docker)
- Production (PM2/systemd)
Restart the development servers:
Security Best Practices
Use strong, unique secrets
Use strong, unique secrets
- Generate cryptographically secure random values for all secrets
- Never reuse secrets across installations
- Use different secrets for development and production
Protect environment files
Protect environment files
- Never commit
.envfiles to version control - Restrict file permissions:
chmod 600 .env - Use secret management services in production (AWS Secrets Manager, HashiCorp Vault, etc.)
Enable HTTPS in production
Enable HTTPS in production
- Use SSL/TLS certificates for all production deployments
- Configure
FRONTEND_URLandAPI_URLwithhttps:// - Enable HSTS headers in your reverse proxy
Secure your database
Secure your database
- Use strong database passwords
- Restrict database access to application servers only
- Enable SSL for database connections in production
- Regularly backup your database
Next Steps
Create Your First Server
Set up your first game server
Advanced Configuration
Explore advanced configuration options