Skip to main content
GoodCraft Script requires several environment variables to run. This guide covers all required and optional variables.

Required variables

These variables must be set for the application to start.

Database

DATABASE_URL
string
required
PostgreSQL connection string.
postgres://user:password@host:5432/database
On Render, this is automatically injected from the linked PostgreSQL service.

Authentication (Clerk)

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
string
required
Clerk publishable key for client-side authentication.Find this in Clerk Dashboard > API Keys.
pk_live_xxxxx
CLERK_SECRET_KEY
string
required
Clerk secret key for server-side authentication.Find this in Clerk Dashboard > API Keys.
sk_live_xxxxx

Optional variables

These variables enable additional features.

Logging

LOGTAIL_SOURCE_TOKEN
string
BetterStack (Logtail) source token for centralized logging.Find this in BetterStack Logs > Sources.
abc123xyz

Application

NEXT_PUBLIC_APP_URL
string
Public URL of your application. Used for generating absolute URLs.
https://script.goodcraft.io
NODE_ENV
string
default:"development"
Environment mode. Set to production for production deployments.Values: development, production, test

Example configuration

Local development (.env.local)

# Database
DATABASE_URL=postgres://localhost:5432/goodcraft_dev

# Clerk (use test keys for development)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxxxx
CLERK_SECRET_KEY=sk_test_xxxxx

# Optional
LOGTAIL_SOURCE_TOKEN=
NEXT_PUBLIC_APP_URL=http://localhost:3000

Production

# Database (set by Render)
DATABASE_URL=postgres://user:pass@host:5432/goodcraft_prod

# Clerk (use live keys)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_xxxxx
CLERK_SECRET_KEY=sk_live_xxxxx

# Logging
LOGTAIL_SOURCE_TOKEN=your_token_here

# Application
NEXT_PUBLIC_APP_URL=https://script.goodcraft.io
NODE_ENV=production

Security notes

Never commit environment variables to version control. Use .env.local for local development and environment variable settings in your hosting platform for production.
  • Keep secrets secret - CLERK_SECRET_KEY and DATABASE_URL contain sensitive credentials
  • Use live vs test keys - Clerk provides separate keys for development and production
  • Rotate compromised keys - If a key is exposed, regenerate it immediately in the respective dashboard

Checking configuration

The application logs missing required variables on startup:
Error: Missing required environment variable: CLERK_SECRET_KEY
You can also check the health endpoint:
curl https://your-app.com/api/health
Returns 200 OK if all required variables are configured correctly.