An AI-powered collaborative LaTeX editor with real-time PDF compilation and intelligent editing suggestions.
Before running this project locally, ensure you have the following installed:
- Node.js (v20 or higher)
- npm or yarn or pnpm or bun
- Docker Desktop (optional, for faster local LaTeX PDF compilation - falls back to remote service if not available)
- Supabase CLI (optional, for local database development)
git clone https://github.com/Octree-AI-Latex-Editor/octree.git
cd octreenpm install
# or
yarn install
# or
pnpm installCreate a .env.local file in the root directory with the following variables:
# Supabase Configuration (Required)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
# Stripe Configuration (Required for billing features)
STRIPE_PROD_SECRET_KEY=your_stripe_secret_key
STRIPE_TEST_SECRET_KEY=your_stripe_test_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
# AI Provider Key (Required for AI editing features)
OPENAI_API_KEY=your_openai_api_key
# Environment (Optional)
ENVIRONMENT=dev # Set to 'prod' for production
NODE_ENV=development- Supabase: Sign up at supabase.com, create a project, and get your URL and anon key from Project Settings > API
- Stripe: Get API keys from stripe.com/dashboard
- OpenAI: Get API key from platform.openai.com - The app uses GPT-5 with smart model selection (GPT-5 mini for small tasks, GPT-5 for large/complex files)
This project uses Supabase for authentication and data storage. You need to:
- Create a Supabase project at supabase.com
- Run migrations (located in
supabase/migrations/):# If using Supabase CLI locally supabase db push # Or manually run the SQL files in the Supabase SQL Editor: # - 001_add_user_usage_table.sql # - 002_add_monthly_limits.sql # - 003_fix_ambiguous_column_reference.sql
The app can compile LaTeX to PDF locally using Docker in development mode:
- Install Docker Desktop from docker.com (optional)
- Start Docker Desktop (if installed)
- Pull the TeX Live image (optional, will auto-pull on first use):
docker pull texlive/texlive
Note:
- If Docker is not installed or not running, the app automatically falls back to the remote compilation service
- In production (
ENVIRONMENT=prod), the app always uses the remote compilation service- Docker is recommended for faster local compilation, but not required
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devOpen http://localhost:3000 in your browser to see the application.
ai-latex-editor/
├── app/ # Next.js app directory
│ ├── api/ # API routes
│ ├── auth/ # Authentication pages
│ ├── projects/ # Project management
│ └── ...
├── components/ # React components
│ ├── editor/ # Editor-specific components
│ ├── ui/ # Reusable UI components
│ └── ...
├── hooks/ # Custom React hooks
├── lib/ # Utility functions and configs
├── actions/ # Server actions
├── supabase/ # Database migrations
└── types/ # TypeScript type definitions
npm run dev- Start development server with Turbopacknpm run build- Build for productionnpm start- Start production servernpm run lint- Run ESLint
- 🤖 AI-Powered Editing - Intelligent LaTeX suggestions with smart GPT-5 model selection (mini for speed, full for complex tasks)
- 📝 Monaco Editor - Advanced code editing with syntax highlighting
- 📄 Real-time PDF Compilation - Instant preview of your LaTeX documents
- 👥 Authentication - Secure user auth via Supabase
- 💳 Subscription Management - Stripe integration for billing
- 📊 Usage Tracking - Monitor API usage and limits
- Docker is optional - the app will automatically use the remote service if Docker is unavailable
- If you want to use Docker locally:
- Ensure Docker Desktop is running
- Check Docker has sufficient resources allocated (Settings > Resources)
- Verify the
tmp/directory can be created in the project root
- If compilation fails, check the browser console for error details
- Verify Supabase credentials in
.env.local - Check if migrations have been run
- Ensure your IP is allowed in Supabase project settings
- Ensure all required API keys are set in
.env.local - Check API key permissions and quotas
- Verify keys are not expired
The easiest way to deploy your Next.js app is to use the Vercel Platform.
Make sure to set all environment variables in your Vercel project settings.
Check out the Next.js deployment documentation for more details.
This project is licensed under the MIT License - see the LICENSE file for details.