ShiftFast Docs

Configuration

Every environment variable the app reads, and where to get each value.

All environment variables live in .env (copied from .env.example). The app validates them with Zod at startup — src/lib/env.ts for client-safe variables, src/lib/env.server.ts for server-only ones — and refuses to start if a required one is missing, naming it in the error.

Minimum to run locally: the two Clerk keys, STRIPE_SECRET_KEY, and STRIPE_WEBHOOK_SECRET. The database URLs in .env.example already match the local Postgres container, and everything else can wait.

Never commit .env or expose a secret to the client. Anything prefixed NEXT_PUBLIC_ is bundled into the browser JavaScript — only put values there that are safe to publish.

Database

VariableRequiredWhere to get it
DATABASE_URLYesYour Postgres provider. The pooled connection, used at runtime.
DIRECT_URLYesYour Postgres provider. The direct connection, used for migrations — see Database.

Clerk

VariableRequiredWhere to get it
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYYesClerk Dashboard → API keys.
CLERK_SECRET_KEYYesClerk Dashboard → API keys.

App

VariableRequiredWhere to get it
NEXT_PUBLIC_APP_URLIn productionYour site's URL, used for canonical links, the sitemap, and Stripe's return URLs. Defaults to http://localhost:3000 in development.

Stripe

VariableRequiredWhere to get it
STRIPE_SECRET_KEYYesStripe Dashboard → Developers → API keys.
STRIPE_WEBHOOK_SECRETYesPrinted by stripe listen locally, or the webhook endpoint's signing secret in production — see Stripe Setup.
NEXT_PUBLIC_PRICE_PRO_MONTHLYNo*The Pro monthly Price ID — see Stripe Setup.
NEXT_PUBLIC_PRICE_PRO_YEARLYNo*The Pro yearly Price ID.
NEXT_PUBLIC_PRICE_LIFETIMENo*The Lifetime one-time Price ID.

* The app starts without them, but checkout for that plan fails until they're set. There's one variable per price in src/config/billing.ts, so the names follow your own plans — see Billing.

Formspree

VariableRequiredWhere to get it
NEXT_PUBLIC_FORMSPREE_ENDPOINTNoYour form's endpoint on Formspree. Powers the contact form.

Sentry

All optional — leave NEXT_PUBLIC_SENTRY_DSN unset and Sentry sends nothing. See Observability.

VariableWhere to get it / what it does
NEXT_PUBLIC_SENTRY_DSNsentry.io → Settings → Projects → your project → Client Keys.
SENTRY_ORG, SENTRY_PROJECTYour Sentry org and project slugs, for uploading source maps.
SENTRY_AUTH_TOKENA Sentry auth token (server-only), for uploading source maps.
NEXT_PUBLIC_SENTRY_ENVIRONMENTA label such as production or staging.
NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATEShare of requests traced, 0–1. Unset: 1 in dev, 0.1 in production.
NEXT_PUBLIC_SENTRY_LOG_LEVELMinimum console.* level forwarded to Sentry, e.g. warn.

Adding your own variable

  1. Add it to .env.example, so the next person knows it exists.
  2. Add it to the schema in src/lib/env.server.ts (server-only) or src/lib/env.ts (NEXT_PUBLIC_), and read it from serverEnv or clientEnv instead of process.env.

In src/lib/env.ts, write each variable as its own process.env.NAME expression, as the existing ones are — Next.js only inlines NEXT_PUBLIC_ values written that way.

NEXT_PUBLIC_ values are baked into the bundle when it's built. If a changed value doesn't show up, restart the dev server; in production, rebuild.

On this page