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

VariableModuleCategoryScopeRequiredDescription
NUXT_PUBLIC_SITE_URLcoreSitePublicYesYour production URL (e.g., https://mysite.com). Used for SEO, OG images, and RSS feeds.
NUXT_WEBHOOK_URLeventsWebhooksServerNoWebhook destination URL(s). Comma-separated for multiple. Auto-detects platform (Discord, Slack, Telegram).
NUXT_TELEGRAM_CHAT_IDeventsWebhooksServerNoTelegram chat ID. Required when using a Telegram bot webhook URL.
NUXT_PUBLIC_SCRIPTS_UMAMI_ANALYTICS_WEBSITE_IDeventsAnalyticsPublicNoUmami website ID for analytics tracking.
NUXT_PUBLIC_SCRIPTS_UMAMI_ANALYTICS_SCRIPT_INPUT_SRCeventsAnalyticsPublicNoUmami script URL (self-hosted or cloud).
NUXT_SENTRY_DSNcoreLoggingServerNoSentry DSN for error tracking and log drain.
NUXT_AXIOM_TOKENcoreLoggingServerNoAxiom API token for log drain.
NUXT_AXIOM_DATASETcoreLoggingServerNoAxiom dataset name for log drain.
NUXT_POSTHOG_API_KEYcoreLoggingServerNoPostHog API key for log drain.
CIcoreBuildBuildNoSet to 'true' to enable CI-specific prerendering behavior.
CI_PRERENDERcoreBuildBuildNoEnables 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:

PlatformVariableExample
VercelNEXT_PUBLIC_VERCEL_URLmyapp.vercel.app
NetlifyURLhttps://myapp.netlify.app
GitLab PagesCI_PAGES_URLhttps://myorg.gitlab.io/myapp
Cloudflare PagesCF_PAGES_URLhttps://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.