This guide covers every environment variable required to self-host Doc Studio on Vercel. Variables marked Required will break the app if missing. Variables marked Optional enable specific features or provide fallback overrides.
- Quick Checklist
- Authentication
- Database
- AI (Anthropic)
- GitHub / Knowledge Base
- Vercel Integration
- Vercel Blob Storage
- Local Development Overrides
- Variables That Are Auto-Set by Vercel
- Full
.env.localTemplate
Required. Secret used by NextAuth to sign and encrypt session tokens. Must be the same across all instances — changing it invalidates all existing sessions.
Generate a secure value:
openssl rand -base64 32Required for local development only. The canonical URL of the app. On Vercel, this is inferred automatically from VERCEL_URL.
NEXTAUTH_URL=http://localhost:3000On Vercel, do not set this unless you have a specific reason to override the deployment URL.
Doc Studio uses PostgreSQL. In production, Neon is recommended (serverless Postgres with connection pooling).
Required in production. Full connection string including SSL mode and channel binding.
NEON_DATABASE_URL=postgresql://user:password@host/dbname?sslmode=require&channel_binding=requireSteps:
- Create a free account at https://neon.tech
- Create a new project and database
- Copy the pooled connection string from the Neon dashboard (Connection Details → Pooled connection)
- Run the database migrations:
pnpm db:migrate(or applypackages/web/db/init.sqlmanually)
Local development only. Points to the local Docker PostgreSQL instance.
DATABASE_URL=postgres://tg_docs_user:tg_docs_password@localhost:5432/tg_docs_dbStart the local DB with pnpm db:start from packages/web.
Required for AI-powered documentation features.
Steps:
- Sign in at https://console.anthropic.com
- Go to API Keys and create a new key
- Copy the key — it is shown only once
ANTHROPIC_API_KEY=sk-ant-api03-...Doc Studio reads documentation source content from a GitHub repository.
Required. A GitHub Personal Access Token (PAT) with read access to the knowledge base repository.
Steps:
- Go to https://github.com/settings/tokens
- Click Generate new token (classic)
- Select the
reposcope (or justpublic_repoif the repo is public) - Copy the generated token
GITHUB_TOKEN=ghp_...Required. The GitHub repository that contains the knowledge base content, in owner/repo format.
KNOWLEDGE_BASE_REPO=themegrill/knowledge-baseOptional. The branch to read content from. Defaults to main.
KNOWLEDGE_BASE_BRANCH=mainDoc Studio can automatically create and deploy per-project documentation sites on Vercel. This section covers the variables required for that feature.
Required for client deployments. A Vercel API token scoped to the account or team where client documentation projects will be created.
Steps:
- Go to https://vercel.com/account/tokens
- Click Create and give it a name (e.g.
doc-studio-deploy) - Set the scope to your team or personal account
- Copy the token — it is shown only once
VERCEL_API_TOKEN=vcp_...Keep this token server-side only. It grants the ability to create and deploy Vercel projects on your behalf.
Required if using a Vercel team account. The ID of the Vercel team under which client projects should be created.
Steps:
- Go to your Vercel team settings: https://vercel.com/teams
- Copy the Team ID from the General settings page (starts with
team_)
VERCEL_TEAM_ID=team_...Leave unset if you are deploying under a personal Vercel account.
Recommended. The Vercel project ID of this admin web app itself. Used to auto-detect the GitHub repository when triggering client deployments, so you do not need to set VERCEL_GITHUB_REPO manually.
Steps:
- Open your project in the Vercel dashboard
- Go to Settings → General
- Copy the Project ID (starts with
prj_)
VERCEL_ADMIN_PROJECT_ID=prj_...Optional. Explicit override for the GitHub repository used as the source for client deployments, in owner/repo format.
VERCEL_GITHUB_REPO=themegrill/doc-studioIf not set, the app auto-detects the repository from the admin project's deployment history via the Vercel API (requires VERCEL_ADMIN_PROJECT_ID to be set).
Doc Studio uses Vercel Blob for file storage (e.g. uploaded images and assets).
Required for file uploads. Grants read/write access to a Vercel Blob store.
If deploying on Vercel (recommended):
- Open your project in the Vercel dashboard
- Go to Storage → Create Database → Blob
- Follow the prompts — Vercel will automatically inject
BLOB_READ_WRITE_TOKENinto your project's environment variables
If running locally:
- Install the Vercel CLI:
npm i -g vercel - Link your project:
vercel link - Pull environment variables:
vercel env pull .env.localThis will populateBLOB_READ_WRITE_TOKENin your local.env.local
BLOB_READ_WRITE_TOKEN=vercel_blob_rw_...Local development only. Explicitly sets the public URL of this admin app, which is passed to deployed client projects as their API_BASE_URL.
WEB_APP_URL=http://localhost:3000Do not set this in Vercel environment variables. In production, the app automatically uses VERCEL_PROJECT_PRODUCTION_URL (auto-set by Vercel) as the public URL.
These are injected automatically by Vercel at build and runtime. You do not need to configure them.
| Variable | Value |
|---|---|
VERCEL_PROJECT_PRODUCTION_URL |
Canonical production domain (e.g. my-app.vercel.app) |
VERCEL_URL |
Deployment-specific URL (changes per deployment) |
VERCEL_ENV |
production, preview, or development |
Copy this to packages/web/.env.local and fill in your values:
# ─── Authentication ───────────────────────────────────────────
# Generate with: openssl rand -base64 32
AUTH_SECRET=
# Required for local dev only — omit on Vercel
NEXTAUTH_URL=http://localhost:3000
# ─── Database ─────────────────────────────────────────────────
# Production: Neon PostgreSQL (pooled connection string)
NEON_DATABASE_URL=
# Local dev: Docker PostgreSQL
DATABASE_URL=postgres://tg_docs_user:tg_docs_password@localhost:5432/tg_docs_db
# ─── AI ───────────────────────────────────────────────────────
# https://console.anthropic.com → API Keys
ANTHROPIC_API_KEY=
# ─── GitHub / Knowledge Base ──────────────────────────────────
# https://github.com/settings/tokens (needs repo read scope)
GITHUB_TOKEN=
KNOWLEDGE_BASE_REPO=owner/repo-name
KNOWLEDGE_BASE_BRANCH=main
# ─── Vercel Integration (client project deployments) ──────────
# https://vercel.com/account/tokens
VERCEL_API_TOKEN=
# Required if using a Vercel team account
# VERCEL_TEAM_ID=team_...
# Vercel project ID of this admin app (Settings → General → Project ID)
# VERCEL_ADMIN_PROJECT_ID=prj_...
# Branch to deploy client projects from (default: main)
# VERCEL_DEPLOY_BRANCH=main
# Optional: explicit git source override
# VERCEL_GITHUB_REPO=owner/repo-name
# ─── Vercel Blob Storage ──────────────────────────────────────
# Auto-set on Vercel if a Blob store is linked. For local dev: run `vercel env pull`
BLOB_READ_WRITE_TOKEN=
# ─── Local Dev Overrides ──────────────────────────────────────
# Do NOT set WEB_APP_URL on Vercel — it is auto-detected from VERCEL_PROJECT_PRODUCTION_URL
WEB_APP_URL=http://localhost:3000