Skip to main content
You can run ForgeAI on your own infrastructure. This guide walks through cloning the repository, configuring environment variables, and starting the development server.

Prerequisites

  • Node.js 18 or later
  • PostgreSQL database (local or hosted, e.g. Neon)
  • pnpm package manager

Installation

1

Clone the repository

git clone https://github.com/Atiqullah-Naemi/forgeai.git
cd forgeai
2

Install dependencies

pnpm install
This also runs prisma generate automatically via the postinstall script.
3

Configure environment variables

Copy the example below into a .env file at the project root and fill in your values:
# Database
DATABASE_URL=""

# File uploads
UPLOADTHING_TOKEN=""

# AI providers (OPENAI_API_KEY is required)
OPENAI_API_KEY=""
ANTHROPIC_API_KEY=""
GEMINI_API_KEY=""

# Code execution sandbox
E2B_API_KEY=""

# Image search
UNSPLASH_API_KEY=""
UNSPLASH_SECRET=""

# Clerk authentication
CLERK_PUBLISHABLE_KEY=""
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=""
CLERK_SECRET_KEY=""

# Clerk redirect URLs
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="/"
See Environment variables for a full description of each variable.
4

Run database migrations

pnpm prisma migrate deploy
This applies all pending Prisma migrations to your PostgreSQL database and creates the Project, Message, and CodeFragment tables.
5

Start the development server

pnpm dev
The application will be available at http://localhost:3000.

Environment variable reference

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string
UPLOADTHING_TOKENYesUploadThing API token for file uploads
OPENAI_API_KEYYesOpenAI API key (required for the code agent)
ANTHROPIC_API_KEYNoAnthropic API key (for future model routing)
GEMINI_API_KEYNoGoogle Gemini API key (for future model routing)
E2B_API_KEYYesE2B Sandbox API key for code execution
UNSPLASH_API_KEYYesUnsplash access key for image search
UNSPLASH_SECRETYesUnsplash secret key
CLERK_PUBLISHABLE_KEYYesClerk publishable key (server-side)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYYesClerk publishable key (client-side)
CLERK_SECRET_KEYYesClerk secret key
NEXT_PUBLIC_CLERK_SIGN_IN_URLYesPath for the sign-in page (e.g. /sign-in)
NEXT_PUBLIC_CLERK_SIGN_UP_URLYesPath for the sign-up page (e.g. /sign-up)
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URLYesRedirect path after sign-in (e.g. /)
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URLYesRedirect path after sign-up (e.g. /)
You must create an E2B sandbox template before the code execution feature will work. Refer to the E2B Sandbox integration guide for setup instructions.
CLERK_PUBLISHABLE_KEY and NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY must contain the same value. The NEXT_PUBLIC_ prefix makes the variable available in the browser bundle; the non-prefixed version is used by server-side Clerk middleware.

Next steps

Environment variables

Full reference for every configuration option.

Database setup

Configure and manage your PostgreSQL database with Prisma.

Auth & billing

Set up Clerk authentication and subscription plans.

E2B Sandbox

Create and configure the E2B sandbox template for code execution.

Build docs developers (and LLMs) love