Skip to main content
To configure ThinkEx, copy .env.example to .env and fill in the values for your environment. The application reads these variables at startup.
cp .env.example .env
Below is the full .env.example for quick reference:
# Application
NEXT_PUBLIC_APP_URL=http://localhost:3000

# Authentication
BETTER_AUTH_SECRET=your-better-auth-secret
BETTER_AUTH_URL=http://localhost:3000

# Google OAuth
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...

# Database Configuration
# DATABASE_URL=postgresql://thinkex:thinkex_password_change_me@localhost:5432/thinkex

# File Storage Configuration
STORAGE_TYPE=local

# Supabase (optional - only needed if STORAGE_TYPE=supabase)
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...
SUPABASE_SERVICE_ROLE_KEY=eyJ...

# Google AI
GOOGLE_GENERATIVE_AI_API_KEY=AIza...

# Firecrawl Web Scraping (Optional)
FIRECRAWL_API_KEY=fc_...

# FastAPI Service (optional)
# FASTAPI_BASE_URL=https://your-fastapi-service.com
# FASTAPI_API_KEY=your-service-api-key

# Mistral OCR
MISTRAL_API_KEY=your-mistral-api-key
Never commit your .env file to version control. It contains secrets that grant access to your database, authentication system, and third-party services. Add .env to your .gitignore.

Application

NEXT_PUBLIC_APP_URL
string
default:"http://localhost:3000"
required
The public URL of your ThinkEx instance. Used to generate absolute URLs for links, redirects, and OAuth callbacks. Set this to your domain when deploying (e.g., https://thinkex.example.com).

Authentication

BETTER_AUTH_SECRET
string
required
A secret key used to sign and verify authentication sessions. Generate a secure value with:
openssl rand -base64 32
BETTER_AUTH_URL
string
default:"http://localhost:3000"
required
The base URL used for authentication callbacks and redirects. Set this to the same value as NEXT_PUBLIC_APP_URL when deploying to a public domain.

Database

DATABASE_URL
string
required
PostgreSQL connection string for your ThinkEx database.
# Docker PostgreSQL (recommended)
DATABASE_URL=postgresql://thinkex:thinkex_password_change_me@localhost:5432/thinkex

# Local PostgreSQL
DATABASE_URL=postgresql://user:password@localhost:5432/thinkex
The automated setup script (./setup.sh) configures this value for you if you use Docker.

Google OAuth (optional)

Enable Google sign-in by creating OAuth 2.0 credentials in the Google Cloud Console. If you omit these variables, users can still sign in with email and password.
GOOGLE_CLIENT_ID
string
The OAuth 2.0 client ID from your Google Cloud project.
GOOGLE_CLIENT_SECRET
string
The OAuth 2.0 client secret from your Google Cloud project.

AI

GOOGLE_GENERATIVE_AI_API_KEY
string
required
API key for Google’s Generative AI (Gemini). ThinkEx uses this for all AI chat features. Get your key from Google AI Studio.

Storage

STORAGE_TYPE
string
default:"local"
required
Controls where uploaded files are stored. Accepted values: local or supabase.
  • local — Files are saved to the ./uploads/ directory on the server. Recommended for most self-hosted setups.
  • supabase — Files are stored in a Supabase storage bucket. Requires the Supabase variables below.
See Storage for a full guide.

Supabase storage (optional)

These variables are only required when STORAGE_TYPE=supabase.
NEXT_PUBLIC_SUPABASE_URL
string
The URL of your Supabase project (e.g., https://your-project.supabase.co). Found in your Supabase project’s Settings → API.
NEXT_PUBLIC_SUPABASE_ANON_KEY
string
The anon (public) key for your Supabase project. Used by the browser to request signed upload URLs.
SUPABASE_SERVICE_ROLE_KEY
string
The service role key for your Supabase project. Used server-side to generate signed upload URLs and manage storage. Keep this secret — it bypasses Supabase row-level security.

Optional integrations

FIRECRAWL_API_KEY
string
API key for Firecrawl. When set, ThinkEx uses Firecrawl to fetch richer content from web URLs (full page text, structured data). Without this key, ThinkEx falls back to basic URL fetching.
MISTRAL_API_KEY
string
API key for Mistral AI. Used to power OCR on images and PDFs via Mistral’s OCR API. Without this key, ThinkEx cannot extract text from image-based documents.
FASTAPI_BASE_URL
string
Base URL of an external FastAPI service (e.g., https://your-fastapi-service.com). When configured alongside FASTAPI_API_KEY, ThinkEx uses this service for file conversion, document-to-markdown conversion, and audio/video analysis.
FASTAPI_API_KEY
string
Bearer token used to authenticate server-to-server requests to the FastAPI service. Required when FASTAPI_BASE_URL is set.