Environment File Setup
Create a.env file in the root directory:
.env file with your configuration values. This file is shared across all applications in the monorepo.
Environment Variables Reference
Database Configuration
PostgreSQL connection string for the database.Format:
postgresql://[user]:[password]@[host]:[port]/[database]Example:Discord Bot Configuration
Authentication token for the Discord bot.How to obtain:
- Go to Discord Developer Portal
- Create a new application or select existing
- Navigate to “Bot” section
- Copy the token
The Discord server (guild) ID where the bot operates.How to obtain:
- Enable Developer Mode in Discord (User Settings → Advanced → Developer Mode)
- Right-click your server icon
- Click “Copy Server ID”
The Discord application client ID.How to obtain:
- Go to Discord Developer Portal
- Select your application
- Copy the “Application ID” from General Information
Web Application Configuration
Public URL for the backend API server.Development:Production:
The
NEXT_PUBLIC_ prefix makes this variable available in the browser.Admin Panel Configuration
Secret key for signing JWT tokens in the admin panel.Generate a secure secret:Example:
Development Configuration
Application environment mode.Valid values:
development- Development mode with hot reload and debug loggingproduction- Production mode with optimizationstest- Testing mode
Complete Configuration Example
Here’s a complete.env file example:
Application-Specific Configuration
Some applications may have additional configuration files:API Server (apps/api/)
The API server reads configuration from the root .env file. You can also create apps/api/.env for API-specific overrides:
Web Application (apps/web/)
Next.js applications can use .env.local for local overrides:
Admin Panel (apps/admin/)
Similar to the web application:
Environment Variable Loading
SkyTeam usesdotenv-cli to load environment variables:
Security Best Practices
Rotate Secrets Regularly
Change sensitive tokens and secrets periodically, especially:
- After team member changes
- If you suspect a leak
- As part of security maintenance
Docker Configuration
When using Docker, environment variables are passed viadocker-compose.yml:
docker-compose.yml
Validation
The application validates required environment variables on startup. If any are missing, you’ll see an error:Run
pnpm dev to verify your configuration. All services should start without errors.Next Steps
Database Setup
Initialize and configure the PostgreSQL database
Docker Deployment
Deploy with Docker using environment variables