Configuration File
Create a.env file in the root of your Forge installation with the following variables:
Required Variables
These environment variables are essential for Forge to function properly.Application URLs
The public URL of your Forge application.Examples:
- Development:
http://localhost:3000 - Production:
https://forge.yourdomain.com
Authentication
A secret key used for session encryption and signing in BetterAuth.Requirements:
- Must be a strong, random string
- Minimum 32 characters recommended
- Keep this secret and never commit it to version control
The full URL of your BetterAuth instance, which is the same as your application’s URL.Examples:
- Development:
http://localhost:3000 - Production:
https://forge.yourdomain.com
NEXT_PUBLIC_APP_URL.Database
PostgreSQL database connection string.Format:Examples:
Forge uses Drizzle ORM with the
node-postgres driver. Make sure your PostgreSQL version is 12 or higher.Redis
The REST URL for your Upstash Redis instance.Format:Where to find it:
- Log in to Upstash Console
- Select your Redis database
- Copy the “REST URL” from the dashboard
The REST token for authenticating with your Upstash Redis instance.Where to find it:
- Log in to Upstash Console
- Select your Redis database
- Copy the “REST TOKEN” from the dashboard
Blob Storage
Access token for blob storage (Vercel Blob or compatible service).Used for:
- User profile picture uploads
- Widget file attachments
- Any user-uploaded content
- Go to your Vercel Dashboard
- Navigate to Storage > Blob
- Create a new Blob store or use an existing one
- Copy the
BLOB_READ_WRITE_TOKEN
The blob storage implementation uses
@vercel/blob package. If you’re not using Vercel, you may need to modify the upload implementation in src/app/api/upload/route.ts.Optional Variables
These environment variables enable additional features and widget integrations. Forge will work without them, but certain widgets will not be functional.GitHub Integration
Required for GitHub widget, GitHub Heatmap widget, and GitHub OAuth login.OAuth Client ID from your GitHub OAuth App.Required scopes:
repo- Access to repositoriesuser:email- Access to user email addresses
- Go to GitHub Developer Settings
- Click “New OAuth App”
- Set Authorization callback URL to:
{BETTER_AUTH_URL}/api/auth/callback/github - Copy the Client ID
OAuth Client Secret from your GitHub OAuth App.Where to find it:
- In your GitHub OAuth App settings, generate a new client secret
- Copy it immediately (it won’t be shown again)
Google Integration
Required for Meetings widget (Google Calendar) and Inbox widget (Gmail).OAuth 2.0 Client ID from Google Cloud Console.Required scopes:
https://www.googleapis.com/auth/calendar- Google Calendar accesshttps://www.googleapis.com/auth/gmail.readonly- Gmail read access
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable Google Calendar API and Gmail API
- Go to “Credentials” > “Create Credentials” > “OAuth 2.0 Client ID”
- Add authorized redirect URI:
{BETTER_AUTH_URL}/api/auth/callback/google - Copy the Client ID
OAuth 2.0 Client Secret from Google Cloud Console.Where to find it:
- In your Google Cloud Console OAuth 2.0 Client credentials
- Download the JSON file or copy the client secret directly
select_account consent prompt to ensure refresh tokens are provided.Notion Integration
Required for Notion widget integration.OAuth Client ID from your Notion integration.Setup instructions:
- Go to Notion Integrations
- Create a new integration
- Set the Redirect URI to:
{BETTER_AUTH_URL}/api/auth/callback/notion - Copy the OAuth client ID
OAuth Client Secret from your Notion integration.Where to find it:
- In your Notion integration settings under “Secrets”
- Copy the client secret
Coinbase Integration
Required for Crypto widget (cryptocurrency price tracking).API Key from Coinbase Exchange (also used as CB-ACCESS-KEY).Setup instructions:
- Go to Coinbase Exchange
- Navigate to Settings > API
- Create a new API key
- Copy the API Key (this is your Client ID)
Forge uses the Coinbase Exchange API, not the standard Coinbase API. Make sure you’re creating keys on the Exchange platform.
API Secret/Passphrase from Coinbase Exchange (also used as CB-ACCESS-PASSPHRASE).Where to find it:
- When creating your Coinbase Exchange API key, you’ll receive a passphrase
- Save this securely - it cannot be retrieved later
- View permissions for product information and price data
Environment-Specific Configuration
Development
.env.development
Production
.env.production
Security Best Practices
Recommendations
- Use different secrets for each environment - Don’t reuse production secrets in development
- Rotate secrets regularly - Especially for production environments
- Use strong random strings - For
BETTER_AUTH_SECRET, use at least 32 characters - Limit OAuth scopes - Only request the minimum scopes needed for functionality
- Use environment-specific OAuth apps - Create separate OAuth applications for development and production
- Store secrets securely - Use secret management tools like Vault, AWS Secrets Manager, or your platform’s secret storage
Validation
Forge validates environment variables at runtime. If required variables are missing, you’ll see errors in the console:Next Steps
Setup Guide
Complete installation and setup instructions
Deployment
Deploy Forge to production platforms