Deploy TeXbrain

Browser LaTeX editor and Overleaf alternative with a private git proxy

Deploy TeXbrain

Just deployed

Deploy and Host TeXbrain on Railway

Deploy on Railway

TeXbrain is a free, open-source LaTeX editor that runs entirely in your browser, an Overleaf alternative with no account and no server-side compile. pdfTeX runs as WebAssembly in the tab, so the PDF preview updates as you type, and documents stay on your machine: in a folder on your disk (Chrome and Edge) or in the browser's own storage. It has multi-file projects, autocomplete, snippets, a problems panel that explains LaTeX errors, packages loaded on demand from TeX Live, a built-in git client for GitHub, GitLab, Codeberg and Bitbucket, and it keeps working offline. This template runs TeXbrain on Railway together with its own git proxy, so your git token and repositories never pass through a third-party relay.

About Hosting TeXbrain

Deploy, wait for the green check, and open the Railway domain. Click Open Editor: a welcome document compiles straight away. Start a project with New Project, Open Folder or Clone Repository.

Why host it yourself: a private git proxy. Browsers can't talk to git servers directly, so the hosted TeXbrain sends every clone, pull and push, with your access token in it, through the public relay at cors.isomorphic-git.org. This template runs that relay inside the same service, at /git-proxy on your own domain, and the editor uses it by default. Your token and your repository's contents go only from your browser to your server to your git host.

The proxy is locked down, so it can't be used as an open relay from Railway's network (which would make abuse reports land on you):

  • only git clone, fetch, pull and push requests are relayed, nothing else;
  • only to the hosts in ALLOWED_GIT_HOSTS (GitHub, GitLab, Codeberg and Bitbucket by default), never to IP addresses or Railway-internal names;
  • only for requests from the editor's own page on your domain: browsers refuse to let another website use it;
  • at most 120 requests a minute per visitor;
  • behind the login, when you turn one on.

Add your own git host (a self-hosted GitLab, Gitea or Forgejo) by appending it to ALLOWED_GIT_HOSTS, for example github.com,gitlab.com,codeberg.org,bitbucket.org,git.example.com. Set it to none to turn the proxy off.

Optional login: set EDITOR_PASSWORD (and EDITOR_USERNAME, default admin) on the Variables tab to put the whole editor and its git proxy behind a browser sign-in. Without one the editor is open to anyone who has the URL. That is the same as the public site: nothing is stored on the server, every visitor's documents and tokens stay in their own browser, and the proxy refuses anything but git traffic to the allowed hosts. Turn the login on if you'd rather not share your server's bandwidth. The app manifest and icon stay public, so the browser can still offer to install TeXbrain as an app.

Pushing to GitHub: in the editor's Git panel, open Settings and paste a fine-grained personal access token with Contents: read and write for the repository. The token is stored in your browser only and is sent, per request, through your own proxy to GitHub.

Common Use Cases

  • Writing papers, theses, CVs, letters and Beamer slides without installing TeX Live
  • A private Overleaf alternative that keeps documents on your own disk and in your own git repository
  • Syncing LaTeX projects with GitHub, GitLab or Codeberg from the browser without a third-party relay
  • A LaTeX editor for a class or team that works offline once loaded
  • Self-hosting a browser LaTeX editor on your own domain

Dependencies for TeXbrain Hosting

  • None. One service, no database and no volume: documents live in each user's browser or on their disk.

Deployment Dependencies

Implementation Details

  • Build: TeXbrain has no releases, so the template builds a pinned commit of its main branch (SvelteKit static build with pnpm and a frozen lockfile). A small patch makes the app's git proxy default to https://‹your domain›/git-proxy instead of cors.isomorphic-git.org, keeps the service worker from caching git answers, and updates the privacy page to match. You can still point the editor at any other proxy in Git > Settings.
  • Server: one Node.js process serves the static app and runs @isomorphic-git/cors-proxy 3.0.3 under /git-proxy, with the host allowlist, same-origin check and rate limit in front of it. With the login on, the browser's sign-in is removed from proxied requests, so it never reaches your git host; the git host only sees your token.
  • Compiling: pdfTeX (SwiftLaTeX) runs in a Web Worker in the browser. Common packages and fonts ship with the app and are served by your server; anything else is fetched on demand from a TeX Live mirror on jsDelivr, with texlive.texlyre.org as a fallback (only package file names are requested, never your document). The fallback can be changed or turned off in the editor's preferences (texliveMirror).
  • Collaboration (marked "soon" upstream) uses public WebRTC signaling, and opening a .drawio file embeds diagrams.net; both are upstream behaviour, unchanged here.
  • Never crash-looping on a variable: a malformed PORT, ALLOWED_GIT_HOSTS or login variable is logged and replaced with a safe default.
  • Search engines: the template asks them not to index your copy (robots.txt and X-Robots-Tag), and leaves out upstream's sitemap and Google verification file. The Privacy, Terms and Imprint pages are upstream's and describe tex.swimmingbrain.dev.
  • Compression: the app and the bundled TeX Live files are pre-compressed with Brotli, so a first compile downloads about a quarter of the bytes.
  • Memory: about 30 MB; fits the Free plan easily. The files it serves come from the image, which Railway does not count as page cache.
  • Healthcheck: /healthz, which needs no login.

Why Deploy TeXbrain on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying TeXbrain on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
Rocky Linux
Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
51
View Template
Foundry Virtual Tabletop
Self-hosted virtual tabletop for role-playing games (license required)

Lucas
71
View Template
NEW
Double Commander in your browser
The Double Commander file manager in the cloud, from any device

Nermin Sabanovic
0