Environment Variables
Every environment variable with descriptions and defaults.
Overview
Foundry uses Nuxt's runtime config for environment variables. Variables prefixed with NUXT_PUBLIC_ are available client-side. All others are server-only.
All Variables
| Variable | Module | Category | Scope | Required | Description |
|---|---|---|---|---|---|
NUXT_PUBLIC_SITE_URL | core | Site | Public | Yes | Your production URL (e.g., https://mysite.com). Used for SEO, OG images, and RSS feeds. |
NUXT_WEBHOOK_URL | events | Webhooks | Server | No | Webhook destination URL(s). Comma-separated for multiple. Auto-detects platform (Discord, Slack, Telegram). |
NUXT_TELEGRAM_CHAT_ID | events | Webhooks | Server | No | Telegram chat ID. Required when using a Telegram bot webhook URL. |
NUXT_PUBLIC_SCRIPTS_UMAMI_ANALYTICS_WEBSITE_ID | events | Analytics | Public | No | Umami website ID for analytics tracking. |
NUXT_PUBLIC_SCRIPTS_UMAMI_ANALYTICS_SCRIPT_INPUT_SRC | events | Analytics | Public | No | Umami script URL (self-hosted or cloud). |
NUXT_SENTRY_DSN | core | Logging | Server | No | Sentry DSN for error tracking and log drain. |
NUXT_AXIOM_TOKEN | core | Logging | Server | No | Axiom API token for log drain. |
NUXT_AXIOM_DATASET | core | Logging | Server | No | Axiom dataset name for log drain. |
NUXT_POSTHOG_API_KEY | core | Logging | Server | No | PostHog API key for log drain. |
CI | core | Build | Build | No | Set to 'true' to enable CI-specific prerendering behavior. |
CI_PRERENDER | core | Build | Build | No | Enables prerender routes during CI builds. |
Platform Auto-Detection
When NUXT_PUBLIC_SITE_URL is not set, Foundry attempts to detect the URL from platform-specific variables:
| Platform | Variable | Example |
|---|---|---|
| Vercel | NEXT_PUBLIC_VERCEL_URL | myapp.vercel.app |
| Netlify | URL | https://myapp.netlify.app |
| GitLab Pages | CI_PAGES_URL | https://myorg.gitlab.io/myapp |
| Cloudflare Pages | CF_PAGES_URL | https://myapp.pages.dev |
Always set NUXT_PUBLIC_SITE_URL explicitly in production for reliable behavior.
Runtime Config Mapping
Environment variables map to Nuxt runtime config:
// nuxt.config.ts (layer defaults)
export default defineNuxtConfig({
runtimeConfig: {
// Server-only (NUXT_ prefix)
webhookUrl: '', // ← NUXT_WEBHOOK_URL
telegramChatId: '', // ← NUXT_TELEGRAM_CHAT_ID
// Client-accessible (NUXT_PUBLIC_ prefix)
public: {
debug: true,
siteUrl: '', // ← NUXT_PUBLIC_SITE_URL
scripts: {
umamiAnalytics: {
websiteId: '', // ← NUXT_PUBLIC_SCRIPTS_UMAMI_ANALYTICS_WEBSITE_ID
scriptInput: {
src: '', // ← NUXT_PUBLIC_SCRIPTS_UMAMI_ANALYTICS_SCRIPT_INPUT_SRC
},
},
},
},
},
})
Access in your code:
// Server-side
const { webhookUrl, telegramChatId } = useRuntimeConfig()
// Client or server
const { public: { siteUrl } } = useRuntimeConfig()
.env File
Create a .env file in your project root:
.env
# Required
NUXT_PUBLIC_SITE_URL=https://mysite.com
# Signal capture
NUXT_WEBHOOK_URL=https://discord.com/api/webhooks/...
# Analytics (optional)
NUXT_PUBLIC_SCRIPTS_UMAMI_ANALYTICS_WEBSITE_ID=abc123
NUXT_PUBLIC_SCRIPTS_UMAMI_ANALYTICS_SCRIPT_INPUT_SRC=https://analytics.mysite.com/script.js
Never commit .env files. Add .env to .gitignore.