If you just want to use ThinkEx, go to thinkex.app — no setup needed. This guide is for running ThinkEx on your own infrastructure.
Prerequisites
Before you begin, make sure you have:- Node.js v20 or later
- pnpm (installed automatically by the setup script if missing)
- Docker (recommended for PostgreSQL) or PostgreSQL v12+ installed locally
- A Google AI API key from Google AI Studio — required for AI features
Setup
- Automated
- Manual
The setup script handles everything interactively: prerequisites, environment configuration, database initialization, and starting the development server.The script will:
Clone and run the setup script
- Check for Node.js, pnpm, and Docker
- Create your
.envfile from the template - Generate
BETTER_AUTH_SECRETautomatically - Start PostgreSQL in Docker (or connect to a local PostgreSQL if Docker is unavailable)
- Install dependencies
- Initialize the database schema
- Start the development server
Open ThinkEx
Navigate to http://localhost:3000 in your browser.
Storage options
ThinkEx supports two backends for file uploads. Choose the one that fits your setup:- Local storage
- Supabase storage
Files are saved to the This is the recommended option for self-hosting. You have full control over your files with no third-party services required.
./uploads directory on the server. This is the simplest option and requires no external dependencies.Environment variables
Required
These variables must be set for ThinkEx to run:| Variable | Description |
|---|---|
DATABASE_URL | PostgreSQL connection string. For Docker: postgresql://thinkex:thinkex_password_change_me@localhost:5432/thinkex. For local PostgreSQL: postgresql://user:password@localhost:5432/thinkex |
BETTER_AUTH_SECRET | Secret key for session signing. Generate one with openssl rand -base64 32. |
GOOGLE_GENERATIVE_AI_API_KEY | API key from Google AI Studio. Required for all AI features. |
STORAGE_TYPE | File storage backend. Set to local or supabase. |
Public URL (required for non-localhost deployments)
If you’re deploying to a domain other thanlocalhost, set both of these to your public origin:
| Variable | Description |
|---|---|
NEXT_PUBLIC_APP_URL | The public URL of your ThinkEx instance (e.g., https://thinkex.example.com). |
BETTER_AUTH_URL | Must match NEXT_PUBLIC_APP_URL for authentication to work correctly. |
Optional
| Variable | Description |
|---|---|
GOOGLE_CLIENT_ID | Enables Google OAuth login. Get from Google Cloud Console. |
GOOGLE_CLIENT_SECRET | Required alongside GOOGLE_CLIENT_ID for Google OAuth. |
NEXT_PUBLIC_SUPABASE_URL | Your Supabase project URL. Required when STORAGE_TYPE=supabase. |
NEXT_PUBLIC_SUPABASE_ANON_KEY | Supabase anon (public) key. Required when STORAGE_TYPE=supabase. |
SUPABASE_SERVICE_ROLE_KEY | Supabase service role key. Required when STORAGE_TYPE=supabase. |
FIRECRAWL_API_KEY | Enables web scraping via Firecrawl. |
MISTRAL_API_KEY | Enables Mistral OCR for enhanced document text extraction. |