Skip to main content
SkyTeam ROBLOX uses environment variables for configuration across all applications. This guide explains each variable and how to configure them.

Environment File Setup

Create a .env file in the root directory:
cp .env.example .env
Edit the .env file with your configuration values. This file is shared across all applications in the monorepo.

Environment Variables Reference

Database Configuration

DATABASE_URL
string
required
PostgreSQL connection string for the database.Format: postgresql://[user]:[password]@[host]:[port]/[database]Example:
DATABASE_URL="postgresql://skyteam:secret123@localhost:5432/skyteam"
For cloud databases, use the connection string provided by your provider:
  • Supabase: Project Settings → Database → Connection String
  • Neon: Dashboard → Connection Details
  • AWS RDS: Endpoint from RDS Console

Discord Bot Configuration

DISCORD_TOKEN
string
required
Authentication token for the Discord bot.How to obtain:
  1. Go to Discord Developer Portal
  2. Create a new application or select existing
  3. Navigate to “Bot” section
  4. Copy the token
Example:
DISCORD_TOKEN="MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.GhIjKl.MnOpQrStUvWxYzAbCdEfGhIjKlMnOpQrStUv"
Never commit your Discord token to version control. Keep it secret!
DISCORD_HOME_GUILD_ID
string
required
The Discord server (guild) ID where the bot operates.How to obtain:
  1. Enable Developer Mode in Discord (User Settings → Advanced → Developer Mode)
  2. Right-click your server icon
  3. Click “Copy Server ID”
Example:
DISCORD_HOME_GUILD_ID="1122953128703168532"
DISCORD_CLIENT_ID
string
required
The Discord application client ID.How to obtain:
  1. Go to Discord Developer Portal
  2. Select your application
  3. Copy the “Application ID” from General Information
Example:
DISCORD_CLIENT_ID="1234567890123456789"

Web Application Configuration

NEXT_PUBLIC_API_URL
string
required
Public URL for the backend API server.Development:
NEXT_PUBLIC_API_URL="http://localhost:4000"
Production:
NEXT_PUBLIC_API_URL="https://api.skyteam.dev"
The NEXT_PUBLIC_ prefix makes this variable available in the browser.

Admin Panel Configuration

ADMIN_JWT_SECRET
string
required
Secret key for signing JWT tokens in the admin panel.Generate a secure secret:
# Using OpenSSL
openssl rand -base64 32

# Using Node.js
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
Example:
ADMIN_JWT_SECRET="a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6"
Use a cryptographically secure random string. Never use a predictable value.

Development Configuration

NODE_ENV
string
default:"development"
Application environment mode.Valid values:
  • development - Development mode with hot reload and debug logging
  • production - Production mode with optimizations
  • test - Testing mode
Example:
NODE_ENV="development"

Complete Configuration Example

Here’s a complete .env file example:
# Database
DATABASE_URL="postgresql://skyteam:password@localhost:5432/skyteam"

# Discord Bot
DISCORD_TOKEN="MTIzNDU2Nzg5MDEyMzQ1Njc4OQ.GhIjKl.MnOpQrStUvWxYzAbCdEfGhIjKlMnOpQrStUv"
DISCORD_HOME_GUILD_ID="1122953128703168532"
DISCORD_CLIENT_ID="1234567890123456789"

# Web
NEXT_PUBLIC_API_URL="http://localhost:4000"

# Admin
ADMIN_JWT_SECRET="a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5z6"

# Dev
NODE_ENV="development"

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:
PORT=4000
CORS_ORIGIN="http://localhost:3000,http://localhost:3001"

Web Application (apps/web/)

Next.js applications can use .env.local for local overrides:
PORT=3000
NEXT_PUBLIC_API_URL="http://localhost:4000"

Admin Panel (apps/admin/)

Similar to the web application:
PORT=3001
NEXT_PUBLIC_API_URL="http://localhost:4000"
ADMIN_JWT_SECRET="your-secret-here"

Environment Variable Loading

SkyTeam uses dotenv-cli to load environment variables:
# Automatically loads .env file
pnpm dev

# Manually specify env file
dotenv -e .env.production -- pnpm build

Security Best Practices

1

Never Commit Secrets

The .env file is in .gitignore. Never commit it to version control.
.gitignore
.env
.env.local
.env.production
2

Use Strong Secrets

Generate cryptographically secure random strings for all secret keys:
# Generate 32-byte random string
openssl rand -base64 32
3

Rotate Secrets Regularly

Change sensitive tokens and secrets periodically, especially:
  • After team member changes
  • If you suspect a leak
  • As part of security maintenance
4

Use Different Values Per Environment

Never use the same secrets for development and production:
  • .env → Development
  • .env.production → Production
  • Use secret management tools in production (AWS Secrets Manager, HashiCorp Vault, etc.)

Docker Configuration

When using Docker, environment variables are passed via docker-compose.yml:
docker-compose.yml
services:
  api:
    environment:
      - NODE_ENV=production
      - DATABASE_URL=${DATABASE_URL}
      - ADMIN_JWT_SECRET=${ADMIN_JWT_SECRET}
See the Docker Setup guide for more details.

Validation

The application validates required environment variables on startup. If any are missing, you’ll see an error:
Error: DATABASE_URL environment variable is not set
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

Build docs developers (and LLMs) love