Skip to content

An AI-powered search engine with a generative UI

10.6 KB
Raw Blame
###############################################################################
# Morphic Configuration
###############################################################################

# =============================================================================
# REQUIRED CONFIGURATION
# =============================================================================

# -----------------------------------------------------------------------------
# AI Provider Configuration (At least one required)
# -----------------------------------------------------------------------------
# Set at least one provider API key. Available models are automatically
# detected and shown in the model selector UI.
#
# For Docker: This is the only section you need to configure.
# Database and search are handled automatically by Docker Compose.

# Option 1: OpenAI
# Get your API key at: https://platform.openai.com/api-keys
OPENAI_API_KEY=[YOUR_OPENAI_API_KEY]

# Option 2: Anthropic Claude
# ANTHROPIC_API_KEY=[YOUR_ANTHROPIC_API_KEY]

# Option 3: Google Gemini
# GOOGLE_GENERATIVE_AI_API_KEY=[YOUR_GOOGLE_GENERATIVE_AI_API_KEY]

# Option 4: Vercel AI Gateway
# Unified API gateway for multiple providers
# AI_GATEWAY_API_KEY=[YOUR_AI_GATEWAY_API_KEY]

# Option 5: Ollama
# Run local AI models with Ollama
# Requires Ollama to be installed and running: https://ollama.com/
# OLLAMA_BASE_URL=http://localhost:11434

# Option 6: OpenAI-compatible endpoint (DeepSeek, Moonshot, Zhipu, etc.)
# Any provider that exposes /v1/chat/completions in the OpenAI shape.
# OPENAI_COMPATIBLE_API_KEY=[YOUR_API_KEY]
# OPENAI_COMPATIBLE_API_BASE_URL=https://api.deepseek.com
# Optional display name in the model selector. This is a UI label only; the
# internal provider id remains "openai-compatible". Defaults to "OpenAI Compatible".
# OPENAI_COMPATIBLE_PROVIDER_NAME=DeepSeek
# Optional comma-separated model whitelist. When set, the app skips the
# /v1/models HTTP call and uses this list directly. Required for providers
# without a /v1/models endpoint.
# OPENAI_COMPATIBLE_MODELS=deepseek-chat,deepseek-reasoner

# -----------------------------------------------------------------------------
# Database Configuration (Required for local development)
# -----------------------------------------------------------------------------
# Docker: Automatically configured — no need to set this.
# Local development: Set your PostgreSQL connection string.
# Cloud providers (Neon, Supabase, etc.): Add ?sslmode=require
#
# DATABASE_URL=postgresql://user:password@localhost:5432/morphic
DATABASE_URL=[YOUR_DATABASE_URL]

# -----------------------------------------------------------------------------
# Search Provider Configuration (Required for local development)
# -----------------------------------------------------------------------------
# Docker: SearXNG is included — no search API key needed.
# Local development: Set at least one search provider key.

# Option 1: Tavily Search (Default)
# Get your API key at: https://app.tavily.com/home
TAVILY_API_KEY=[YOUR_TAVILY_API_KEY]

# Option 2: Exa Neural Search (Alternative to Tavily)
# Get your API key at: https://dashboard.exa.ai/
# EXA_API_KEY=your_api_key_without_quotes

# Option 3: Firecrawl (Alternative web scraping and content extraction)
# Get your API key at: https://www.firecrawl.dev/app
# FIRECRAWL_API_KEY=[YOUR_FIRECRAWL_API_KEY]

# Brave Search (Optional - video/image support for general searches)
# Get your API key at: https://brave.com/search/api/
# BRAVE_SEARCH_API_KEY=[YOUR_BRAVE_SEARCH_API_KEY]

# =============================================================================
# OPTIONAL FEATURES
# =============================================================================

# -----------------------------------------------------------------------------
# Authentication (Optional)
# -----------------------------------------------------------------------------
# Default: Disabled for personal use. All users share one anonymous user ID.
# For personal, single-user environments only.
ENABLE_AUTH=false
ANONYMOUS_USER_ID=anonymous-user

# Auth provider selection. When unset, it is derived from the environment:
# ENABLE_AUTH=false -> "none" (anonymous mode); otherwise -> "supabase".
# Accepted values: supabase | better-auth | none
# See docs/CONFIGURATION.md.
# AUTH_PROVIDER=supabase

# To enable Supabase authentication for multi-user deployments:
# Get your project URL and API keys from: https://supabase.com/dashboard
# ENABLE_AUTH=true
# NEXT_PUBLIC_SUPABASE_URL=[YOUR_SUPABASE_PROJECT_URL]
# NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=[YOUR_SUPABASE_PUBLISHABLE_KEY]
# Required for account deletion. Never expose this key to the browser.
# SUPABASE_SECRET_KEY=[YOUR_SUPABASE_SECRET_KEY]
# Forward visitor IPs to Supabase Auth rate limits (automatic on Vercel deployments).
# Only enable behind a proxy that overwrites X-Forwarded-For.
# SUPABASE_FORWARD_CLIENT_IP=true

# Local multi-user accounts in Morphic's own Postgres (no Supabase needed).
# See the "Better Auth" section in docs/CONFIGURATION.md for the full walkthrough.
# AUTH_PROVIDER=better-auth
# BETTER_AUTH_SECRET=[RUN: openssl rand -hex 32]
# Only this email may sign up while the user table is empty (recommended):
# [email protected]
# open (default) or invite (sign-up requires an admin-created invitation):
# AUTH_SIGNUP_MODE=open
# Optional SMTP (enables password-reset emails; also emails invitations):
# SMTP_HOST=smtp.example.com
# SMTP_PORT=587
# SMTP_USER=[SMTP_USER]
# SMTP_PASSWORD=[SMTP_PASSWORD]
# EMAIL_FROM="Morphic <[email protected]>"
# Required whenever SMTP is set: the canonical public origin used to build
# every emailed link (resets, invitations, bootstrap). Without it those
# flows refuse to send rather than trust request headers.
# BETTER_AUTH_URL=https://morphic.example.com

# -----------------------------------------------------------------------------
# File Upload (Cloudflare R2 / S3-Compatible)
# -----------------------------------------------------------------------------
# If not configured, file upload is disabled.
# R2_ACCOUNT_ID=[YOUR_R2_ACCOUNT_ID]
# S3_ENDPOINT=[YOUR_S3_ENDPOINT]
# R2_ACCESS_KEY_ID=[YOUR_R2_ACCESS_KEY_ID]
# R2_SECRET_ACCESS_KEY=[YOUR_R2_SECRET_ACCESS_KEY]
# R2_BUCKET_NAME=user-uploads
# R2_PUBLIC_URL=[YOUR_R2_PUBLIC_URL]

# -----------------------------------------------------------------------------
# Search Configuration
# -----------------------------------------------------------------------------
# Select search provider (default: tavily)
# SEARCH_API=tavily  # Options: tavily, searxng, exa, firecrawl

# SearXNG (Self-hosted)
# SEARXNG_API_URL=http://localhost:8080
# SEARXNG_SECRET=[YOUR_SECRET_KEY]
# SEARXNG_PORT=8080
# SEARXNG_BIND_ADDRESS=0.0.0.0
# SEARXNG_IMAGE_PROXY=true
# SEARXNG_LIMITER=false
# SEARXNG_DEFAULT_DEPTH=basic
# SEARXNG_MAX_RESULTS=50
# SEARXNG_ENGINES=google,bing,duckduckgo,wikipedia
# SEARXNG_TIME_RANGE=None
# SEARXNG_SAFESEARCH=0

# Content Extraction
# Default: Tavily Extract API
# Alternative: Jina AI - Get your API key at: https://jina.ai/
# JINA_API_KEY=[YOUR_JINA_API_KEY]
# Alternative: self-hosted crawl4ai (handles all fetches when set, including
# PDFs; takes precedence over Jina and Tavily)
# CRAWL4AI_BASE_URL=http://localhost:11235
# CRAWL4AI_API_KEY=[YOUR_CRAWL4AI_API_KEY]

# -----------------------------------------------------------------------------
# Observability & Monitoring
# -----------------------------------------------------------------------------
# All of the below are off unless configured. See docs/PRIVACY.md for what a
# self-hosted instance sends outbound.
#
# Langfuse Tracing (traces include full prompts and completions)
# ENABLE_LANGFUSE_TRACING=true
# LANGFUSE_SECRET_KEY=[YOUR_LANGFUSE_SECRET_KEY]
# LANGFUSE_PUBLIC_KEY=[YOUR_LANGFUSE_PUBLIC_KEY]
# LANGFUSE_BASE_URL=https://cloud.langfuse.com

# Performance Logging
# ENABLE_PERF_LOGGING=true

# -----------------------------------------------------------------------------
# Docker Configuration
# -----------------------------------------------------------------------------
# PostgreSQL credentials (only for Docker Compose)
# POSTGRES_USER=morphic
# POSTGRES_PASSWORD=morphic
# POSTGRES_DB=morphic
# POSTGRES_PORT=5432

# Redis (custom URL, default: redis://localhost:6379)
# LOCAL_REDIS_URL=redis://localhost:6379

# Database SSL (set true for local PostgreSQL without SSL)
# Do NOT set for cloud databases (Neon, Supabase, etc.)
# DATABASE_SSL_DISABLED=true

# -----------------------------------------------------------------------------
# Cloud Deployment
# -----------------------------------------------------------------------------
# Enable rate limiting and analytics for cloud deployments
# Requires UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN
# MORPHIC_CLOUD_DEPLOYMENT=true

# -----------------------------------------------------------------------------
# PostHog (product analytics)
# -----------------------------------------------------------------------------
# Only sent when MORPHIC_CLOUD_DEPLOYMENT=true. US Cloud.
# Client-facing project key (phc_...) is safe to expose in the browser.
# NEXT_PUBLIC_POSTHOG_KEY=[YOUR_POSTHOG_PROJECT_KEY]
# NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
# POSTHOG_KEY=[YOUR_POSTHOG_PROJECT_KEY]
#
# Management API (server-only) — required only for person deletion on
# account_deleted. Use a dedicated personal API key scoped to person:write.
# POSTHOG_PERSONAL_API_KEY=[YOUR_PERSONAL_API_KEY]
# POSTHOG_PROJECT_ID=[YOUR_POSTHOG_PROJECT_ID]
# POSTHOG_API_HOST=https://us.posthog.com

# -----------------------------------------------------------------------------
# Advanced
# -----------------------------------------------------------------------------
# Let the fetch tool and the advanced-search crawler reach private address
# space (loopback, RFC1918, link-local). Off by default: with it on, anyone who
# can send a prompt can read services on the host's network, including the
# cloud metadata endpoint. Only turn it on for a single-user instance that is
# not reachable from the internet.
# FETCH_ALLOW_PRIVATE_NETWORK=true

# Send the fetch tool's "regular" requests through the extraction service
# (Jina or Tavily) instead of requesting the page from this server. Useful while
# the server's runtime cannot be trusted to decode responses from arbitrary
# hosts.
# FETCH_REGULAR_VIA_API=true

# Where source favicons come from. The server fetches them and serves them from
# your own origin, so visitors never contact the provider themselves. Use
# {domain} and {size} as placeholders, or set it to "off" to show letter
# initials instead of fetching anything.
# FAVICON_PROVIDER_URL=https://www.google.com/s2/favicons?domain={domain}&sz={size}

# Feedback Notifications (Slack)
# SLACK_WEBHOOK_URL=[YOUR_SLACK_WEBHOOK_URL]