The Future of Typesetting
Website
·
Issues
Built by Crafter Station
LATEX0 is an AI-powered LaTeX editor for the modern era. Write, compile, and collaborate in real-time.
Researchers deserve open source tools.
- AI Assistant — Chat with AI to generate and edit LaTeX code
- Real-time Collaboration — See other users' cursors live with unique colors
- Document Persistence — Save and manage multiple documents with auto-save
- Monaco Editor — VS Code-quality editing with LaTeX syntax highlighting
- Live Preview — Instant PDF rendering as you type
- Hybrid Authentication — Sign in with Google/GitHub via Clerk, or work as a guest
# Clone
git clone https://github.com/crafter-station/latex0.git
cd latex0
# Install
bun install
# Configure
cp .env.example .env.local
# Add your environment variables (see below)
# Set up database
bun db:push
# Run
bun dev# Supabase (for real-time collaboration)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY=your_supabase_key
# Database (for document persistence)
DATABASE_URL=your_postgresql_connection_string
# AI Gateway (for chat functionality)
AI_GATEWAY_API_KEY=your_ai_gateway_key
# Latex Renderer
NEXT_PUBLIC_LATEX_API_KEY=
NEXT_PUBLIC_LATEX_API_URL=# Authentication (Clerk - enables Google/GitHub OAuth)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_key
CLERK_SECRET_KEY=your_clerk_secret
# Rate Limiting (Upstash Redis)
UPSTASH_REDIS_REST_URL=your_upstash_url
UPSTASH_REDIS_REST_TOKEN=your_upstash_tokenNote: Guest users can use the editor without authentication. Only authenticated users (via Clerk) can save and persist documents.
The project uses Drizzle ORM with PostgreSQL (via Supabase).
# Generate migration files
bun db:generate
# Push schema to database
bun db:push
# Open Drizzle Studio (database GUI)
bun db:studioThe documents table stores saved LaTeX documents:
id— Unique document ID (nanoid)title— Document titlecontent— LaTeX source codefolder— Organization folder (default: "root")user_id— Owner's Clerk user IDcreated_at,updated_at— Timestamps
Migration files are stored in drizzle/ and version-controlled. The schema is defined in lib/db/schema.ts.
- Repository Pattern — Data access abstraction in
lib/db/repositories/ - API Routes — Next.js API routes handle CRUD operations with Clerk authentication
- No RLS — Authorization is handled in API routes (not Supabase RLS) since Drizzle uses direct database connection
- Auto-save — Documents auto-save every 2 seconds while editing
- URL Routing — Each document has a unique URL (
/playground/{id})
MIT
Built with care by Crafter Station
