Skip to main content
DelightBridge requires several environment variables to connect to external services. These variables must be configured in your .env.local file for local development and in your Vercel project settings for production.

Required Variables

These environment variables are required for DelightBridge to function properly.

ANTHROPIC_API_KEY

Purpose: Authenticates requests to Anthropic’s Claude API for AI-powered draft generation, translation, and refinement. Format: sk-ant-... Where to get it:
  1. Sign up or log in at console.anthropic.com
  2. Navigate to API Keys section
  3. Create a new API key
  4. Copy the key (it starts with sk-ant-)
Example:
ANTHROPIC_API_KEY=sk-ant-api03-xyz123...

DATABASE_URL

Purpose: PostgreSQL connection string for Neon DB. Used by Drizzle ORM to connect to your database. Format: postgresql://[user]:[password]@[endpoint].neon.tech/[database]?sslmode=require Where to get it:
  1. Create a Neon project at neon.tech
  2. Copy the connection string from the project dashboard
  3. Ensure it includes ?sslmode=require at the end
Example:
DATABASE_URL=postgresql://user:[email protected]/delightbridge?sslmode=require
The DATABASE_URL is used by both the application runtime and Drizzle CLI commands (pnpm db:push, pnpm db:seed).

GOOGLE_CLIENT_ID

Purpose: OAuth 2.0 client ID for Google authentication. Used for both:
  • App user authentication (NextAuth)
  • Service Gmail connection (Gmail API access)
Format: [random-string].apps.googleusercontent.com Where to get it: See OAuth Setup for detailed instructions. Example:
GOOGLE_CLIENT_ID=123456789-abcdefghijklmnop.apps.googleusercontent.com

GOOGLE_CLIENT_SECRET

Purpose: OAuth 2.0 client secret that pairs with GOOGLE_CLIENT_ID. Format: Random alphanumeric string Where to get it: See OAuth Setup for detailed instructions. Example:
GOOGLE_CLIENT_SECRET=GOCSPX-abcd1234efgh5678ijkl
Never commit GOOGLE_CLIENT_SECRET to version control. Keep it secure in environment variables only.

AUTH_SECRET

Purpose: Secret key used by NextAuth to encrypt session tokens and cookies. Format: Random string (minimum 32 characters recommended) How to generate:
openssl rand -base64 32
Or use any secure random string generator. Example:
AUTH_SECRET=your-super-secret-random-string-here-min-32-chars
Use different AUTH_SECRET values for development and production environments.

ADMIN_EMAILS

Purpose: Comma-separated list of email addresses that should have admin access to DelightBridge. Admin users can:
  • Manage services and Gmail connections
  • Access all workspace features
  • Manage workspace members and permissions
  • Trigger manual syncs
Format: Comma-separated email addresses (no spaces) Example:
Users listed in ADMIN_EMAILS automatically receive admin permission, even if they’re also in the workspace_members table with a lower permission level.

CRON_SECRET

Purpose: Authentication token for protecting the Gmail sync cron endpoint. Vercel cron jobs send this secret to verify they’re authorized to trigger syncs. Format: Random string How to generate:
openssl rand -hex 32
Example:
CRON_SECRET=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
Usage: The cron endpoint /api/cron/sync-gmail checks for this secret in:
  • Authorization: Bearer <CRON_SECRET> header, OR
  • x-cron-secret: <CRON_SECRET> header
Set the same CRON_SECRET value in Vercel environment variables. Without it, automatic Gmail sync will fail.

Optional Variables

These variables have default values but can be customized.

CRON_SYNC_MAX_ACCOUNTS

Purpose: Maximum number of Gmail accounts to sync per cron run (every 5 minutes). Prevents timeouts and API rate limit issues when managing many services. Default: 20 Format: Positive integer Example:
CRON_SYNC_MAX_ACCOUNTS=20
Behavior: If you have more connected services than this limit, the cron job processes them in round-robin fashion across multiple runs.
For most deployments, the default value of 20 is sufficient. Only increase if you have faster infrastructure and higher Gmail API quotas.

Environment File Examples

Local Development (.env.local)

# AI Service
ANTHROPIC_API_KEY=sk-ant-api03-xyz123...

# Database
DATABASE_URL=postgresql://user:[email protected]/delightbridge?sslmode=require

# Google OAuth (for both app auth and Gmail API)
GOOGLE_CLIENT_ID=123456789-abcdefghijklmnop.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-abcd1234efgh5678ijkl

# NextAuth
AUTH_SECRET=your-local-dev-secret-min-32-characters-long

# Access Control
ADMIN_EMAILS=[email protected]

# Cron Security
CRON_SECRET=your-local-cron-secret-random-hex-string

# Cron Configuration (optional)
CRON_SYNC_MAX_ACCOUNTS=20

Production (Vercel)

In your Vercel project settings, add the same variables with production values:
  • Use a different AUTH_SECRET for production
  • Use the production Neon database connection string
  • Ensure CRON_SECRET matches between environment variables and cron headers
  • Update ADMIN_EMAILS with production admin email addresses

Validation Checklist

Before running DelightBridge, verify:
  • All required variables are set
  • DATABASE_URL includes ?sslmode=require
  • GOOGLE_CLIENT_ID ends with .apps.googleusercontent.com
  • AUTH_SECRET is at least 32 characters
  • ADMIN_EMAILS contains valid email addresses
  • CRON_SECRET is set to a secure random string
  • OAuth redirect URIs are configured in Google Cloud Console

Common Issues

”Invalid connection string” error

Ensure DATABASE_URL ends with ?sslmode=require for Neon DB.

”Unauthorized” when accessing the app

Verify your email is in ADMIN_EMAILS or added to workspace members via Settings.

Cron sync fails with 401

Check that CRON_SECRET is set in Vercel environment variables and matches the value expected by the endpoint.

Gmail API quota exceeded

Reduce CRON_SYNC_MAX_ACCOUNTS or increase the cron interval in vercel.json.

Build docs developers (and LLMs) love