Environment Settings

Environment variables configuration for Teak

Quick Setup

Configure 4 environment files:

Backend (backend/.env.local)

# Required
CONVEX_DEPLOYMENT=dev:name-123
CLERK_SECRET_KEY=sk_test_...

# Optional Features
OPENAI_API_KEY=sk_...                    # AI processing
POLAR_ACCESS_TOKEN=token                 # Billing
POLAR_SERVER=sandbox                     # sandbox|production
ADMIN_USERIDS=id1,id2                    # Admin access
CLOUDFLARE_BROWSER_RENDERING_ACCOUNT_ID=id # Screenshots
CLOUDFLARE_BROWSER_RENDERING_API_TOKEN=token
CLERK_JWT_ISSUER_DOMAIN=domain.clerk.accounts.dev

Web (apps/web/.env.local)

NEXT_PUBLIC_CONVEX_URL=https://deployment.convex.cloud
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
NEXT_PUBLIC_CLERK_FRONTEND_API_URL=https://domain.clerk.accounts.dev
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/login
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/register
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL=/

Mobile (apps/mobile/.env.local)

EXPO_PUBLIC_CONVEX_URL=https://deployment.convex.cloud
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
EXPO_PUBLIC_CLERK_FRONTEND_API_URL=https://domain.clerk.accounts.dev

Extension (apps/extension/.env.local)

VITE_PUBLIC_CONVEX_URL=https://deployment.convex.cloud
VITE_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
VITE_PUBLIC_CLERK_SYNC_HOST=http://localhost:3000

Getting Values

Convex

  1. Run bun run predev → creates deployment
  2. Backend: dev:name-123
  3. Frontend: https://name.convex.cloud

Clerk

  1. Create app at clerk.com
  2. Frontend: pk_test_... (Publishable Key)
  3. Backend: sk_test_... (Secret Key)
  4. Configure in Convex dashboard → Settings → Authentication

Environment Types

EnvironmentConvexClerk Keys
Developmentdev:name-123pk_test_... / sk_test_...
ProductionProduction deploymentpk_live_... / sk_live_...

Feature Flags

FeatureRequired Env VarWhat it Enables
AI ProcessingOPENAI_API_KEYAuto-tags, summaries, categorization
ScreenshotsCLOUDFLARE_BROWSER_RENDERING_*Link preview thumbnails
BillingPOLAR_ACCESS_TOKENSubscription management
Admin DashboardADMIN_USERIDSPipeline insights, monitoring

Testing

E2E_CLERK_USER_EMAIL=test@example.com
E2E_CLERK_USER_PASSWORD=password123