Environment Variables (Self-Host Reference)
Most teams run Weldr in the hosted cloud, where environment management is handled for you. If you are self-hosting (see docs/getting-started/installation.md
), use this cheat-sheet to configure the minimum variables and optional integrations.
1. Required Locally
Create .env.local
in the repo root and set:
OPENROUTER_API_KEY=sk-or-v1-...
POSTGRES_URL=postgresql://user:password@localhost:5432/weldr
AUTH_SECRET=32-plus-character-secret
NEXTAUTH_URL=http://localhost:3000
OPENROUTER_API_KEY
– Enables DSL extraction and generation.POSTGRES_URL
– Points to your Postgres or Supabase instance. Append ?sslmode=prefer
(local) or ?sslmode=require
(managed).AUTH_SECRET
– Generate with openssl rand -base64 32
.NEXTAUTH_URL
– Must match the origin you use in the browser.2. Database Options
| Scenario | Connection string example |
|----------|---------------------------|
| Local Postgres | postgresql://postgres:password@localhost:5432/weldr
|
| Supabase | postgresql://postgres:
|
| Neon | postgresql://user:password@neon-host/db?sslmode=require
|
Set POSTGRES_URL
to whichever string matches your provider. Use connection pooling parameters (pgbouncer=true
, connection_limit=1
) in serverless environments.
3. Authentication Extras (Optional)
# Magic link emails
EMAIL_FROM=noreply@yourdomain.com
EMAIL_SERVER_HOST=smtp.sendgrid.net
EMAIL_SERVER_PORT=587
EMAIL_SERVER_USER=apikey
EMAIL_SERVER_PASSWORD=sendgrid-api-key
# Social providers
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
GITHUB_CLIENT_ID=...
GITHUB_CLIENT_SECRET=...
If you leave these unset, the hosted login flow (magic links) still works for development.
4. Observability & Integrations (Optional)
# Analytics / error tracking
NEXT_PUBLIC_POSTHOG_KEY=phc_...
NEXT_PUBLIC_POSTHOG_HOST=https://app.posthog.com
SENTRY_DSN=https://...ingest.sentry.io/...
SENTRY_ENVIRONMENT=production
# Caching
REDIS_URL=redis://localhost:6379
REDIS_PASSWORD=...
Set only the services you actually run; Weldr checks for presence before enabling integrations.
5. Rate & Feature Limits (Advanced)
# Customize limits when hosting your own instance
MAX_MESSAGES_FREE=50
MAX_MESSAGES_PRO=200
MAX_REGENS_FREE=10
MAX_REGENS_PRO=50
These match the defaults described in docs/pricing-and-accounts.md
. Adjust cautiously—raising limits without additional infrastructure may impact stability.
6. Production Deployment Tips
AUTH_SECRET
per environment..env.local
.weldr contracts check
and your CI suite before flipping ownership modes in production.Need more detail? Pair this reference with the self-host installation guide and the pricing overview for tier-specific limits.