akin
Lissome: Phoenix LiveView integration with Gleam's Lustre framework
Hey everyone,
Recently, I’ve been working on a project that uses LiveView for most of the UI, but for some parts with very complex client state, it leverages Gleam’s Lustre framework.
If you’re not familiar with it, Lustre is a Gleam frontend framework that implements the Elm architecture and takes advantage of Gleam’s ability to compile to JS for building highly interactive UIs.
I wrote a few simple helpers and components to make integration easier and improve DX. They allow Lustre to be rendered anywhere inside HEEX and communicate with LiveView from Gleam via the WebSocket connection. It’s similar to LiveSvelte or other JS integrations, but with Gleam and Lustre. It also supports server-side rendering.
Would you be interested if I release this as an open source library (lissome)? I Just want to collect feedback before start extracting the code into a library.
Most Liked
akin
Hey all! Just released the library, it’s still extremely early stage and a lot of work to do, but here is the repo and the hex package.
https://github.com/selenil/lissome/
I’ll be sharing here some new features as I add them.
hayleigh
Wow what a cool project!
I see you’re using Lustre in its typical “SPA” mode:
pub fn main() {
let json = get_element_by_id("ls-model")
let flags = parse_flags(json)
let app = lustre.simple(init, update, view)
let assert Ok(_) = lustre.start(app, "#app", flags)
Nil
}
and decoding flags and state like you would for traditional ssr/prerendering purposes.
You might also want to dig into Lustre’s component system: because these are built on native Web Components and you’d be able to communicate directly with a LiveView app through attributes and events like any other HTML element ![]()
akin
Release 0.3.1
Hey, everyone! This release brings new features and a refactor to the approach taken by the library for doing the integration between Lustre and LiveView.
The highlights are:
- All the setup and Gleam integration with Mix has been completely changed in favor of a more solid and flexible approach. Details in the README.
- Helpers for communicating with LiveView. Now Lissome includes its own Gleam package that you can add to your Gleam project as a path dependency. It contains various helpers, among them are function to interop with Phoenix LiveView using the Lustre’s effects system.
- A live reloader that watches for changes in your Gleam files and recompiles them.
- Helpers to work with Gleam types and their Erlang representation in Elixir.
Next step will be support for lustre.component component and Lustre’s server components.
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









