Overview
OWASP Nest uses environment variables for configuration across frontend (Next.js) and backend (Django) services. This page documents all available environment variables from.env.example files.
Frontend Environment Variables
Configured infrontend/.env.
Authentication
Secret key for NextAuth.js session encryption. Generate a secure random string.Example:
openssl rand -base64 32The canonical URL of your site. Used by NextAuth.js for redirects.Example:
http://localhost:3000/ (development)Example: https://nest.owasp.org/ (production)API Endpoints (Client-Side)
These variables are prefixed withNEXT_PUBLIC_ and accessible in browser JavaScript.
Base URL for the backend API.Example:
http://localhost:8000/ (development)Example: https://nest.owasp.org/ (production)Usage: Frontend components use this for API calls.Endpoint to fetch CSRF tokens for secure POST/PUT/DELETE requests.Example:
http://localhost:8000/csrf/Example: https://nest.owasp.org/csrf/GraphQL API endpoint.Example:
http://localhost:8000/graphql/Example: https://nest.owasp.org/graphql/Base URL for indexing/search service.Example:
http://localhost:8000/idx/API Endpoints (Server-Side)
These variables are only accessible in Next.js server-side code.Server-side CSRF endpoint. Used for SSR.Example:
http://backend:8000/csrf/ (Docker internal)Example: https://lambda-url.amazonaws.com/csrf/ (AWS)Server-side GraphQL endpoint.Example:
http://backend:8000/graphql/ (Docker internal)Example: https://lambda-url.amazonaws.com/graphql/ (AWS)GitHub OAuth
GitHub OAuth App Client ID.Setup: Create OAuth App at GitHub Developer Settings
GitHub OAuth App Client Secret.
Environment Configuration
Current environment identifier.Values:
local, development, staging, productionUsage: Toggle features and logging based on environment.Disable server-side rendering for debugging.Example:
false (enable SSR), true (disable SSR)Analytics and Monitoring
Google Tag Manager container ID.Example:
GTM-XXXXXXXUsage: Required for Google Tag Manager integration.PostHog project API key for product analytics.Example:
phc_abc123xyz456PostHog instance URL.Example:
https://us.i.posthog.comSentry Data Source Name for frontend error tracking.Example:
https://[email protected]/7890123Release Information
Current application version.Example:
1.0.5Usage: Displayed in UI and sent to error tracking services.Feature Flags
Enable Project Health Dashboard feature.Example:
trueBackend Environment Variables
Configured inbackend/.env.
Django Configuration
Django settings configuration class to load.Values:
Local, Test, ProductionExample: Local (development), Production (production)Django secret key for cryptographic signing.Example:
openssl rand -base64 50Usage: Session management, CSRF tokens, password reset tokens.Comma-separated list of allowed HTTP Host header values.Example:
* (development only)Example: nest.owasp.org,staging.nest.owasp.org (production)Usage: Prevents host header attacks.Database Configuration
PostgreSQL database hostname.Example:
db (Docker Compose)Example: localhost (local development)Example: nest-staging-db.abc123.us-east-1.rds.amazonaws.com (AWS RDS)PostgreSQL database name.Example:
production-nest-dbPostgreSQL database username.Example:
nest-user-productionPostgreSQL database password.
PostgreSQL database port.Example:
5432 (default PostgreSQL port)Redis Cache Configuration
Redis server hostname.Example:
production-nest-cache (Docker Compose)Example: nest-staging-redis.abc123.cache.amazonaws.com (ElastiCache)Redis authentication password.
Enable Redis password authentication.Example:
True (production - always use authentication)Algolia Search
Algolia Write API Key with
addObject permission.Setup: Generate from Algolia Dashboard → API KeysComma-separated list of index names to exclude in local development.Example:
projects_dev,users_devAI Services
OpenAI API key for AI features.Setup: Generate at OpenAI PlatformUsage: AI-powered features, embeddings, completions.
ElevenLabs API key for text-to-speech features.Setup: Generate at ElevenLabs
GitHub Integration
GitHub Personal Access Token for API access.Setup: Create at GitHub Settings → Developer settings → Personal access tokensPermissions:
repo, read:org, read:userUsage: Fetch OWASP project data, sync repositories, create issues.Slack Integration
Slack Bot User OAuth Token.Setup: Create Slack App → Install App → Copy Bot User OAuth TokenExample:
xoxb-123456789012-1234567890123-abcdefghijklmnopqrstuvwxUsage: Send notifications to Slack channels.Slack Signing Secret for webhook verification.Setup: Slack App → Basic Information → App Credentials → Signing SecretUsage: Verify requests from Slack webhooks.
AWS Services
AWS access key ID for S3 and other AWS services.Usage: File uploads, backups, static assets.
AWS secret access key.
Monitoring and Error Tracking
Sentry Data Source Name for backend error tracking.Example:
https://[email protected]/7890124Setup: Create project at Sentry.ioGeolocation
IP address for geolocation features in local development.Example:
127.0.0.1 (local)Example: 12.34.56.78 (production - use actual server IP)Usage: Geographic location-based functionality.Release Information
Current backend release version.Example:
1.0.5Usage: Error tracking, logs, version display.Docker Compose Environment Files
Production Docker Compose setup requires multiple.env files.
Cache Environment (.env.cache)
Redis authentication password.Example:
openssl rand -base64 32Database Environment (.env.db)
PostgreSQL database name.Example:
production-nest-dbPostgreSQL username.Example:
nest-user-productionPostgreSQL password.
AWS Parameter Store
For AWS deployments, secrets are stored in Systems Manager Parameter Store.Parameter Naming Convention
/nest/staging/DJANGO_SECRET_KEY
Required Parameters
All backendDJANGO_* and GITHUB_TOKEN variables should be stored as SecureString parameters with KMS encryption.
Navigate to AWS Console → Systems Manager → Parameter Store and populate:
/nest/staging/DJANGO_SECRET_KEY/nest/staging/DJANGO_ALGOLIA_APPLICATION_ID/nest/staging/DJANGO_ALGOLIA_WRITE_API_KEY/nest/staging/DJANGO_OPEN_AI_SECRET_KEY/nest/staging/DJANGO_SLACK_BOT_TOKEN/nest/staging/DJANGO_SLACK_SIGNING_SECRET/nest/staging/DJANGO_SENTRY_DSN/nest/staging/GITHUB_TOKEN/nest/staging/NEXTAUTH_SECRET/nest/staging/NEXT_SERVER_GITHUB_CLIENT_ID/nest/staging/NEXT_SERVER_GITHUB_CLIENT_SECRET
Security Best Practices
-
Never commit secrets to version control
- Use
.gitignoreto exclude.envfiles - Use AWS Parameter Store or similar for production
- Use
-
Use strong random values for secrets
-
Rotate secrets regularly
- Update passwords quarterly
- Regenerate API keys after team member departures
-
Use different secrets per environment
- Never reuse production secrets in staging/development
-
Restrict access to secrets
- Use IAM roles in AWS
- Limit Parameter Store access to specific users
-
Enable encryption at rest
- Use KMS-encrypted SecureString parameters in AWS
- Enable Redis AUTH
- Enable PostgreSQL SSL connections
-
Validate environment files
- Check UTF-8 encoding without BOM
- Verify no trailing whitespace
- Ensure proper key=value format
Environment File Template
Minimal required configuration for local development:backend/.env
frontend/.env
Troubleshooting
”Unexpected character” error
Cause:.env file has incorrect encoding (UTF-8 with BOM).
Solution: Save file as “UTF-8 without BOM” in your text editor.
In VS Code:
- Click encoding in bottom-right corner
- Select “Save with Encoding”
- Choose “UTF-8” (not “UTF-8 with BOM”)
Environment changes not applied
Cause: Application not restarted after.env changes.
Solution: Restart Docker containers:
Database connection refused
Cause: Database credentials mismatch between backend and database environment files. Solution: VerifyDJANGO_DB_* values in .env.backend match POSTGRES_* values in .env.db.
Redis authentication failed
Cause: Redis password mismatch. Solution: VerifyDJANGO_REDIS_PASSWORD matches REDIS_PASSWORD in .env.cache.
Algolia indexing fails
Cause: Invalid Algolia API key or missing permissions. Solution:- Verify
DJANGO_ALGOLIA_APPLICATION_IDandDJANGO_ALGOLIA_WRITE_API_KEY - Ensure API key has
addObjectpermission in Algolia Dashboard