// HACKER NEWS — CYBERSECURITY
Show HN: TeXbrain, a LaTeX editor that runs pdfTeX in the browser via WASM
A free, open-source LaTeX editor that runs entirely in your browser.
No accounts. No installs. No servers. Just open a tab and write.
I built this because I was tired of paying for features that should be free. I wrote my thesis last year in LaTeX and spent more time fighting tooling than actually writing. Online solutions lock git sync behind a paywall. Local setups break between machines. I wanted something that just works. Open a browser, write LaTeX, get a PDF.
texbrain is a full LaTeX editor that compiles your .tex files to PDF directly in the browser. There is no backend. No server processing your files. Everything (the editor, the compiler, the git client) runs client-side.
You can open a local project folder, edit your files, see the PDF update, commit your changes, and push to GitHub. All from one tab.
Editor. Built on CodeMirror 6 with a custom LaTeX grammar (Lezer parser), autocomplete provider, and theme system. The editor supports multiple open files via tabs and syncs content with both the local filesystem and the in-memory git working tree.
Compiler. LaTeX compilation uses SwiftLaTeX's pdfTeX engine compiled to WebAssembly. The engine runs in a memory filesystem (MEMFS), where your project files are written before each compilation. When the engine asks for a file it doesn't have (a class, package, font, ...), the service worker resolves it through a chain: previously cached files first, then the package subset bundled with the app, then a TeX Live mirror (a texmf-dist mirror on jsDelivr, with a community SwiftLaTeX server as fallback). Every resolved file is stored in the browser's cache storage, so each package is downloaded at most once. After the first successful compile, the bundled subset is also prefetched in the background so the core package set works offline.
Git. All git operations use isomorphic-git, a pure JavaScript implementation of git. The repository lives in an in-memory filesystem (LightningFS) backed by IndexedDB. Your project files are synced between the local filesystem and the git working tree. Remote operations (push/pull/clone) go through a CORS proxy since browsers can't speak the git protocol directly.
PDF viewer. Rendered with pdf.js, Mozilla's PDF rendering library. Supports multi-page rendering with a text layer for selection and search.
File system. The app uses the File System Access API to read/write your actual files on disk. This requires a Chromium-based browser (Chrome, Edge, Arc, Brave). For other browsers, there's a fallback using the Origin Private File System (OPFS).
Frontend. SvelteKit with the static adapter. The entire app is pre-built to static HTML/CSS/JS and deployed to GitHub Pages. No SSR, no API routes, no server. Tailwind CSS handles styling.