Skip to content

Brisket Environment Variables

Brisket validates env vars with @t3-oss/env-nextjs in apps/brisket/src/env.js. Variables fall into two pools:

  • server — accessible only in Node runtime (route handlers, server components, tRPC procedures, middleware). Never bundled into client JS.
  • client — must be prefixed NEXT_PUBLIC_; values are inlined into the browser bundle at build time. Treat all values as public.

Empty strings are coerced to undefined (emptyStringAsUndefined: true). Set SKIP_ENV_VALIDATION=1 to bypass validation in Docker builds. Reference: apps/brisket/.env.example.

Exposure Boundary

flowchart LR
subgraph Server[Node runtime — server-only]
S1[CLERK_SECRET_KEY]
S2[CHARGE_BEE_API_KEY]
S3[STRAPI_TOKEN]
S4[CF_TURNSTILE_SECRET_KEY]
S5[INTERCOM_API_TOKEN]
S6[SIRLOIN_URL]
end
subgraph Client[Browser bundle — public]
C1[NEXT_PUBLIC_*]
end

Anything required by the client: schema in env.js is shipped to every visitor. Anything in server: stays in the Node process. Crossing the boundary the wrong way (e.g. importing env.CLERK_SECRET_KEY in a client component) will fail the build.

Server Variables

VariableRequiredDefaultSourcePurpose
CLERK_SECRET_KEYyesClerk dashboardAuth backend secret used by @clerk/nextjs/server and middleware.
CLERK_WEBHOOK_SECRETyesClerk dashboard → webhooksVerifies Svix signatures on /api/webhook/clerk.
NODE_ENVyesdevelopmentruntimeStandard Node env.
BRISKET_STAGEyesdevelopmentdeploy config / RAILWAY_ENVIRONMENT_NAME fallbackOne of production | staging | sandbox | development. Resolved via resolveBrisketStageInput in src/stage.js. Drives feature gating and logging.
SIRLOIN_URLyesservice discoverygRPC base URL for sirloin (server/api/sirloin-api.ts).
FACEBOOK_ACCESS_TOKENyesMeta BusinessServer-side conversions API for ad attribution.
CHARGE_BEE_API_KEYyesChargebeeServer-side Chargebee REST calls.
CHARGE_BEE_PAYPAL_PRO_GATEWAYyesChargebeePayPal Pro gateway selector for billing.
STRAPI_URLyeschuck deployHeadless CMS base URL (FAQ, marketing).
STRAPI_TOKENyeschuck adminBearer token for Strapi reads.
CF_TURNSTILE_SECRET_KEYoptionalCloudflare TurnstileServer-side validation of Turnstile tokens during checkout.
INTERCOM_API_TOKENoptionalIntercomUsed by intercom tRPC router; soft-failure if unset.

OTel exporters use BRISKET_OTEL_URL, BRISKET_OTEL_METRICS_HEADERS, BRISKET_OTEL_TRACES_LOGS_HEADERS from .env.example. Not validated by env.js — consumed directly in the OTel bootstrap at apps/brisket/otel.server.config.ts (trace/metric/log exporter URLs and headers) and gated by apps/brisket/src/otel-runtime-config.ts (shouldEnableMetrics / shouldEnableTraces only enable the SDK if both URL and the corresponding header are non-empty).

Client Variables (NEXT_PUBLIC_*)

All values below are baked into the client bundle. Do not store secrets here.

VariableRequiredDefaultSourcePurpose
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYyesClerkBrowser-side Clerk SDK init.
NEXT_PUBLIC_CLERK_SIGN_IN_URLyes/sign-instaticClerk redirect target.
NEXT_PUBLIC_CLERK_SIGN_UP_URLyes/sign-upstaticClerk redirect target.
NEXT_PUBLIC_POSTHOG_KEYyesPostHog projectBrowser PostHog init.
NEXT_PUBLIC_POSTHOG_HOSTyesPostHogEU/US ingest host.
NEXT_PUBLIC_CHARGE_BEE_SITEyesChargebeeSite slug for Chargebee.js.
NEXT_PUBLIC_CHARGE_BEE_PUBLISHABLE_KEYyesChargebeePublishable key for Chargebee.js.
NEXT_PUBLIC_APP_URLoptionaldeployCanonical app origin (used in metadata, redirects).
NEXT_PUBLIC_FACEBOOK_PIXEL_IDyesMetaPixel ID for client tracking.
NEXT_PUBLIC_DEV_FEATURESoptionallocal / stagingToggles dev-only UI surfaces ("true").
NEXT_PUBLIC_FORCE_DEV_KLAVIYOoptionallocalForces Klaviyo to run in dev.
NEXT_PUBLIC_CF_TURNSTILE_SITE_KEYoptionalCloudflarePublic Turnstile site key for the checkout widget.
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYoptionalStripeStripe.js init when Stripe gateway is active.
NEXT_PUBLIC_GOOGLE_MAPS_API_KEYoptionalGCPMaps JS for billing-address autocomplete.
NEXT_PUBLIC_KLAVIYO_PUBLIC_KEYoptionalKlaviyoKlaviyo browser SDK. Not in env.js schema; consumed directly via process.env in apps/brisket/src/features/analytics/klaviyo/klaviyo-tracking-script/index.tsx (script src + early-exit when blank). Pair with NEXT_PUBLIC_FORCE_DEV_KLAVIYO=true to enable in dev.

Stage Resolution

BRISKET_STAGE is resolved by resolveBrisketStageInput(BRISKET_STAGE, RAILWAY_ENVIRONMENT_NAME, NODE_ENV) in apps/brisket/src/stage.js. Railway environments map to stages so deployments don’t need to set BRISKET_STAGE explicitly.

Local Setup

Copy .env.example to .env.local and fill in dev credentials. The 1Password vault holds the canonical dev values — TODO(@marty): vault item name. Run pnpm --filter brisket dev after env is in place; missing required vars will fail at startup with a Zod aggregate error.