I was reading that there are now multiple options to create WebAssembly with Julia. Can I host a website with WebAssembly on GitHub?
I just want a simple site with a table and some interactivity, like applying a filter to the table (it is small, with fewer than 1000 entries) and showing some plots interactively.
I believe it is certainly possible by now. In Julia, I am aware of two packages that can do the trick: KaimonSlate.jl and Snapshot.jl.
At the beginning of August, @kahliburke sent me (in a ridiculously short period of time) four self-contained HTML files that remain interactive without a Julia server. All of them worked immaculately, using three different plotting packages (Makie, ECharts, and PlotlyJS) and many other Julia packages. Kahli has done it, but I failed to replicate his work; my skills are humble and certainly can’t match his.
I also tested Snapshot.jl in early August, and I was able to replicate some of the examples on the associated website (at least the more complicated ones worked very well). In an exchange on this forum, @Dale_James_Black pointed out that the number of packages that can be used for this compilation is currently rather limited. However, the many examples already available on the website may suggest a significant source of material for your task.
These are two possible approaches, obviously I’m biased toward my work here but these efforts are progressing, in fact after checking in with @ufechner7 on the use case I’ve made a few more enhancements to KaimonSlate.jl and I’ll push out a new release with these today.
I tried my hand at some animations for calculus students using Snapshot here:
Nothing too ambitious. Plots, but not tables, but would think that not an issue. The process required a bit of iteration, as things that run locally, don’t always compile down to wasm. It would be great to get more error messages. But, overall was pretty impressed with Snapshot.
My primary work in grad school is taking up a huge amount of time right now so I haven’t announced this as its not at a point that I feel comfortable advertising. That being said, if it’s helpful, this might be a nice way to publish interactive julia apps: https://snapshot.show and Docs - Snapshot
Firefox and Chrome always support WebAssembly by default, so using either of these browsers should work fine out of the box. See option 2 and 3 below if you’d still like to use Edge
[It can be disabled in Firefox, and JavaScript separately, both under about:config, I think only both can be disabled together with Chrome with CLI option).]
That second link you shared is pointing out how HTMX makes server driven webapps easy and lightweight to build. But the server driven webapps need a running julia server, unless you can compile to webassembly, and at that point something like Therapy.jl might be more seamless. As far as I undertand it, HTMX is great because it removes the need to have a backend language and something like React on the frontend for many apps. And instead allows your backend language to talk somewhat natively to frontend HTML
Slate currently supports a method which will export standalone HTML files, completely self contained and able to run inside of restrictive environments such as the SafeExam Browser.
This is achieved using the notebook interface. There is a small step to mark the bound/reactive/interactive portions so that the exporter can properly inline the data, which amounts to wrapping the expressions in a @replay macro. On export data is precomputed, which doesn’t cover all use cases, to be sure. However I believe it covers many of the goals users have including those described in this topic.
At the bottom is example HTML output you can test for yourself. It is authored in Slate, no JS coding needed, the data computation and storage is handled automatically. It’s the most straightforward solution I could devise for interactive notebooks authored with only Julia code, when Julia isn’t available at the time of use.
(If you do have a server which can host a Julia process, you have expanded options. Slate supports an app server for lightweight web apps, data dashboards, in the same spirit as Streamlit. The Slate server app is exported from your notebook, packaged as a distribution to deploy wherever you have Julia installed. No extra steps, just a single startup script that assembles all dependencies and serves your notebook, read only, all interactivity intact.)
No, at least not for simple things. I started to google for this, but note this is a continuing AI discussion on it and with some demos it made for me: Google Search
You can do some things without any server language, and if you need one then well it strictly needs not be Julia. Then if you need more dynamic things you can’t possibly handle then you can do them with something in addition to HTMX client-side, JavaScript or WebAssembly.
Hi @Dale_James_Black. I realized the Snapshot.jl website has changed significantly since my last visit, at least based on the link you posted above https://snapshot.show/. I noticed that none of the new entries on that website seem to have a definitive tone, but they point out (or suggest) that, in the future, using Snapshot may require a paid license.
Are you considering the possibility that all Snapshot functionalities will be covered by that paid license, or only the parts that require deployment and more sophisticated issues? For example, the most basic functionalities that we see on the GitHub site, like:
using Snapshot
# default: a lean Therapy component — cells rendered to HTML at export time + wasm
# islands, no Pluto frontend / baked statefile. Drops into any static host or
# Therapy.jl app, themeable, with or without reactivity.
html = export_notebook("notebook.jl")
# → notebook.html + notebook.islands/ (deploy both together)
# portable: embed the runtime and WASM into one directly openable file
portable = export_notebook("notebook.jl"; single_file=true)
# → notebook.html
# classic: the full Pluto static export with interactive islands
classic_html = export_notebook("notebook.jl"; therapy=false)
# → notebook.html + notebook.islands/ (deploy both together)
will also be under the license umbrella? Or will it depend on the specific uses of the outputs produced by Snapshot (commercial, educational, simple blogs, etc.)?
The open source packages are free and will stay that way. Snapshot.jl and Therapy.jl are MIT, WasmTarget.jl is Apache-2.0. That covers everything in your code block: export_notebook in all three modes, with no restriction on what you do with the output. The Snapshot.jl repo has examples showing how to publish a notebook, or a whole set of them, to GitHub Pages using nothing but Snapshot.jl and Therapy.jl. That path never involves me or a service at all and is of course completely free without any restrictions.
The other website, snapshot.show is a convenience layer on top. It is just GitHub integration that builds and publishes automatically when you push. It will likely stay free for most people to use. But I’d rather underpromise now than have someone build on an expectation I can’t keep later depending on the costs associated with running snapshot.show
Either way, nothing about Snapshot.jl or Therapy.jl changes.
Yes, it doesn’t have to be a Julia server. But any backend language that doesn’t compile to JS or WASM will still require a running server to benefit from how HTMX enables server driven webapps. Aside from that, I am not sure what the benefit would be of plain HTML files connected to one another via HTMX, but there might be great use-cases where that makes sense that I haven’t thought of! Alpine.js is also powerful and I know the Go community loves Go + HTMX + Alpine.js
Btw, the real limiting factor in all of this is the Julia → WASM story. If anyone is interested in contributing to WasmTarget.jl please do get in touch! All of the other pieces around webapps (reactivity, islands, etc.) have already been solved for the most part by battle tested Javascript and Rust frameworks (astro, solidjs, react, leptos, etc). So if anyone with real compiler knowledge (and/or access to powerful LLM) wants to help get WasmTarget.jl to real stable place, let me know!
At the state of Julia talk at juliacon this year they also mentioned something at the end about webassembly. Anyone know any more about that? It does not seem related to our community efforts here?
@ufechner7 I looked at your notebook and results and felt that I could improve Slate in a way that would make your desired results easier to achieve and more functional at the same time.