The Shahriar Stack: Why We Bet on Next.js and Wasm
A deep dive into the technical choices powering our ecosystem. Why we choose performance over popularity.
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."
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 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.
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.
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.
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.
LetX is successful not because of marketing, but because of Superior Performance. We engineered our way to growth.