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
| Variable | Required | Where to get it |
|---|---|---|
DATABASE_URL | Yes | Your Postgres provider. The pooled connection, used at runtime. |
DIRECT_URL | Yes | Your Postgres provider. The direct connection, used for migrations — see Database. |
Clerk
| Variable | Required | Where to get it |
|---|---|---|
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | Yes | Clerk Dashboard → API keys. |
CLERK_SECRET_KEY | Yes | Clerk Dashboard → API keys. |
App
| Variable | Required | Where to get it |
|---|---|---|
NEXT_PUBLIC_APP_URL | In production | Your site's URL, used for canonical links, the sitemap, and Stripe's return URLs. Defaults to http://localhost:3000 in development. |
Stripe
| Variable | Required | Where to get it |
|---|---|---|
STRIPE_SECRET_KEY | Yes | Stripe Dashboard → Developers → API keys. |
STRIPE_WEBHOOK_SECRET | Yes | Printed by stripe listen locally, or the webhook endpoint's signing secret in production — see Stripe Setup. |
NEXT_PUBLIC_PRICE_PRO_MONTHLY | No* | The Pro monthly Price ID — see Stripe Setup. |
NEXT_PUBLIC_PRICE_PRO_YEARLY | No* | The Pro yearly Price ID. |
NEXT_PUBLIC_PRICE_LIFETIME | No* | 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
| Variable | Required | Where to get it |
|---|---|---|
NEXT_PUBLIC_FORMSPREE_ENDPOINT | No | Your form's endpoint on Formspree. Powers the contact form. |
Sentry
All optional — leave NEXT_PUBLIC_SENTRY_DSN unset and Sentry sends nothing.
See Observability.
| Variable | Where to get it / what it does |
|---|---|
NEXT_PUBLIC_SENTRY_DSN | sentry.io → Settings → Projects → your project → Client Keys. |
SENTRY_ORG, SENTRY_PROJECT | Your Sentry org and project slugs, for uploading source maps. |
SENTRY_AUTH_TOKEN | A Sentry auth token (server-only), for uploading source maps. |
NEXT_PUBLIC_SENTRY_ENVIRONMENT | A label such as production or staging. |
NEXT_PUBLIC_SENTRY_TRACES_SAMPLE_RATE | Share of requests traced, 0–1. Unset: 1 in dev, 0.1 in production. |
NEXT_PUBLIC_SENTRY_LOG_LEVEL | Minimum console.* level forwarded to Sentry, e.g. warn. |
Adding your own variable
- Add it to
.env.example, so the next person knows it exists. - Add it to the schema in
src/lib/env.server.ts(server-only) orsrc/lib/env.ts(NEXT_PUBLIC_), and read it fromserverEnvorclientEnvinstead ofprocess.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.