TeXbrain is a static site with no backend. pdfTeX is compiled to WebAssembly (SwiftLaTeX) and runs in your browser. The editor can read and write your project folder through the File System Access API, so you can use git, any local TeX install, local AI Agents, or any other editor on the same files. Git is built in through isomorphic-git for anyone who would rather not touch a terminal and clone, branch, commit, push or pull via commands. No account is needed, no analytics, and everything works offline after the first load.
Try it out: https://tex.swimmingbrain.dev/ (Chromium browsers get direct folder access, while Firefox or Safari fall back to a virtual filesystem)
Or for self-hosting/contributing: https://github.com/swimmingbrain/texbrain (MIT, the pdfTeX engine is EPL 2.0 / GPL 2.0 and is listed in the THIRD_PARTY_LICENSES file).
The part I'm most proud of getting to work is the package loading. The engine itself is only 1.8 MB. When it asks for a file it doesn't have, then a service worker intercepts the request and resolves it through Cache Storage first, then a small bundled subset, then a TeX Live tree mirrored on jsDelivr, then a SwiftLaTeX style server as a last resort. Every file is fetched once at most and after the first successful compilation, the core subset is prefetched in the background so that the offline story actually holds. Only file names go over the network, never any document content.
So far, it only supports pdfTeX (no XeTeX or LuaTeX), so fontspec or polyglossia won't work, packages are pinned to the TeX Live 2020 era to stay coherent with the engine's format file and there is no bibtex or biber in the engine yet, which is maybe the roughest edge.
This is should be a good solution for people on a work laptop, a Chromebook, or a university lab PC where installing TeX Live isn't always an option, and people who don't want to maintain a TeX install at all. If you already have a local setup you like, keep it. This isn't necessarily thought as a replacement for that.
Some people have already used it for their thesis in the past months and their bug reports (which I would never have hit on my own) were then most of the summer's work. The first outside PR also landed recently, so if something doesn't compile for you, an issue with the package name or the bug itself is the most useful thing you can send me!

Discussion (26 Comments)Read Original on HackerNews
Also, we (the TeX Live team) would be happy to add Wasm as an officially-supported platform, it's just that nobody has volunteered yet [0]. Coincidentally, someone else suggested something similar to us a few months ago [1]. Feel free to reach out if you're interested.
[0]: https://tug.org/texlive/build.html#volunteers
[1]: https://github.com/TeX-Live/texlive-source/issues/87
The format and packages have to agree, and when I pulled in newer packages against that old format, some things broke (hyperref had changed its aux label format, for which I ended up backporting a padding fix, and babel was missing some aliases in the mismatched version, e.g. brazil-portuges).
And yes, I'd be very happy to help with that and will get in touch via the volunteers page!
Great to see a FOSS version!
Although I agree that it would be cool to have some hello-world example pre-opened.
I'll make New Project also fall back the same way, so it works in Firefox and Safari without the detour.
I never really got the hang of LaTeX but I've really enjoyed Typst the past few years and even made a few books with it. Have you ever tried that or have thought on it?
Ctrl+S brings up the browser save as but also saves the document and recompiles. Ctrl+Enter puts in a new line and recompiles.
Can click compile of course, but that's not efficient.
* https://keenwrite.com/
* https://keenwrite.com/screenshots.html
See my Typesetting Markdown series:
https://dave.autonoma.ca/blog/2019/05/22/typesetting-markdow...
> Is there a specific reason you picked ConTeXt?
LaTeX:
* doesn't (easily, or practically) separate content from presentation;
* has arcane, antiquated syntax;
* packages can have namespace conflicts (rare, but happens);
* requires package installation for additional features.
ConTeXt, being monolithic and newer, avoids all those issues. The feature matrix lists a number of samples typeset with ConTeXt:
https://keenwrite.com/blog/2025/09/08/feature-matrix/
FWIW, pandoc has the ability to generate ConTeXt code.
I decided to hard refresh the tab and this time I got a different error:
on line 39. Again it was unclear line 39 of which package.The TFM error usually means a font file wasn't available. However, the service worker validates the downloads before caching, so any error pages or empty bodies get rejected (which makes posoned cache unlikely), but a stale state may still be possible.
Hard refresh bypasses the service worker, I patched around that last month but apparently not well enough.
Also, better error logs and reporting is already on my ToDo-list, sorry for that.
I tried uploading a .tex file created earlier this year and was able to see a PDF preview without any additional configuration.
As someone who has a local TeX setup, I'm a fan of your approach to loading dependencies on demand with a service worker. The installation process on my computer took a while because it was downloading a bunch of dependencies I didn't need.