Configuration File
Create a.env file in your project root with the following variables:
Required Variables
These variables are essential for ZapDev to function.Application URL
The base URL of your application. Use
http://localhost:3000 for development, or your production domain for deployment.Example: https://zapdev.example.comClerk Authentication
Public key for Clerk authentication. Get this from Clerk Dashboard → Your App → API Keys.Format:
pk_test_... or pk_live_...Secret key for Clerk authentication. Get this from Clerk Dashboard → Your App → API Keys.Format:
sk_test_... or sk_live_...Security: Never commit this to version control.JWT issuer domain for Convex integration. Get this from Clerk Dashboard → JWT Templates → Convex template.Example:
https://your-app.clerk.accounts.devName of the JWT template for Convex. Must be set to
"convex".Default: convexConvex Database
Your Convex deployment URL. Get this from Convex Dashboard after creating a project.Format:
https://your-project.convex.cloudThe site URL for Convex authentication. Should match your application URL.Example:
https://zapdev.example.comStack Auth (Authentication)
Your Stack Auth project ID. Get this from Stack Auth Dashboard.Format: UUID string
Public client key for Stack Auth. Get this from Stack Auth Dashboard → API Keys.Format: Starts with
pk_Secret server key for Stack Auth. Get this from Stack Auth Dashboard → API Keys.Security: Never commit this to version control.
OpenRouter API (AI Models)
API key for OpenRouter AI gateway. Get this from OpenRouter Dashboard.Format: Starts with
sk-or-Base URL for OpenRouter API.Default:
https://openrouter.ai/api/v1Billing & Subscriptions
Polar.sh
Access token for Polar.sh API. Get this from Polar.sh Dashboard → Settings → API Keys.Security: Never commit this to version control.
Webhook secret for verifying Polar.sh webhooks. Get this from Polar.sh Dashboard → Webhooks.Security: Never commit this to version control.
Your Polar.sh organization ID. Get this from Polar.sh Dashboard → Organization Settings.Format: UUID string
Product ID for the Pro subscription tier. Get this from Polar.sh Dashboard → Products → Pro.Format: UUID string
Price ID for the Pro monthly subscription. Get this from Polar.sh Dashboard → Products → Pro → Pricing.Format: UUID string
Price ID for the Pro yearly subscription. Get this from Polar.sh Dashboard → Products → Pro → Pricing.Format: UUID string
Product ID for the Unlimited subscription tier. Get this from Polar.sh Dashboard → Products → Unlimited.Format: UUID string
Price ID for the Unlimited monthly subscription. Get this from Polar.sh Dashboard → Products → Unlimited → Pricing.Format: UUID string
Polar.sh server environment. Use
"sandbox" for testing, "production" for live.Default: productionOptions: sandbox | productionOptional Services
Cerebras API (Fast Inference)
API key for Cerebras Z.AI GLM 4.7 model (ultra-fast inference). Get this from Cerebras Cloud.Optional: Falls back to OpenRouter if not provided.
Vercel AI Gateway (Fallback)
API key for Vercel AI Gateway (used as fallback for Cerebras rate limits). Get this from Vercel Dashboard → AI Gateway.Optional: Only needed if using Cerebras with fallback.
Brave Search API (Web Search)
API key for Brave Search API (enables web search in subagents). Get this from Brave Search API Dashboard.Optional: Web search features require this.
Firecrawl (Web Scraping)
API key for Firecrawl web scraping service. Get this from Firecrawl Dashboard.Optional: Web scraping features require this.
OAuth Providers
OAuth client ID for Google authentication. Get this from Google Cloud Console.Optional: Only needed for Google OAuth.
OAuth client secret for Google authentication.Security: Never commit this to version control.
OAuth client ID for GitHub authentication. Get this from GitHub Developer Settings.Optional: Only needed for GitHub OAuth.
OAuth client secret for GitHub authentication.Security: Never commit this to version control.
OAuth client ID for Figma integration. Get this from Figma Developer Settings.Optional: Only needed for Figma imports.
OAuth client secret for Figma integration.Security: Never commit this to version control.
Monitoring & Error Tracking
Public Sentry DSN for client-side error tracking. Get this from Sentry Dashboard → Settings → Projects → Client Keys (DSN).Optional: Required for production error monitoring.
Sentry DSN for server-side error tracking.Optional: Can be same as
NEXT_PUBLIC_SENTRY_DSN.File Upload Service
API token for UploadThing file upload service. Get this from UploadThing Dashboard.Optional: Required for file upload features.
Environment-Specific Configuration
Development (.env.local)
For local development, create a.env.local file:
Production (Vercel)
In Vercel Dashboard → Your Project → Settings → Environment Variables, add:- All required variables from this page
- Set
NEXT_PUBLIC_APP_URLto your production domain - Set
NEXT_PUBLIC_POLAR_SERVERto"production" - Use production API keys (not test/sandbox keys)
Staging
For staging environments:Security Best Practices
Checklist
- Add
.envand.env.localto.gitignore - Use different API keys for development and production
- Rotate secrets regularly (every 90 days)
- Use secret management tools (Vercel Environment Variables, AWS Secrets Manager, etc.)
- Never expose secret keys in client-side code
- Audit environment variables before deployment
Variables by Visibility
Public (NEXT_PUBLIC_*): Can be exposed to the browserNEXT_PUBLIC_APP_URLNEXT_PUBLIC_CLERK_PUBLISHABLE_KEYNEXT_PUBLIC_CONVEX_URLNEXT_PUBLIC_STACK_PROJECT_IDNEXT_PUBLIC_POLAR_*NEXT_PUBLIC_SENTRY_DSN
CLERK_SECRET_KEYSTACK_SECRET_SERVER_KEYOPENROUTER_API_KEYPOLAR_ACCESS_TOKENPOLAR_WEBHOOK_SECRET*_CLIENT_SECRETvariables
Validation
ZapDev validates environment variables at build time. If required variables are missing, the build will fail with an error message. To test your configuration locally:Troubleshooting
Build Fails with “Missing Environment Variable”
Solution: Ensure all required variables are set in your.env or deployment platform.
”Invalid API Key” Errors
Solution: Verify the API key is correct and hasn’t expired. Check you’re using the right environment (test vs. production).OAuth Redirect Errors
Solution: EnsureNEXT_PUBLIC_APP_URL matches the redirect URL configured in OAuth provider settings.
Webhook Verification Failures
Solution: Verify webhook secrets match exactly between your.env and the service dashboard (Polar.sh).
Next Steps
Database Setup
Configure and deploy your Convex database schema