Environment Variables
ThinkEx is configured through environment variables in the.env file. Copy from .env.example and customize for your setup.
Application Settings
Core Application
The public URL where your ThinkEx instance is accessible. Used for OAuth redirects and absolute URLs.Production example:
https://thinkex.yourdomain.comNode.js environment mode.Options:
development, production, testAuthentication
Better Auth Configuration
ThinkEx uses Better Auth for authentication.Secret key for encrypting session tokens and cookies. Must be kept secure.Generate with:
Base URL for Better Auth callbacks. Should match
NEXT_PUBLIC_APP_URL.Google OAuth (Optional)
Enable Google OAuth login by configuring these variables.OAuth 2.0 Client ID from Google Cloud Console.Setup:
- Create OAuth 2.0 credentials in Google Cloud Console
- Add authorized redirect URI:
{NEXT_PUBLIC_APP_URL}/api/auth/callback/google - Copy the Client ID
OAuth 2.0 Client Secret from Google Cloud Console.
Database Configuration
PostgreSQL Connection
PostgreSQL connection string in the format:Examples:
The setup script automatically configures this based on your PostgreSQL choice (Docker or local).
PostgreSQL Docker Configuration
These variables are used bydocker-compose.yml when running PostgreSQL in Docker.
PostgreSQL username for the Docker container.
PostgreSQL password for the Docker container.
Database name to create in the PostgreSQL container.
Port to expose PostgreSQL on the host machine.Note: Change if port 5432 is already in use.
AI Configuration
Google AI (Required)
API key for Google’s Generative AI models (Gemini).Get your key: Google AI StudioUsage: Powers AI conversations and content analysis in ThinkEx.
Assistant UI (Required)
Base URL for the Assistant UI service from Assistant Cloud.Example:
https://api.assistant-ui.comAPI key for Assistant UI authentication.Get credentials: Assistant Cloud
Storage Configuration
Storage Type Selection
Choose the file storage backend for uploads (PDFs, images, etc.).Options:
local: Store files in./uploads/directory (recommended for self-hosting)supabase: Store files in Supabase cloud storage
The setup script automatically sets this to
local for local development.Supabase Storage (Optional)
Required only ifSTORAGE_TYPE=supabase.
Your Supabase project URL.Format:
https://your-project.supabase.coFind it: Supabase Dashboard → Project Settings → APISupabase anonymous/publishable API key for client-side requests.Find it: Supabase Dashboard → Project Settings → API →
anon public keySupabase service role key for server-side operations.Find it: Supabase Dashboard → Project Settings → API →
service_role secret keyOptional Features
Web Scraping
API key for Firecrawl web scraping service.Get your key: firecrawl.devUsage: Enhanced web content extraction for adding web pages to workspaces.
Strategy for web content scraping.Options:
hybrid(default): Try Google Context → Fallback to Firecrawl (if key exists) → Fallback to Directfirecrawl-only: Force Firecrawl for all scrapinggoogle-only: Force Google Context onlydirect-only: Force direct fetch only
hybrid mode provides the best reliability by falling back through multiple methods.Azure Document AI (OCR)
Optional OCR service for PDF processing using Mistral Document AI.API key from your Azure Mistral OCR deployment.Usage: PDF upload OCR and
scripts/ocr-pdf-from-url.shEndpoint URL for your Azure Document AI deployment.Required if
AZURE_DOCUMENT_AI_API_KEY is set.Model identifier for Azure Document AI.
Whether to extract images during OCR processing.Options:
true: Extract images (larger OCR results, enablespdfImageRefs)false: Skip images (smaller OCR results)
Configuration Examples
Minimal Local Setup
.env
Full Production Setup
.env
Updating Configuration
After modifying.env:
-
Development: Restart the dev server
-
Production: Rebuild and restart
Next Steps
Storage Setup
Configure file storage options
Installation
Back to installation guide