Skip to main content
Typeset requires several environment variables to function properly. This page documents all required and optional environment variables needed for self-hosting.

Authentication variables

Typeset uses Clerk for user authentication. You’ll need to create a Clerk application and obtain your API keys.
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
string
required
Your Clerk publishable key. This is safe to expose in the browser and is used for client-side authentication.Find this in your Clerk dashboard under API Keys.
CLERK_SECRET_KEY
string
required
Your Clerk secret key. This should be kept secure and is used for server-side authentication.Find this in your Clerk dashboard under API Keys.
Never expose this key in client-side code or commit it to version control.

Collaboration variables

Typeset uses Liveblocks for real-time collaboration features.
LIVEBLOCKS_SECRET_KEY
string
required
Your Liveblocks secret key used for authenticating users and managing real-time collaboration.Get this from your Liveblocks dashboard under Project > API Keys.
This is a server-side only key and should never be exposed to the client.

AI model variables

Typeset integrates with OpenAI and Google AI for the AI assistant feature.
OPENAI_API_KEY
string
required
Your OpenAI API key for accessing GPT models. Used for the AI assistant that can edit documents and answer questions.Create an API key at platform.openai.com.
GOOGLE_GENERATIVE_AI_API_KEY
string
Your Google AI API key for accessing Gemini models. This is optional if you only want to use OpenAI models.Get an API key from Google AI Studio.

LaTeX compilation

Typeset uses Tectonic for LaTeX compilation. The binary must be installed separately and available in your system PATH or in the bin/ directory of your project.
PATH
string
Ensure your system PATH includes the Tectonic binary location:
  • Linux: /usr/local/bin/tectonic or ./bin/tectonic
  • macOS: /usr/local/bin/tectonic (default installation path)
  • Custom location: Add your custom path to the system PATH

Optional deployment variables

NEXT_PUBLIC_VERCEL_URL
string
Automatically set by Vercel. This is used for generating absolute URLs in production.If self-hosting outside of Vercel, set this to your domain name (e.g., typeset.yourdomain.com).

Example configuration

Create a .env.local file in your project root with the following variables:
# Authentication (Clerk)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...

# Collaboration (Liveblocks)
LIVEBLOCKS_SECRET_KEY=sk_...

# AI Models
OPENAI_API_KEY=sk-...
GOOGLE_GENERATIVE_AI_API_KEY=AI...

# Optional: Custom domain
NEXT_PUBLIC_VERCEL_URL=typeset.yourdomain.com
Never commit your .env.local file to version control. Add it to your .gitignore file to prevent accidental exposure of sensitive keys.

Validating your configuration

After setting up your environment variables:
  1. Restart your development server
  2. Check the browser console for any authentication errors
  3. Test creating a new project to verify Liveblocks integration
  4. Try the AI assistant to confirm API keys are working
  5. Compile a LaTeX document to ensure Tectonic is properly configured

Next steps

Authentication setup

Configure Clerk authentication in detail

Database configuration

Set up Liveblocks storage

Build docs developers (and LLMs) love