Environment Variables
Required environment variables and how they're validated.
YeetCode uses type-safe environment variable validation via @t3-oss/env-core with Zod schemas. Variables are validated at runtime — if a required variable is missing or invalid, the app fails fast with a clear error message.
Convex Backend Variables
These must be set in your Convex deployment's environment variables (Convex Dashboard → Settings → Environment Variables).
| Variable | Required | Description |
|---|---|---|
CLERK_WEBHOOK_SECRET | Yes | Svix signing secret from Clerk's webhook settings |
CLERK_JWT_ISSUER_DOMAIN | Yes | Clerk JWT issuer domain (e.g., https://your-app.clerk.accounts.dev) |
Validation
Environment variables are validated in apps/convex/env.ts:
import { createEnv } from "@t3-oss/env-core";
import { z } from "zod";
export const env = createEnv({
server: {
CLERK_WEBHOOK_SECRET: z.string().min(1),
CLERK_JWT_ISSUER_DOMAIN: z.string().min(1),
},
runtimeEnv: {
CLERK_WEBHOOK_SECRET: process.env.CLERK_WEBHOOK_SECRET,
CLERK_JWT_ISSUER_DOMAIN: process.env.CLERK_JWT_ISSUER_DOMAIN,
},
skipValidation: false,
});Access validated variables anywhere in the backend:
import { env } from "./env";
const secret = env.CLERK_WEBHOOK_SECRET; // Type-safe, guaranteed to existConvex Auto-Generated Variables
These are managed by Convex automatically and don't need manual configuration:
| Variable | Description |
|---|---|
CONVEX_DEPLOYMENT | Your deployment identifier |
CONVEX_URL | Your deployment URL |
Local .env.local
The Convex CLI generates apps/convex/.env.local automatically when you run convex dev and select or create a project. You don't need to create this file manually — it contains your CONVEX_DEPLOYMENT and CONVEX_URL values.
Application secrets (CLERK_WEBHOOK_SECRET, CLERK_JWT_ISSUER_DOMAIN) are not set in .env.local — they must be configured in the Convex Dashboard (Settings → Environment Variables) since Convex functions run in the cloud.
Turborepo Integration
All .env files are listed as global dependencies in turbo.json:
{
"globalDependencies": ["**/.env"]
}This means any environment variable change invalidates Turborepo's build cache, ensuring fresh builds when configuration changes.
Security
.envand.env*.localfiles are in.gitignore— they are never committed- Environment validation runs with
skipValidation: false— the app will not start with missing variables - Webhook secrets are only used server-side in Convex actions