Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/better-auth/better-hub/llms.txt

Use this file to discover all available pages before exploring further.

Better Hub uses environment variables to configure external services, authentication, and feature flags. Copy .env.example to .env and configure the required variables for your environment.

Quick Start

cp apps/web/.env.example apps/web/.env
Edit the .env file and configure at minimum the required variables marked below.

Authentication

Required for user authentication and session management.
GITHUB_CLIENT_ID
string
required
GitHub OAuth App client ID. Create an OAuth app at GitHub Settings > Developer Settings.
GITHUB_CLIENT_SECRET
string
required
GitHub OAuth App client secret. Keep this value secure and never commit it to version control.
BETTER_AUTH_SECRET
string
required
Random 32-character string used for session encryption. Generate with:
openssl rand -hex 16
This must be kept secret and should be unique per environment.
BETTER_AUTH_URL
string
required
Base URL where the application is hosted. Used for OAuth callbacks.Development: http://localhost:3000Production: https://yourdomain.com
NEXT_PUBLIC_APP_URL
string
required
Public-facing application URL. Must match BETTER_AUTH_URL.Development: http://localhost:3000Production: https://yourdomain.com

Database

PostgreSQL database connection.
DATABASE_URL
string
required
PostgreSQL connection string in the format:
postgresql://[username]:[password]@[host]:[port]/[database]
Docker Compose default:
postgresql://postgres:postgres@localhost:54320/better_hub
Production: Use your managed PostgreSQL instance connection string.
Never commit database credentials to version control. Use environment-specific .env files that are git-ignored.

Redis

Required for caching GitHub API responses and session data.
UPSTASH_REDIS_REST_URL
string
required
Upstash Redis REST API URL. Get this from your Upstash Console.Docker Compose default:
http://localhost:8079
Production: Use your Upstash Redis REST URL (format: https://[endpoint].upstash.io)
UPSTASH_REDIS_REST_TOKEN
string
required
Upstash Redis REST API token. Get this from your Upstash Console.Docker Compose default:
local_token
Production: Use your Upstash Redis token.

AI Configuration

Required for Ghost AI assistant and AI-powered features.

OpenRouter

OPEN_ROUTER_API_KEY
string
required
OpenRouter API key for accessing multiple AI models. Get your API key at OpenRouter.This is the primary API key used for the Ghost AI assistant.
GHOST_MODEL
string
default:"moonshotai/kimi-k2.5"
Model ID for the main Ghost AI assistant. Available models can be found at OpenRouter Models.Default: moonshotai/kimi-k2.5Recommended alternatives:
  • anthropic/claude-4.5-sonnet
  • google/gemini-2.5-pro
  • openai/gpt-4o
GHOST_MERGE_MODEL
string
default:"google/gemini-2.5-pro-preview"
Model ID specifically for merge-related AI operations.Default: google/gemini-2.5-pro-preview

Anthropic

ANTHROPIC_API_KEY
string
required
Anthropic API key for Claude models used in specific AI tasks. Get your API key at Anthropic Console.

OpenAI

OPENAPI_KEY
string
OpenAI API key for GPT models (optional). Only required if you want to use OpenAI models directly.

Payments (Optional)

Stripe integration for billing and subscriptions.
STRIPE_SECRET_KEY
string
Stripe secret key from your Stripe Dashboard.Use test keys (sk_test_...) for development and live keys (sk_live_...) for production.
STRIPE_WEBHOOK_SECRET
string
Stripe webhook signing secret for verifying webhook events. Get this when setting up webhooks in your Stripe Dashboard.
STRIPE_BASE_PRICE_ID
string
Stripe Price ID for the base subscription plan (format: price_xxx).
STRIPE_METERED_PRICE_ID
string
Stripe Price ID for metered usage billing (format: price_xxx).

Code Sandbox (Optional)

E2B integration for sandboxed code execution.
E2B_API_KEY
string
E2B API key for sandboxed code execution. Get your API key at E2B.
E2B_TEMPLATE
string
Custom E2B template ID. Falls back to default base image if not specified.Build a custom template with:
cd apps/web && npx e2b template build

Background Jobs (Optional)

Inngest for asynchronous task processing.
INNGEST_EVENT_KEY
string
Inngest event key for triggering background jobs. Get this from your Inngest Dashboard.
INNGEST_SIGNING_KEY
string
Inngest signing key for securing webhook events.

Search & Memory (Optional)

AI-powered search and conversation memory.
MIXEDBREAD_API_KEY
string
Mixedbread embeddings API key for semantic search. Get your API key at Mixedbread.
SUPER_MEMORY_API_KEY
string
SuperMemory API key for AI conversation context and memory.

Integrations (Optional)

Third-party service integrations.

Slack

SLACK_CLIENT_ID
string
Slack OAuth client ID for Slack notifications integration.
SLACK_CLIENT_SECRET
string
Slack OAuth client secret.

Vercel

VERCEL_OIDC_TOKEN
string
Vercel OIDC token for deployment authentication. Automatically set in Vercel deployments.

Monitoring (Optional)

Error tracking and monitoring.
SENTRY_DSN
string
Sentry Data Source Name for error tracking. Format: https://[key]@sentry.io/[project-id]Get this from your Sentry Project Settings.
SENTRY_AUTH_TOKEN
string
Sentry authentication token for source map uploads and releases.

Environment-Specific Configuration

Development

Minimal configuration for local development:
# Authentication
GITHUB_CLIENT_ID=your_dev_client_id
GITHUB_CLIENT_SECRET=your_dev_client_secret
BETTER_AUTH_SECRET=$(openssl rand -hex 16)
BETTER_AUTH_URL=http://localhost:3000
NEXT_PUBLIC_APP_URL=http://localhost:3000

# Database (Docker Compose)
DATABASE_URL=postgresql://postgres:postgres@localhost:54320/better_hub

# Redis (Docker Compose)
UPSTASH_REDIS_REST_URL=http://localhost:8079
UPSTASH_REDIS_REST_TOKEN=local_token

# AI
OPEN_ROUTER_API_KEY=your_openrouter_key
ANTHROPIC_API_KEY=your_anthropic_key

Production

Production configuration checklist:
1

Generate secure secrets

Use cryptographically secure random strings for BETTER_AUTH_SECRET
2

Use managed services

  • PostgreSQL: Use managed database (Supabase, Neon, Railway)
  • Redis: Use Upstash Redis
3

Set production URLs

Update BETTER_AUTH_URL and NEXT_PUBLIC_APP_URL to your production domain
4

Enable monitoring

Configure Sentry for error tracking
Always use different OAuth apps and API keys for development and production environments.

Validation

Better Hub will validate required environment variables on startup. If any required variables are missing, the application will fail to start with a descriptive error message. To check your configuration:
npm run build
Missing or invalid environment variables will be reported during the build process.

Build docs developers (and LLMs) love