Turns out that now, with trimming in Julia and WasmCodegen.jl, it is easy to run Julia apps in the browser fully client-side, without any server, on both CPU and GPU!
I had a few Julia tools I wrote and always wanted to make more accessible to people, so I tried browser compilation recently. It turned out totally feasible to take a bunch of packages that know nothing about the browser, add a bit of glue code (really a small browser-specific handler), and have a single codebase run the same way natively and in the browser.
In my experience, the browser run is somewhat slower, often within a factor of two or so, and this can potentially be improved with better WebAssembly compilation going forward. The total download is a few megabytes, and it works in all modern browsers, including on phones.
Here are two apps I built this way.
Synchray demo
A relativistic jet rendered in real time, specifically intended as a demo of WebAssembly and WebGPU: Synchray demo (source: GitHub - aplavin/SynchrayDemo.jl · GitHub)
Key packages used:
- Synchray.jl: pure Julia physics rendering engine, knows nothing about GPU or web
- imgui (CImGui.jl, ImPlot.jl, …): lightweight UI library
- WasmCodegen.jl (@gbaraldi @pankgeorg @asinghvi17 and other contributors): compiles Julia code to run in the browser, as WebAssembly
- WasmPages.jl (mine): tools to compile C libraries with Emscripten_jll, and build multi-module apps; a big chunk is a stopgap until BinaryBuilder (hopefully!) supports the WebAssembly platform
- WebGPU.jl (mine): compiles Julia code to run on WebGPU, in the same manner as GPUCompiler.jl’s CUDA/Metal/… backends do it
The repo is a good template to start from: julia --project=web web/build.jl builds a static page that can be served from any host.
Replace Synchray.jl with your computational backend, write some basic UI, and your web app is done ![]()
VLBInspect
The second one is an actually useful one: an in-browser tool for inspecting VLBI interferometric data and making quick images: VLBI explorer. It has a synthetic data button if you just want to look around.
Requirements and rough edges
The only real requirement is that the code you compile to the browser is type stable and completely statically determined, so you need to take some more care when writing packages and code. For these apps I had to make some minor changes to the packages involved, but it is still the same codebase run natively and in the browser. This only applies to the parts that need to run in the browser; functionality not used in these apps can stay as is, even if it is completely type unstable.
Compiling C libraries for the browser is the part that would benefit most from upstream support, as mentioned above.
So that’s what I wanted to share. I know there are other initiatives for compiling Julia to WebAssembly; this is the one I found easiest to use and adapt. Comments, suggestions, or maybe even better approaches are very welcome.
Happy to chat about how to streamline this further, so that for many typical use cases there is no need to write anything browser-specific at all ![]()

