Skip to main content
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.
.env.local
# 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.
VariableDescription
DATABASE_URLPostgreSQL 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.
VariableDescriptionWhere to get it
OPENAI_API_KEYAPI key for OpenAI — used by the coding agent (GPT-5.2) and design extraction (GPT-4o).platform.openai.com/api-keys
ANTHROPIC_API_KEYAPI key for Anthropic models.console.anthropic.com
GEMINI_API_KEYAPI key for Google Gemini models.aistudio.google.com

Storage

UPLOADTHING_TOKEN is required for file upload functionality, including the design-to-code screenshot feature.
VariableDescriptionWhere to get it
UPLOADTHING_TOKENAuth 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.
VariableDescriptionWhere to get it
E2B_API_KEYAPI 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.
VariableDescriptionWhere to get it
UNSPLASH_API_KEYPublic access key for the Unsplash API.Create an app at unsplash.com/developers.
UNSPLASH_SECRETSecret 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.
VariableDescription
CLERK_PUBLISHABLE_KEYServer-side publishable key for Clerk.
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYClient-side publishable key — same value as CLERK_PUBLISHABLE_KEY.
CLERK_SECRET_KEYSecret key for Clerk. Never expose this in the browser.
NEXT_PUBLIC_CLERK_SIGN_IN_URLPath for the sign-in page. Default: /sign-in.
NEXT_PUBLIC_CLERK_SIGN_UP_URLPath for the sign-up page. Default: /sign-up.
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URLWhere to redirect after sign-in when no redirect URL is present. Default: /.
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URLWhere 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.
For more on how Clerk is used for authentication and Pro plan gating, see Authentication & Billing.

Build docs developers (and LLMs) love