HeyTeX is an open-source online scientific document editing platform that brings a Visual Studio Code-like experience directly to your browser.
The project's special feature is its ability to support two "engines" simultaneously: LaTeX (server-side TeXLive) and Typst (client-side Wasm), combined with real-time collaboration capabilities and a rich template system.
- Uses Monaco Editor (the core of VS Code) for a familiar coding experience.
- Supports IntelliSense, auto-completion, and snippets for both LaTeX and Typst.
- Customizable interface (Dark Mode/Light Mode) and theme support.
The compilation system uses a hybrid model to balance performance and compatibility:
- LaTeX Projects: Compiled with TeXLive on the server (server-side TeXLive)
- Typst Projects: Integrated Typst Wasm Renderer running in the browser for fast feedback (client-side Wasm).
- Template Gallery: Professional template library for various purposes:
- CV/Resume: Modern CV and Academic CV with publication lists
- Letter: Formal and business letters
- Article: Scientific articles with references
- Paper: Research papers in IEEE format
- Poster: Conference posters with tikzposter
- Report: Technical reports and documentation
- Finder-style UI: Intuitive 2-column interface for selecting engine and template
- Full support for both LaTeX and Typst
- Profile Dashboard: Detailed project statistics (LaTeX/Typst counts)
- Account Info: Registration date, last login timestamp
- Avatar Upload: Customize profile picture with MinIO storage
- Password Management: Secure password change with old password verification
- Allows multiple users to edit a document simultaneously.
- Displays other users' cursors in real-time.
- Uses CRDT (Conflict-free Replicated Data Types) algorithm via Yjs to ensure data integrity.
- Integrated PDF Viewer: Preview results right next to the source code.
- Reverse Sync (SyncTeX): Double-click on PDF to jump to corresponding code line and vice versa.
- Auto-compile: Automatic compilation on changes (debounced)
- Supports multi-level folder structures.
- Import images/documents via Drag & Drop.
- Quick project search by name or engine.
- Framework: React.js + Vite
- Editor Core: Monaco Editor
- State Management: Zustand
- UI Components: Tailwind CSS + Shadcn/UI
- UI Library: Radix UI for accessible components
- LaTeX:
texlive(Server-side TeXLive; not a Wasm build). - Typst:
@typst/compiler(Official Wasm compiler, runs client-side).
- Protocol: WebSocket.
- Library: Yjs (CRDT framework) +
y-websocket. - Server: Node.js (Express) + TypeScript.
- Metadata: PostgreSQL with Prisma ORM (Store user info, project settings, login tracking).
- File Storage: MinIO (S3-compatible) for avatars and assets.
- Project Files: Local filesystem with organized directory structure.
- Node.js >= 18.0.0
- npm or yarn
- PostgreSQL >= 14
- MinIO or S3-compatible storage
- TeXLive (for LaTeX compilation)
git clone https://github.com/phucdhh/HeyTeX.git
cd HeyTeX# Install Frontend dependencies
cd client
npm install
# Install Backend dependencies
cd ../server
npm installCreate .env files in both client and server directories based on .env.example. Ensure proper configuration for database, MinIO, and TeXLyre Wasm assets.
Server .env example:
DATABASE_URL="postgresql://user:password@localhost:5432/heytex"
JWT_SECRET="your-secret-key"
MINIO_ENDPOINT="localhost"
MINIO_PORT=9000
MINIO_ACCESS_KEY="minioadmin"
MINIO_SECRET_KEY="minioadmin"cd server
npx prisma generate
npx prisma db pushmacOS:
# First-time setup
./setup-mac.sh
# Services auto-start with LaunchDaemon (after reboot)
# See details: documents/LAUNCHDAEMON.md
# Or start manually
./start-services.shDevelopment:
# Terminal 1: Backend
cd server && npm run dev
# Terminal 2: Frontend
cd client && npm run devProduction Build:
# Build Frontend
cd client && npm run build
# Build Backend
cd server && npm run build
# Start Backend
cd server && node dist/index.js📖 See more: SCRIPTS.md - List of scripts & configs
Templates are organized in the templates/ directory:
templates/
├── latex/
│ ├── blank/ # Empty LaTeX document
│ ├── cv/ # Modern CV (moderncv)
│ ├── academic-cv/ # Academic CV with publications
│ ├── letter/ # Formal letter
│ ├── article/ # Article with references
│ ├── paper/ # Research paper (IEEE format)
│ ├── poster/ # Conference poster (tikzposter)
│ └── report/ # Technical report
└── typst/
├── blank/ # Empty Typst document
├── cv/ # Modern CV
├── academic-cv/ # Academic CV with publications
├── letter/ # Formal letter
├── article/ # Article with sections
├── paper/ # Research paper
├── poster/ # Conference poster
└── report/ # Technical report
Each template contains:
template.json: Metadata (id, name, description, engine, mainFile, files)- Template files:
.texor.typfiles with professional layouts
docker-compose up -d- Build frontend:
cd client && npm run build - Deploy static files to web server (nginx/Apache)
- Build and run backend:
cd server && npm run build && node dist/index.js - Configure reverse proxy for WebSocket support
For production deployment on macOS, use LaunchDaemons for automatic service management:
# Install daemons
sudo cp launchd-daemons/*.plist /Library/LaunchDaemons/
sudo launchctl load /Library/LaunchDaemons/com.heytex.*.plistSee documents/LAUNCHDAEMON.md for details.
Planned features for future releases:
- ✅ Template Gallery: Professional templates for reports, CVs, papers (both LaTeX and Typst).
- ✅ Profile Management: Project statistics and account management.
- ✅ Password Change: Secure password change with verification.
- Git Integration: Commit, push, and pull code directly from GitHub/GitLab.
- AI Assistant: Integrate LLM (like OpenAI/Gemini) to explain LaTeX errors or suggest formulas.
- Offline Mode (PWA): Allow basic editing and compilation even when offline (Service Workers).
- Export Options: Export to HTML and ePub (PDF already supported).
- Custom Templates: Allow users to create and share their own templates.
- Template Preview: Preview templates before creating projects.
-
WebAssembly (Wasm) Handling:
- The
.wasmfiles are primarily related to Typst (client-side). Use Service Workers to cache these files on first load, so users don't have to reload them every time they refresh the page. - Use Web Workers to run Typst compilation in a separate thread (background thread), avoiding UI freezing when compiling large documents.
- The
-
Persistence Mechanism:
- Since collaboration is enabled, you can't just store files locally in the browser. You need a mechanism to periodically sync the
Yjsstate (from RAM) to the database (Persistence Layer) to prevent data loss when all users leave the room.
- Since collaboration is enabled, you can't just store files locally in the browser. You need a mechanism to periodically sync the
-
Typst Optimization:
- Typst has Incremental Compilation capability. Ensure your frontend only sends the "delta" (changed parts) to the Wasm compiler instead of sending the entire file content with each keystroke.
-
Security:
- Although compilation happens client-side (browser), uploading images or PDF outputs still requires strict access control (ACL) on S3/MinIO.
We welcome all contributions! Please read CONTRIBUTING.md to learn about our Pull Request process.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
HeyTeX is built upon the following open-source projects:
- TeXlyre - Web-based LaTeX editor with WebAssembly
- TeXlyre Infrastructure - Docker deployment infrastructure
- WASM LaTeX Tools - WebAssembly compilation tools
- TeXlyre Documentation - Official documentation
- Typst - Modern markup-based typesetting system
- Yjs - CRDT framework for building collaborative applications
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).
AGPL-3.0 requires:
- Source code disclosure when deploying online services
- Derivative works must use the same license
- Protects software freedom for the community
Special thanks to:
- The TeXlyre team for the WebAssembly LaTeX foundation
- The Typst team for the modern typesetting system
- The Monaco Editor and VS Code teams at Microsoft
- The Yjs community for CRDT collaboration tools
- All contributors and users of HeyTeX
- GitHub: phucdhh/HeyTeX
- Issues: Report bugs or request features
- Email: support@heytex.dev
Made with ❤️ by the HeyTeX team