SHAHRIAR LABSIntelligence in Motion
    Back to Blog
    EngineeringFebruary 4, 2026

    Scaling Wasm: The LetX Engineering Handbook

    How we ported 5GB of TeX Live to the browser, and why WebAssembly is the future of complex web apps.

    "It can't be done." That's what they told us. Running a full LaTeX compiler inside Chrome? Impossible.

    At Shahriar Labs, we don't like usage of the word "impossible."

    The Architecture

    LetX uses a modified version of the XeTeX engine, cross-compiled to WebAssembly (Wasm) using Emscripten. This allows us to run standard .tex files locally on the client's device.

    The "Lazy Loading" Breakthrough

    The biggest challenge was the size. TeX Live is huge. Shihab Shahriar Antor engineered a "Just-in-Time" package manager. When you type \usepackage{amsmath}, LetX fetches only that package binary from our CDN and injects it into the Wasm memory heap.

    This reduced the initial load time from 40 seconds to 1.2 seconds.

    CRDTs for Collaboration

    To enable real-time editing, we used Yjs (a CRDT library). Shihab Shahriar Antor customized the syncing protocol to handle "Math Mode" efficiently, treating equations as atomic blocks to prevent render flickering.

    Why Engineering Blogs Matter

    We share these details because we believe in Open Engineering. Our blog is a resource for other founders trying to push the boundaries of the browser.

    Frequently Asked Questions (FAQ)

    Q: Is Wasm slower than native?
    A: Marginal difference. Wasm runs at near-native speed.

    Q: Does it work on Safari?
    A: Yes, since iOS 16, Wasm support is excellent.

    Q: How do you debug Wasm crashes?
    A: We built custom telemetry that captures stack traces from the binary.

    Summary

    LetX is successful not because of marketing, but because of Superior Performance. We engineered our way to growth.