ForgeAI connects to several external services. You’ll need to set credentials for each one before the app will run. Copy the template below into a .env.local file at the root of your project and fill in each value.
# Database
DATABASE_URL=""
# AI Models
OPENAI_API_KEY=""
ANTHROPIC_API_KEY=""
GEMINI_API_KEY=""
# Storage
UPLOADTHING_TOKEN=""
# Code Execution
E2B_API_KEY=""
# Images
UNSPLASH_API_KEY=""
UNSPLASH_SECRET=""
# Auth (Clerk)
CLERK_PUBLISHABLE_KEY=""
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=""
CLERK_SECRET_KEY=""
NEXT_PUBLIC_CLERK_SIGN_IN_URL="/sign-in"
NEXT_PUBLIC_CLERK_SIGN_UP_URL="/sign-up"
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL="/"
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL="/"
Database
DATABASE_URL is required. The app will not start without a valid PostgreSQL connection string.
| Variable | Description |
|---|
DATABASE_URL | PostgreSQL connection string. ForgeAI uses Neon by default — create a project there and copy the connection string from the dashboard. |
AI models
OPENAI_API_KEY is required. The code generation agent and design spec extraction model both use OpenAI. ANTHROPIC_API_KEY and GEMINI_API_KEY are available for future model routing.
| Variable | Description | Where to get it |
|---|
OPENAI_API_KEY | API key for OpenAI — used by the coding agent (GPT-5.2) and design extraction (GPT-4o). | platform.openai.com/api-keys |
ANTHROPIC_API_KEY | API key for Anthropic models. | console.anthropic.com |
GEMINI_API_KEY | API key for Google Gemini models. | aistudio.google.com |
Storage
UPLOADTHING_TOKEN is required for file upload functionality, including the design-to-code screenshot feature.
| Variable | Description | Where to get it |
|---|
UPLOADTHING_TOKEN | Auth token for UploadThing, used to store uploaded screenshots and images. | Create an app in the UploadThing dashboard and copy the token from API Keys. |
Code execution
E2B_API_KEY is required to run sandboxed code execution and generate live previews.
| Variable | Description | Where to get it |
|---|
E2B_API_KEY | API key for E2B sandboxes, used to execute generated code securely. | Create an account at e2b.dev and copy your key from the dashboard. |
Images
Unsplash keys are optional. If omitted, ForgeAI will not fetch stock images for generated apps.
| Variable | Description | Where to get it |
|---|
UNSPLASH_API_KEY | Public access key for the Unsplash API. | Create an app at unsplash.com/developers. |
UNSPLASH_SECRET | Secret key for the Unsplash app. | Found alongside the access key in your Unsplash app settings. |
Auth (Clerk)
All Clerk variables are required. ForgeAI uses Clerk for authentication and subscription billing.
| Variable | Description |
|---|
CLERK_PUBLISHABLE_KEY | Server-side publishable key for Clerk. |
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | Client-side publishable key — same value as CLERK_PUBLISHABLE_KEY. |
CLERK_SECRET_KEY | Secret key for Clerk. Never expose this in the browser. |
NEXT_PUBLIC_CLERK_SIGN_IN_URL | Path for the sign-in page. Default: /sign-in. |
NEXT_PUBLIC_CLERK_SIGN_UP_URL | Path for the sign-up page. Default: /sign-up. |
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL | Where to redirect after sign-in when no redirect URL is present. Default: /. |
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL | Where to redirect after sign-up when no redirect URL is present. Default: /. |
You can find your Clerk keys in your Clerk dashboard under API Keys.