Skip to content

Deployment Guide

Quick Reference

  • Platform: npm (CLI), npm (SDK), Vercel (Web), Docker (Database)
  • Min Requirements: Bun ≥1.3.5, Node.js ≥18 (SDK consumers), PostgreSQL
  • Ports: 3000 (web), 4242 (API server), 5432 (PostgreSQL)
  • Health Check: Web application via Vercel health endpoints
ComponentMinimumRecommended
CPU2 cores4+ cores
RAM4 GB8+ GB
Disk2 GB10+ GB (for large projects)
Bun1.3.5Latest
Node.js18.0 (SDK only)20+
PostgreSQL1416+
VariableDescriptionRequiredExample
OPEN_ROUTER_API_KEYOpenRouter API key for LLM accesssk-or-v1-...
OPENAI_API_KEYOpenAI API key (optional, for direct access)sk-...
ANTHROPIC_API_KEYAnthropic API key (optional)sk-ant-...
DATABASE_URLPostgreSQL connection stringpostgresql://user:pass@localhost:5432/db
PORTAPI server port4242
CODEBUFF_GITHUB_IDGitHub OAuth App client IDIv1.abc123
CODEBUFF_GITHUB_SECRETGitHub OAuth App secretghs_...
NEXTAUTH_SECRETNextAuth session encryption (≥32 chars)random string
STRIPE_SECRET_KEYStripe secret keysk_test_...
STRIPE_WEBHOOK_SECRET_KEYStripe webhook verificationwhsec_...
NEXT_PUBLIC_CB_ENVIRONMENTEnvironment namedev, production
NEXT_PUBLIC_CODEBUFF_APP_URLPublic app URLhttp://localhost:3000
NEXT_PUBLIC_POSTHOG_API_KEYPostHog analytics keyphc_...
DISCORD_BOT_TOKENDiscord bot integrationBot token
LOOPS_API_KEYLoops email automationAPI key

:::warning Security Never commit .env files. Use secrets management in production. Copy .env.example to .env for local development. :::

(.env.example)

Terminal window
# Step 1: Clone the repository
git clone https://github.com/CodebuffAI/codebuff.git
cd codebuff
# Step 2: Install Bun (if not already installed)
curl -fsSL https://bun.sh/install | bash
# Step 3: Install dependencies
bun install
# Step 4: Configure environment
cp .env.example .env
# Edit .env with your API keys and database URL
# Step 5: Start database
bun start-db
# Step 6: Run the CLI in development
bun dev
# Or start the web application
bun start-web
Terminal window
# Install globally
npm install -g codebuff
# Run in any project
cd your-project
codebuff
Terminal window
# Install the SDK package
npm install @codebuff/sdk
import { CodebuffClient } from '@codebuff/sdk'
const client = new CodebuffClient({
apiKey: 'your-api-key',
cwd: '/path/to/your/project',
})
const result = await client.run({
agent: 'base',
prompt: 'Add error handling to all API endpoints',
})
# docker-compose.yml (from packages/internal/src/db/)
version: '3.8'
services:
postgres:
image: postgres:16
environment:
POSTGRES_USER: manicode_user_local
POSTGRES_PASSWORD: secretpassword_local
POSTGRES_DB: manicode_db_local
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:
graph LR
A["🔀 Push"] --> B["🧪 Typecheck"]
B --> C["🧪 Test"]
C --> D["📦 Build"]
D --> E{"Branch?"}
E -->|main| F["🚀 Deploy"]
E -->|PR| G["📝 Preview"]

Available Scripts:

ScriptCommandDescription
Dev CLIbun devStart CLI in development mode
Dev Webbun start-webStart web app + database
Start DBbun start-dbLaunch PostgreSQL via Docker
DB Studiobun start-studioOpen Drizzle Studio
Typecheckbun typecheckRun TypeScript type checking
Testbun testRun all workspace tests
Formatbun formatPrettier formatting
Release CLIbun release:cliPublish CLI to npm
Release SDKbun release:sdkPublish SDK to npm
Cleanbun clean-tsRemove build artifacts

(package.json:18-36)

Terminal window
# Run pending migrations
bun --cwd packages/internal drizzle-kit push
# Generate new migration
bun --cwd packages/internal drizzle-kit generate
# Open database studio
bun start-studio
EndpointPurposeExpected
Web app rootApplication health200 OK
/api/* routesAPI functionality200 OK / 401
PostgreSQLDatabase connectivityConnection success