Configuration File
Environment variables are defined in.env.example at the root of the repository. Copy this file to .env for local development:
PocketBase Configuration
POCKETBASE_URL
The URL where PocketBase is hosted. By default, the app connects to the Railway-hosted instance.When to override:
- Using a local PocketBase instance for development
- Self-hosting PocketBase separately from the main application
- Testing against a staging environment
Analytics Configuration
PUBLIC_ENABLE_ANALYTICS
Enables or disables analytics tracking throughout the application.Values:
true- Enable analyticsfalse- Disable analytics (default)
PUBLIC_ANALYTICS_SAMPLE_RATE
The sampling rate for analytics events. Controls what percentage of events are tracked.Values:
1- Track 100% of events (default)0.5- Track 50% of events0.1- Track 10% of events
Support Configuration
PUBLIC_SUPPORT_EMAIL
When set, displays a support email link on error pages and help sections.Example:If not set, no support contact will be displayed on error pages.
Media Upload Configuration
MEDIA_MAX_IMAGE_SIZE_MB
Maximum file size allowed for image uploads, in megabytes.Example:
MEDIA_MAX_IMAGE_COUNT
Maximum number of images that can be uploaded in a single request or post.Example:
MEDIA_MAX_VIDEO_SIZE_MB
Maximum file size allowed for video uploads, in megabytes.Example:
MEDIA_MAX_VIDEO_DURATION_SECONDS
Maximum duration allowed for video uploads, in seconds.Default: 300 seconds (5 minutes)Example:
Runtime Environment Variables
PORT
The port that Caddy will listen on for incoming HTTP requests. This is the external-facing port.Automatically set by:In Docker deployments, remember to update your port mapping:
- Railway
- Heroku
- Most PaaS platforms
NODE_ENV
The Node.js environment mode. Automatically set to
production in the Docker image.Values:production- Production mode (default in Docker)development- Development modetest- Test mode
Example Configurations
Development (Local)
Production (Docker)
Railway Deployment
Setting Environment Variables
Docker Run
Docker Compose
Railway
- Go to your project dashboard
- Click on “Variables” tab
- Add each variable as a key-value pair
- Redeploy for changes to take effect
Fly.io
Set secrets using the Fly CLI:Validation
Campus validates environment variables at startup. If any required variables are missing or invalid, the application will log an error and may fail to start. Check logs for validation errors:Security Best Practices
- Never commit
.envfiles - Add to.gitignore - Use platform secrets - For production deployments, use your platform’s secret management
- Rotate credentials - Regularly update sensitive values
- Limit access - Only grant environment variable access to necessary team members
- Audit changes - Track who changes environment variables and when
Next Steps
- Deployment Overview - General deployment information
- Docker Deployment - Deploy using Docker