Configuration
This guide covers the configuration of Happy Vibecode for local development and production deployment.
Wrangler Configuration
The primary configuration file is
apps/web/wrangler.jsonc. It defines the Cloudflare Worker
settings, bindings, and environment variables.
{
"name": "happy-vibecode",
"compatibility_date": "2026-02-12",
"compatibility_flags": ["nodejs_compat"],
"main": "./worker/index.ts",
"assets": {
"directory": "./public",
"binding": "ASSETS",
"run_worker_first": ["/agents/*"]
}
}
D1 Database
The application uses Cloudflare D1 (SQLite) for persistent storage.
The D1 binding is configured in wrangler.jsonc:
{
"d1_databases": [
{
"binding": "DB",
"database_name": "happy-vibecode-db",
"database_id": "2c49dfdf-ec4a-408c-b101-4793a1405cc3",
"migrations_dir": "../../packages/db/drizzle"
}
]
}
Creating D1 Database
# Create a new D1 database
wrangler d1 create happy-vibecode-db
# Update the database_id in wrangler.jsonc with the returned ID
Database Schema
The schema is defined in packages/db/src/schema.ts using
Drizzle ORM. Key tables:
| Table | Purpose |
|---|---|
users |
User accounts with subscription tiers and Stripe integration |
workspaces |
User workspaces with LLM provider defaults |
agent_sessions |
Agent session tracking with connection status |
message_logs |
Chat message history per session |
agents |
Agent definitions (command, args, flags) |
agent_templates |
Reusable agent configuration templates |
linked_repos |
GitHub repositories linked to workspaces |
repo_files |
Indexed file metadata from linked repos |
device_tokens |
Push notification device tokens |
offline_sync_queue |
Queued actions for offline operation |
KV Namespace
Cloudflare KV is used for rate limiting counters and caching:
{
"kv_namespaces": [
{
"binding": "KV",
"id": "ba4e9794ba604de08ce3ceaf4ac3719f"
}
]
}
# Create KV namespace
wrangler kv namespace create happy-vibecode-kv
# Update the id in wrangler.jsonc
Durable Objects
The BridgeAgent Durable Object manages WebSocket
connections between clients and CLI agents:
{
"durable_objects": {
"bindings": [
{
"class_name": "BridgeAgent",
"name": "BridgeAgent"
}
]
},
"migrations": [
{
"new_sqlite_classes": ["BridgeAgent"],
"tag": "v1"
}
]
}
The BridgeAgent is defined in
apps/web/worker/bridge-agent.ts. WebSocket connections
are routed at /agents/BridgeAgent/<roomId>.
Environment Variables & Secrets
Public Variables (in wrangler.jsonc)
| Variable | Description |
|---|---|
AUTH_GITHUB_ID |
GitHub OAuth App Client ID |
TURNSTILE_SITE_KEY |
Cloudflare Turnstile site key for CAPTCHA |
Secrets (set via wrangler)
| Secret | Description |
|---|---|
AUTH_GITHUB_SECRET |
GitHub OAuth App Client Secret |
BETTER_AUTH_SECRET |
Secret key for Better Auth session signing |
TURNSTILE_SECRET_KEY |
Cloudflare Turnstile secret key |
STRIPE_API_KEY |
Stripe API key (optional, for billing) |
STRIPE_WEBHOOK_SECRET |
Stripe webhook signing secret |
STRIPE_PRO_PRICE_ID |
Stripe Price ID for Pro subscription |
# Set secrets using wrangler
wrangler secret put AUTH_GITHUB_SECRET
wrangler secret put BETTER_AUTH_SECRET
wrangler secret put STRIPE_API_KEY
wrangler secret put STRIPE_WEBHOOK_SECRET
wrangler secret put TURNSTILE_SECRET_KEY
Rate Limiting
Rate limiting is enforced globally via middleware
(packages/api/src/middleware/rate-limit.ts):
| Tier | Requests/min | Daily Quota |
|---|---|---|
| Free | 30 | 500 |
| Pro | 120 | 5,000 |
Per-endpoint overrides exist for sensitive routes:
/api/repos— 20 requests/min/api/sessions— 10 requests/min/api/billing— 5 requests/min
LLM Provider Configuration
Supported LLM providers are defined in
packages/shared/src/schema/llm-provider.ts:
| Provider | Identifier |
|---|---|
| Google Gemini | gemini |
| Anthropic Claude | claude |
| OpenAI Codex | codex |
| OpenCode AI | opencode-ai |
| GitHub Copilot | copilot |
| Kilo | kilo |
| Cline | cline |
| Custom | custom |
Set the default provider per workspace via the
defaultProvider field or through the Settings UI.