Skip to main content

Prerequisites

Before installing Typeset, ensure you have the following installed:
1

Node.js 20.x or later

Download from nodejs.org or use a version manager like nvm.
node --version
# Should output v20.x.x or later
2

pnpm package manager

Typeset uses pnpm for dependency management.
npm install -g pnpm
pnpm --version
3

Git

Required to clone the repository.
git --version

Clone the repository

Clone the Typeset repository to your local machine:
git clone https://github.com/yourusername/typeset.git
cd typeset
Replace yourusername/typeset with the actual repository URL.

Install dependencies

Install all required npm packages:
pnpm install
This will install all dependencies from package.json, including:

Core dependencies

  • next (15.3.8) - React framework
  • react (19.1.0) - UI library
  • typescript (5.8.3) - Type safety

Authentication

  • @clerk/nextjs (6.25.5) - User authentication
  • @clerk/themes (2.4.0) - Clerk UI components

Real-time collaboration

  • @liveblocks/client (3.2.0) - Liveblocks client
  • @liveblocks/react (3.2.0) - React bindings
  • @liveblocks/yjs (3.2.0) - Yjs integration
  • yjs (13.6.27) - CRDT library

AI integration

  • @ai-sdk/openai (1.3.23) - OpenAI integration
  • @ai-sdk/google (1.2.22) - Google AI integration
  • ai (4.3.19) - Vercel AI SDK

LaTeX editor

  • codemirror (6.0.2) - Code editor
  • codemirror-lang-latex (0.1.0-alpha.0) - LaTeX syntax
  • react-pdf (9.2.1) - PDF rendering
  • katex (0.16.22) - Math rendering

UI components

  • @radix-ui/react-* - Radix UI primitives
  • lucide-react (0.516.0) - Icon library
  • tailwindcss (4.1.11) - Styling
See the full dependency list in package.json.

Install Tectonic

Tectonic is the LaTeX compiler used by Typeset. Installation depends on your platform:
# The repository includes a pre-built binary
chmod +x bin/tectonic

# Verify installation
./bin/tectonic --version
The Tectonic binary path is platform-specific:
  • Linux: bin/tectonic (relative to project root)
  • macOS: /usr/local/bin/tectonic (absolute path)
This is configured in app/api/compile/route.ts:22-25.

Verify installation

Verify all components are installed correctly:
1

Check Node.js and pnpm

node --version
pnpm --version
2

Verify Tectonic

# Linux
./bin/tectonic --version

# macOS
tectonic --version
3

Test LaTeX compilation

Create a test file:
echo "\\documentclass{article}\n\\begin{document}\nHello World\n\\end{document}" > test.tex

# Compile with Tectonic
./bin/tectonic test.tex

# Should create test.pdf
ls -lh test.pdf

Development setup

Before running the development server, you need to configure environment variables.
Environment configuration is covered in detail in Configuration.
Create a .env.local file in the project root:
touch .env.local
Add the following environment variables (see Configuration for obtaining these values):
.env.local
# Clerk authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...

# Liveblocks collaboration
LIVEBLOCKS_SECRET_KEY=sk_...
NEXT_PUBLIC_LIVEBLOCKS_PUBLIC_KEY=pk_...

# AI providers (optional)
OPENAI_API_KEY=sk-...
GOOGLE_API_KEY=...

Run the development server

Start the Next.js development server:
pnpm dev
The application will be available at http://localhost:3000.
The dev server uses Turbopack for faster builds. To use webpack instead, remove --turbopack from the dev script in package.json.

Build for production

Create an optimized production build:
pnpm build
This will:
  1. Type-check your TypeScript code
  2. Compile MDX files with remark-gfm plugin
  3. Bundle assets with webpack
  4. Generate optimized static pages
  5. Create server functions for API routes
The build output will be in .next/.

Start production server

Run the production server locally:
pnpm start
The production server will run on http://localhost:3000.

Troubleshooting

Tectonic not found

If you see “Tectonic binary not found”:
  1. Verify the binary exists:
    # Linux
    ls -lh bin/tectonic
    
    # macOS
    which tectonic
    
  2. Check file permissions:
    chmod +x bin/tectonic
    
  3. Verify the path in app/api/compile/route.ts:22-25

Package installation fails

If pnpm install fails:
  1. Clear the pnpm cache:
    pnpm store prune
    
  2. Delete node_modules and pnpm-lock.yaml:
    rm -rf node_modules pnpm-lock.yaml
    pnpm install
    
  3. Ensure you’re using Node.js 20.x or later:
    node --version
    

Port already in use

If port 3000 is already in use:
# Use a different port
pnpm dev -- -p 3001

LaTeX compilation timeout

If LaTeX compilation times out:
  1. Check Tectonic can download packages:
    ./bin/tectonic test.tex --print-downloads
    
  2. Increase the timeout in app/api/compile/route.ts (default is 30 seconds)
  3. Pre-cache common packages by compiling a comprehensive test document

Next steps

Now that Typeset is installed, continue with:
1

Configure services

Set up Clerk, Liveblocks, and AI API keys in Configuration.
2

Deploy to production

Deploy to Vercel or your preferred platform using Deployment.

Build docs developers (and LLMs) love