[ANN] Lit.jl — A Simple, Data-Centric Web App Framework for Julia

Nice work!

The question everyone is probably asking: why another Genie.jl?

Could you please compare the features of the two frameworks?

2 Likes

Thanks for the question!

How does Lit.jl compare to Genie.jl?

They are very different, and most of their differences arise from their different execution models.

Genie

Genie adopts a reactive component model, similar to React’s component model.

  • Traditional request/response architecture: Genie works with traditional request/response architecture, where the developer implements the response for each endpoint request.
  • Declarative UI: The UI is implemented in a declarative way, almost as if writing HTML (and sometimes literally writing HTML) but with Julia constructs.
  • Reactive model: Simple UI updates happen automatically through reactive variable binding, but custom logic in response to user interactions is implemented exclusively via callbacks.

These characteristics makes Genie very flexible, giving the developer a lot of control on how things look and behave, which makes Genie suitable for developing any kind of web app really. But they also make implementing simple interactivity that goes beyond UI updates less straightforward, especially because of the hard separation between the UI placement and the UI behavior (which resembles the separation between HTML and Javascript).

Lit

Lit adopts a top-to-bottom rerun model, like Streamlit.

  • Script rerun model: The entire app script runs from top to bottom on every user interaction, making the execution flow intuitive and easy to reason about.
  • Imperative UI: You build the UI using simple imperative Julia code - just call functions like button() and text() in the order you want them to appear.
  • Implicit reactivity: State management and UI updates happen automatically through the rerun mechanism - no need to define reactive variables or wire up callbacks (although that’s also possible).

These characteristics make Lit more approachable for scientists and researchers who want to quickly turn Julia scripts into interactive web apps, without needing to learn web development concepts like callbacks, reactive programming, or the separation between UI and behavior. But since each UI event triggers a rerun of the script and a rebuild of the page layout, Lit’s execution model can also make interactions feel less responsive for expensive reruns (although it provides mechanisms like fragments that can help with that).

Summary

  • Genie trades simplicity for flexibility and control, which is the opposite tradeoff that Lit is trying to make.
  • Their execution models are optimized for different scenarios. Genie is more suitable for traditional websites and web apps that need to provide multiple, maybe unrelated, complex functionalities that require a high degree of control. Lit is more suitable for highly specialized web apps that are focused on a single or a few tasks, and most user interactions are somewhat related to those tasks, so the script rerun model makes creating these kinds of apps really simple.

Hope that helps!

17 Likes